summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-12-15 09:47:54 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-12-15 09:47:54 (GMT)
commitfcf91a2d527b393a366c997dd225c076afe34718 (patch)
tree0c8027b9f1059a5c63e777838fb4bf45b72293fc
parentefa48b0a5dba8c8c93612e534d04b5b04629b75c (diff)
parent1a867a3c692e375565618532b8ca686dab7e7d5e (diff)
downloadQt-fcf91a2d527b393a366c997dd225c076afe34718.zip
Qt-fcf91a2d527b393a366c997dd225c076afe34718.tar.gz
Qt-fcf91a2d527b393a366c997dd225c076afe34718.tar.bz2
Merge commit 'origin/4.6'
Conflicts: src/corelib/io/qfsfileengine.cpp src/network/access/qnetworkrequest.cpp tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
-rwxr-xr-xbin/syncqt6
-rw-r--r--config.tests/mac/crc/main.cpp4
-rw-r--r--config.tests/unix/alsa/alsatest.cpp5
-rwxr-xr-xconfigure21
-rw-r--r--[-rwxr-xr-x]configure.exebin1175040 -> 1176576 bytes
-rw-r--r--dist/changes-4.6.113
-rw-r--r--examples/graphicsview/anchorlayout/main.cpp4
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp12
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp12
-rw-r--r--mkspecs/linux-g++-gles2-experimental/qmake.conf22
-rw-r--r--mkspecs/linux-g++-gles2-experimental/qplatformdefs.h166
-rw-r--r--mkspecs/unsupported/linux-host-g++/qmake.conf138
-rw-r--r--mkspecs/unsupported/linux-host-g++/qplatformdefs.h42
-rw-r--r--projects.pro2
-rw-r--r--qmake/generators/symbian/symmake.cpp152
-rw-r--r--qmake/generators/symbian/symmake.h9
-rw-r--r--src/corelib/animation/qvariantanimation.cpp7
-rw-r--r--src/corelib/codecs/qtextcodec.h2
-rw-r--r--src/corelib/global/qglobal.cpp31
-rw-r--r--src/corelib/io/qprocess.cpp3
-rw-r--r--src/corelib/kernel/qcore_unix.cpp5
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp13
-rw-r--r--src/corelib/kernel/qobject.cpp18
-rw-r--r--src/corelib/kernel/qobject.h6
-rw-r--r--src/corelib/kernel/qobject_p.h11
-rw-r--r--src/corelib/kernel/qvariant.h2
-rw-r--r--src/corelib/tools/qcache.h3
-rw-r--r--src/corelib/tools/qregexp.h2
-rw-r--r--src/corelib/tools/qtimeline.cpp2
-rw-r--r--src/dbus/qdbusargument_p.h2
-rw-r--r--src/dbus/qdbusconnection_p.h2
-rw-r--r--src/dbus/qdbusconnectioninterface.cpp2
-rw-r--r--src/dbus/qdbuserror.cpp2
-rw-r--r--src/dbus/qdbusintegrator_p.h2
-rw-r--r--src/dbus/qdbusinterface.cpp2
-rw-r--r--src/dbus/qdbusinterface_p.h4
-rw-r--r--src/dbus/qdbusinternalfilters.cpp2
-rw-r--r--src/dbus/qdbusmessage.cpp2
-rw-r--r--src/dbus/qdbusmetatype.cpp2
-rw-r--r--src/dbus/qdbusutil.cpp2
-rw-r--r--src/dbus/qdbusxmlparser_p.h2
-rw-r--r--src/gui/dialogs/dialogs.pri18
-rw-r--r--src/gui/effects/qgraphicseffect.cpp14
-rw-r--r--src/gui/egl/qeglproperties.cpp9
-rw-r--r--src/gui/embedded/qscreen_qws.h2
-rw-r--r--src/gui/graphicsview/qgraph_p.h4
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp23
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp621
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h24
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp137
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h1
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h7
-rw-r--r--src/gui/graphicsview/qgraphicslayout.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp36
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp26
-rw-r--r--src/gui/graphicsview/qgraphicsview.h1
-rw-r--r--src/gui/graphicsview/qgraphicsview_p.h3
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.h2
-rw-r--r--src/gui/graphicsview/qsimplex_p.h2
-rw-r--r--src/gui/image/qimage.h6
-rw-r--r--src/gui/image/qpixmap.h2
-rw-r--r--src/gui/image/qpixmapcache.cpp5
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp4
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp4
-rw-r--r--src/gui/itemviews/qlistwidget.cpp5
-rw-r--r--src/gui/itemviews/qtreeview.cpp1
-rw-r--r--src/gui/kernel/qapplication.cpp10
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp11
-rw-r--r--src/gui/kernel/qwidget.cpp16
-rw-r--r--src/gui/kernel/qwidget.h1
-rw-r--r--src/gui/kernel/qwidget_mac.mm112
-rw-r--r--src/gui/kernel/qwidget_p.h2
-rw-r--r--src/gui/painting/qbezier_p.h2
-rw-r--r--src/gui/painting/qmatrix.h2
-rw-r--r--src/gui/painting/qpaintdevice.h2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qpainter.cpp86
-rw-r--r--src/gui/painting/qprinterinfo_unix.cpp50
-rw-r--r--src/gui/painting/qregion.h2
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h5
-rw-r--r--src/gui/styles/qgtkstyle.cpp16
-rw-r--r--src/gui/styles/qgtkstyle_p.cpp2
-rw-r--r--src/gui/styles/qgtkstyle_p.h2
-rw-r--r--src/gui/styles/qs60style.cpp25
-rw-r--r--src/gui/styles/qs60style_p.h2
-rw-r--r--src/gui/styles/qs60style_s60.cpp759
-rw-r--r--src/gui/styles/styles.pri2
-rw-r--r--src/gui/text/qfontengine.cpp120
-rw-r--r--src/gui/text/qfontengine_p.h16
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h7
-rw-r--r--src/gui/util/qdesktopservices_s60.cpp72
-rw-r--r--src/gui/util/qsystemtrayicon.cpp3
-rw-r--r--src/gui/util/qsystemtrayicon_mac.mm28
-rw-r--r--src/gui/widgets/qabstractspinbox.cpp4
-rw-r--r--src/gui/widgets/qdialogbuttonbox.cpp30
-rw-r--r--src/gui/widgets/qdockarealayout.cpp4
-rw-r--r--src/gui/widgets/qlcdnumber.h3
-rw-r--r--src/gui/widgets/qlineedit.cpp10
-rw-r--r--src/gui/widgets/qmenu.cpp35
-rw-r--r--src/gui/widgets/qmenu_p.h1
-rw-r--r--src/gui/widgets/qprintpreviewwidget.h2
-rw-r--r--src/gui/widgets/qpushbutton.cpp33
-rw-r--r--src/gui/widgets/qpushbutton_p.h4
-rw-r--r--src/gui/widgets/qtoolbar.cpp2
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp15
-rw-r--r--src/gui/widgets/qtoolbarlayout.cpp3
-rw-r--r--src/multimedia/audio/audio.pri5
-rw-r--r--src/multimedia/audio/qaudiodevicefactory.cpp14
-rw-r--r--src/multimedia/audio/qaudioinput.cpp15
-rw-r--r--src/multimedia/audio/qaudiooutput.cpp15
-rw-r--r--src/network/access/qnetworkrequest.cpp4
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp96
-rw-r--r--src/opengl/qgl.cpp541
-rw-r--r--src/opengl/qgl_p.h68
-rw-r--r--src/opengl/qgl_x11.cpp24
-rw-r--r--src/opengl/qgl_x11egl.cpp118
-rw-r--r--src/opengl/qglextensions_p.h17
-rw-r--r--src/opengl/qpixmapdata_gl.cpp97
-rw-r--r--src/opengl/qpixmapdata_gl_p.h4
-rw-r--r--src/opengl/qwindowsurface_gl.cpp9
-rw-r--r--src/openvg/qpixmapdata_vg.cpp41
-rw-r--r--src/openvg/qpixmapdata_vg_p.h31
-rw-r--r--src/openvg/qvg_p.h10
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp124
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp65
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp4
-rw-r--r--src/plugins/sqldrivers/sqldrivers.pro4
-rw-r--r--src/qt_install.pri6
-rw-r--r--src/s60installs/bwins/QtCoreu.def2
-rw-r--r--src/s60installs/bwins/QtGuiu.def1
-rw-r--r--src/s60installs/eabi/QtGuiu.def51
-rw-r--r--src/s60installs/eabi/QtOpenVGu.def8
-rw-r--r--src/script/api/qscriptengine.cpp7
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp17
-rw-r--r--src/sql/kernel/qsqlcachedresult.cpp5
-rw-r--r--tests/auto/auto.pro6
-rw-r--r--tests/auto/qdesktopservices/tst_qdesktopservices.cpp16
-rw-r--r--tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp12
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp2
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp77
-rw-r--r--tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp31
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp12
-rw-r--r--tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp2
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp56
-rw-r--r--tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp2
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp45
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp32
-rw-r--r--tests/auto/qlistwidget/tst_qlistwidget.cpp9
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp35
-rw-r--r--tests/auto/qobject/tst_qobject.cpp8
-rw-r--r--tests/auto/qpixmapcache/tst_qpixmapcache.cpp19
-rw-r--r--tests/auto/qprocessenvironment/qprocessenvironment.pro5
-rw-r--r--tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp265
-rw-r--r--tests/auto/qsharedmemory/tst_qsharedmemory.cpp4
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp10
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp1
-rw-r--r--tests/auto/qtouchevent/tst_qtouchevent.cpp250
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp17
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp16
-rw-r--r--tests/benchmarks/benchmarks.pro20
-rw-r--r--tests/benchmarks/qscriptengine/tst_qscriptengine.cpp21
-rw-r--r--tests/manual/qgraphicsitemgroup/customitem.cpp107
-rw-r--r--tests/manual/qgraphicsitemgroup/customitem.h77
-rw-r--r--tests/manual/qgraphicsitemgroup/main.cpp51
-rw-r--r--tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro8
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.cpp260
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.h93
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.ui319
-rw-r--r--tests/manual/qwidget_zorder/main.cpp118
-rw-r--r--tests/manual/qwidget_zorder/qwidget_zorder.pro6
-rw-r--r--tools/assistant/lib/qhelpsearchengine.h2
-rw-r--r--tools/configure/configureapp.cpp11
-rw-r--r--tools/linguist/lrelease/lrelease.pro2
-rw-r--r--util/s60pixelmetrics/pixel_metrics.cpp5
176 files changed, 4884 insertions, 1762 deletions
diff --git a/bin/syncqt b/bin/syncqt
index 8bb4bb9..e19018c 100755
--- a/bin/syncqt
+++ b/bin/syncqt
@@ -665,6 +665,7 @@ foreach (@modules_to_sync) {
#information used after the syncing
my $pri_install_classes = "";
my $pri_install_files = "";
+ my $pri_install_pfiles = "";
my $libcapitals = $lib;
$libcapitals =~ y/a-z/A-Z/;
@@ -833,6 +834,10 @@ foreach (@modules_to_sync) {
$pri_install_files.= "$pri_install_iheader ";;
}
}
+ else {
+ my $pri_install_iheader = fixPaths($iheader, $current_dir);
+ $pri_install_pfiles.= "$pri_install_iheader ";;
+ }
}
print "header created for $iheader ($header_copies)\n" if($header_copies > 0);
}
@@ -877,6 +882,7 @@ foreach (@modules_to_sync) {
my $headers_pri_contents = "";
$headers_pri_contents .= "SYNCQT.HEADER_FILES = $pri_install_files\n";
$headers_pri_contents .= "SYNCQT.HEADER_CLASSES = $pri_install_classes\n";
+ $headers_pri_contents .= "SYNCQT.PRIVATE_HEADER_FILES = $pri_install_pfiles\n";
my $headers_pri_file = "$out_basedir/include/$lib/headers.pri";
if(-e "$headers_pri_file") {
open HEADERS_PRI_FILE, "<$headers_pri_file";
diff --git a/config.tests/mac/crc/main.cpp b/config.tests/mac/crc/main.cpp
index 894f88b..700a4cd 100644
--- a/config.tests/mac/crc/main.cpp
+++ b/config.tests/mac/crc/main.cpp
@@ -71,7 +71,7 @@ private:
for(int iCodes = 0; iCodes <= 0xFF; iCodes++) {
ulTable[iCodes] = Reflect(iCodes, 8) << 24;
for(int iPos = 0; iPos < 8; iPos++) {
- ulTable[iCodes] = (ulTable[iCodes] << 1)
+ ulTable[iCodes] = ((ulTable[iCodes] << 1) & 0xffffffff)
^ ((ulTable[iCodes] & (1 << 31)) ? ulPolynomial : 0);
}
@@ -84,7 +84,7 @@ private:
// Swap bit 0 for bit 7, bit 1 For bit 6, etc....
for(int iPos = 1; iPos < (cChar + 1); iPos++) {
if(ulReflect & 1) {
- ulValue |= (1 << (cChar - iPos));
+ ulValue |= (1ul << (cChar - iPos));
}
ulReflect >>= 1;
}
diff --git a/config.tests/unix/alsa/alsatest.cpp b/config.tests/unix/alsa/alsatest.cpp
index 1307c4e..f1092f8 100644
--- a/config.tests/unix/alsa/alsatest.cpp
+++ b/config.tests/unix/alsa/alsatest.cpp
@@ -40,8 +40,11 @@
****************************************************************************/
#include <alsa/asoundlib.h>
+#if(!(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 10))
+#error "Alsa version found too old, require >= 1.0.10"
+#endif
+
int main(int argc,char **argv)
{
- return 0;
}
diff --git a/configure b/configure
index 6dc3898..436be8a 100755
--- a/configure
+++ b/configure
@@ -131,7 +131,7 @@ compilerSupportsFlag()
cat >conftest.cpp <<EOF
int main() { return 0; }
EOF
- "$TEST_COMPILER" "$@" -o /dev/null conftest.cpp
+ "$TEST_COMPILER" "$@" -o conftest.o conftest.cpp
ret=$?
rm -f conftest.cpp conftest.o
return $ret
@@ -662,6 +662,7 @@ CFG_RELEASE_QMAKE=no
CFG_PHONON=auto
CFG_PHONON_BACKEND=yes
CFG_MULTIMEDIA=yes
+CFG_AUDIO_BACKEND=yes
CFG_SVG=yes
CFG_DECLARATIVE=auto
CFG_WEBKIT=auto # (yes|no|auto)
@@ -904,7 +905,7 @@ while [ "$#" -gt 0 ]; do
VAL=no
;;
#Qt style yes options
- -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config)
+ -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
@@ -2068,6 +2069,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
+ audio-backend)
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+ CFG_AUDIO_BACKEND="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
*)
UNKNOWN_OPT=yes
;;
@@ -3259,7 +3267,7 @@ Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir
[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
[-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
[-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
- [-no-openssl] [-openssl] [-openssl-linked]
+ [-no-audio-backend] [-audio-backend] [-no-openssl] [-openssl] [-openssl-linked]
[-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit]
[-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative]
@@ -3397,6 +3405,9 @@ fi
-no-multimedia ..... Do not build the QtMultimedia module.
+ -multimedia ........ Build the QtMultimedia module.
+ -no-audio-backend .. Do not build the platform audio backend into QtMultimedia.
+ + -audio-backend ..... Build the platform audio backend into QtMultimedia if available.
+
-no-phonon ......... Do not build the Phonon module.
+ -phonon ............ Build the Phonon module.
Phonon is built if a decent C++ compiler is used.
@@ -6444,6 +6455,10 @@ else
QT_CONFIG="$QT_CONFIG multimedia"
fi
+if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG audio-backend"
+fi
+
if [ "$CFG_SVG" = "yes" ]; then
QT_CONFIG="$QT_CONFIG svg"
else
diff --git a/configure.exe b/configure.exe
index 351ed04..a410efc 100755..100644
--- a/configure.exe
+++ b/configure.exe
Binary files differ
diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1
index 6896358..5efa0e2 100644
--- a/dist/changes-4.6.1
+++ b/dist/changes-4.6.1
@@ -46,8 +46,11 @@ QtCore
QtGui
-----
- - foo
- * bar
+ - QPixmap
+ * load() and loadFromData() can now support compressed GL textures
+ in the DDS, ETC1, PVRTC2, and PVRTC4 formats if the OpenGL graphics
+ system is active and the appropriate extensions are present in the
+ GL implementation.
QtDBus
------
@@ -64,8 +67,10 @@ QtNetwork
QtOpenGL
--------
- - foo
- * bar
+ - QGLContext
+ * bindTexture(QString) now supports DDS, ETC1, PVRTC2, and PVRTC4
+ compressed textures if the appropriate extensions are present
+ in the GL implementation.
QtScript
--------
diff --git a/examples/graphicsview/anchorlayout/main.cpp b/examples/graphicsview/anchorlayout/main.cpp
index f898d1d..389bc9e 100644
--- a/examples/graphicsview/anchorlayout/main.cpp
+++ b/examples/graphicsview/anchorlayout/main.cpp
@@ -122,8 +122,8 @@ int main(int argc, char **argv)
scene.addItem(w);
scene.setBackgroundBrush(Qt::darkGreen);
- QGraphicsView *view = new QGraphicsView(&scene);
- view->show();
+ QGraphicsView view(&scene);
+ view.show();
return app.exec();
}
diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index 62afd73..75bddd6 100644
--- a/examples/multimedia/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
@@ -195,7 +195,6 @@ InputTest::InputTest()
pullMode = true;
- // AudioInfo class only supports mono S16LE samples!
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(16);
@@ -203,6 +202,17 @@ InputTest::InputTest()
format.setByteOrder(QAudioFormat::LittleEndian);
format.setCodec("audio/pcm");
+ QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
+ if (!info.isFormatSupported(format)) {
+ qWarning()<<"default format not supported try to use nearest";
+ format = info.nearestFormat(format);
+ }
+
+ if(format.sampleSize() != 16) {
+ qWarning()<<"audio device doesn't support 16 bit samples, example cannot run";
+ return;
+ }
+
audioInput = new QAudioInput(format,this);
connect(audioInput,SIGNAL(notify()),SLOT(status()));
connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index 244840d..b6047db 100644
--- a/examples/multimedia/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
@@ -170,6 +170,18 @@ AudioTest::AudioTest()
settings.setCodec("audio/pcm");
settings.setByteOrder(QAudioFormat::LittleEndian);
settings.setSampleType(QAudioFormat::SignedInt);
+
+ QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
+ if (!info.isFormatSupported(settings)) {
+ qWarning()<<"default format not supported try to use nearest";
+ settings = info.nearestFormat(settings);
+ }
+
+ if(settings.sampleSize() != 16) {
+ qWarning()<<"audio device doesn't support 16 bit samples, example cannot run";
+ return;
+ }
+
audioOutput = new QAudioOutput(settings,this);
connect(audioOutput,SIGNAL(notify()),SLOT(status()));
connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
diff --git a/mkspecs/linux-g++-gles2-experimental/qmake.conf b/mkspecs/linux-g++-gles2-experimental/qmake.conf
deleted file mode 100644
index 9c28d17..0000000
--- a/mkspecs/linux-g++-gles2-experimental/qmake.conf
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Experimental qmake configuration for GLES2
-#
-
-MAKEFILE_GENERATOR = UNIX
-TEMPLATE = app
-CONFIG += qt warn_on release incremental link_prl
-QT += core gui
-QMAKE_INCREMENTAL_STYLE = sublib
-
-include(../common/g++.conf)
-
-QMAKE_LFLAGS += -Wl,-rpath-link=/usr/lib
-
-include(../common/linux.conf)
-
-QMAKE_LIBS_EGL = -lEGL
-QMAKE_LIBS_OPENGL = -lGLESv2
-QMAKE_LIBS_OPENGL_QT = -lGLESv2 -lEGL
-
-
-load(qt_config)
diff --git a/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h b/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h
deleted file mode 100644
index ecfbc73..0000000
--- a/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec 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 QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-// Get Qt defines/settings
-
-#include "qglobal.h"
-
-// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
-
-// 1) need to reset default environment if _BSD_SOURCE is defined
-// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
-// 3) it seems older glibc need this to include the X/Open stuff
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
-
-#include <unistd.h>
-
-
-// We are hot - unistd.h should have turned on the specific APIs we requested
-
-#include <features.h>
-#include <pthread.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <grp.h>
-#include <pwd.h>
-#include <signal.h>
-#include <dlfcn.h>
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/ipc.h>
-#include <sys/time.h>
-#include <sys/shm.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <netinet/in.h>
-#ifndef QT_NO_IPV6IFNAME
-#include <net/if.h>
-#endif
-
-#ifdef QT_LARGEFILE_SUPPORT
-#define QT_STATBUF struct stat64
-#define QT_STATBUF4TSTAT struct stat64
-#define QT_STAT ::stat64
-#define QT_FSTAT ::fstat64
-#define QT_LSTAT ::lstat64
-#define QT_OPEN ::open64
-#define QT_TRUNCATE ::truncate64
-#define QT_FTRUNCATE ::ftruncate64
-#define QT_LSEEK ::lseek64
-#else
-#define QT_STATBUF struct stat
-#define QT_STATBUF4TSTAT struct stat
-#define QT_STAT ::stat
-#define QT_FSTAT ::fstat
-#define QT_LSTAT ::lstat
-#define QT_OPEN ::open
-#define QT_TRUNCATE ::truncate
-#define QT_FTRUNCATE ::ftruncate
-#define QT_LSEEK ::lseek
-#endif
-
-#ifdef QT_LARGEFILE_SUPPORT
-#define QT_FOPEN ::fopen64
-#define QT_FSEEK ::fseeko64
-#define QT_FTELL ::ftello64
-#define QT_FGETPOS ::fgetpos64
-#define QT_FSETPOS ::fsetpos64
-#define QT_MMAP ::mmap64
-#define QT_FPOS_T fpos64_t
-#define QT_OFF_T off64_t
-#else
-#define QT_FOPEN ::fopen
-#define QT_FSEEK ::fseek
-#define QT_FTELL ::ftell
-#define QT_FGETPOS ::fgetpos
-#define QT_FSETPOS ::fsetpos
-#define QT_MMAP ::mmap
-#define QT_FPOS_T fpos_t
-#define QT_OFF_T long
-#endif
-
-#define QT_STAT_REG S_IFREG
-#define QT_STAT_DIR S_IFDIR
-#define QT_STAT_MASK S_IFMT
-#define QT_STAT_LNK S_IFLNK
-#define QT_SOCKET_CONNECT ::connect
-#define QT_SOCKET_BIND ::bind
-#define QT_FILENO fileno
-#define QT_CLOSE ::close
-#define QT_READ ::read
-#define QT_WRITE ::write
-#define QT_ACCESS ::access
-#define QT_GETCWD ::getcwd
-#define QT_CHDIR ::chdir
-#define QT_MKDIR ::mkdir
-#define QT_RMDIR ::rmdir
-#define QT_OPEN_LARGEFILE O_LARGEFILE
-#define QT_OPEN_RDONLY O_RDONLY
-#define QT_OPEN_WRONLY O_WRONLY
-#define QT_OPEN_RDWR O_RDWR
-#define QT_OPEN_CREAT O_CREAT
-#define QT_OPEN_TRUNC O_TRUNC
-#define QT_OPEN_APPEND O_APPEND
-
-#define QT_SIGNAL_RETTYPE void
-#define QT_SIGNAL_ARGS int
-#define QT_SIGNAL_IGNORE SIG_IGN
-
-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
-#define QT_SOCKLEN_T socklen_t
-#else
-#define QT_SOCKLEN_T int
-#endif
-
-#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
-#define QT_SNPRINTF ::snprintf
-#define QT_VSNPRINTF ::vsnprintf
-#endif
-
-
-#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/unsupported/linux-host-g++/qmake.conf b/mkspecs/unsupported/linux-host-g++/qmake.conf
new file mode 100644
index 0000000..237477c
--- /dev/null
+++ b/mkspecs/unsupported/linux-host-g++/qmake.conf
@@ -0,0 +1,138 @@
+#
+# QMake configuration for Scratchbox's host-gcc compiler.
+#
+# This mkspec can be used as the platform mkspec when building
+# Qt in scratchbox. If used as such, qmake and similar host
+# tools will be compiled for the host architecture (E.g. x86)
+# and thus not run in the emulator. This results in a
+# significant improvement in build times.
+#
+# Note: The mkspec copied & pasted parts from common/gcc.conf
+# and common/linux.conf as setBootstrapVariable in
+# configure has a bug which stops re-assignments working
+# for QMake variables (I.e. "QMAKE_foo = bar" is broken).
+
+MAKEFILE_GENERATOR = UNIX
+TEMPLATE = app
+CONFIG += qt warn_on release incremental link_prl
+QT += core gui
+QMAKE_INCREMENTAL_STYLE = sublib
+
+#
+# qmake configuration for common gcc
+#
+
+QMAKE_CC = host-gcc
+QMAKE_CFLAGS += -pipe
+QMAKE_CFLAGS_DEPS += -M
+QMAKE_CFLAGS_WARN_ON += -Wall -W
+QMAKE_CFLAGS_WARN_OFF += -w
+QMAKE_CFLAGS_RELEASE += -O2
+QMAKE_CFLAGS_DEBUG += -g
+QMAKE_CFLAGS_SHLIB += -fPIC
+QMAKE_CFLAGS_STATIC_LIB += -fPIC
+QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses
+QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden
+QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
+QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE}
+
+QMAKE_CXX = host-g++
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
+QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS
+QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON
+QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF
+QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
+QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG
+QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB
+QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB
+QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC
+QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
+QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
+QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+
+QMAKE_LINK = host-g++
+QMAKE_LINK_SHLIB = host-g++
+QMAKE_LINK_C = host-gcc
+QMAKE_LINK_C_SHLIB = host-gcc
+QMAKE_LFLAGS +=
+QMAKE_LFLAGS_RELEASE += -Wl,-O1
+QMAKE_LFLAGS_DEBUG +=
+QMAKE_LFLAGS_APP +=
+QMAKE_LFLAGS_SHLIB += -shared
+QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB
+QMAKE_LFLAGS_SONAME += -Wl,-soname,
+QMAKE_LFLAGS_THREAD +=
+QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined
+QMAKE_RPATH = -Wl,-rpath,
+
+QMAKE_PCH_OUTPUT_EXT = .gch
+
+# -Bsymbolic-functions (ld) support
+QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions
+QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,
+
+#
+# qmake configuration for common linux
+#
+
+QMAKE_CFLAGS_THREAD += -D_REENTRANT
+QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD
+
+QMAKE_INCDIR =
+QMAKE_LIBDIR =
+QMAKE_INCDIR_X11 = /usr/X11R6/include
+QMAKE_LIBDIR_X11 = /usr/X11R6/lib
+QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
+QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
+QMAKE_INCDIR_OPENGL = /usr/X11R6/include
+QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
+QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL
+QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL
+QMAKE_INCDIR_OPENGL_ES1CL = $$QMAKE_INCDIR_OPENGL
+QMAKE_LIBDIR_OPENGL_ES1CL = $$QMAKE_LIBDIR_OPENGL
+QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
+QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
+QMAKE_INCDIR_EGL =
+QMAKE_LIBDIR_EGL =
+QMAKE_INCDIR_OPENVG =
+QMAKE_LIBDIR_OPENVG =
+
+QMAKE_LIBS =
+QMAKE_LIBS_DYNLOAD = -ldl
+QMAKE_LIBS_X11 = -lXext -lX11 -lm
+QMAKE_LIBS_X11SM = -lSM -lICE
+QMAKE_LIBS_NIS = -lnsl
+QMAKE_LIBS_EGL = -lEGL
+QMAKE_LIBS_OPENGL = -lGLU -lGL
+QMAKE_LIBS_OPENGL_QT = -lGL
+QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM
+QMAKE_LIBS_OPENGL_ES1CL = -lGLES_CL
+QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
+QMAKE_LIBS_OPENVG = -lOpenVG
+QMAKE_LIBS_THREAD = -lpthread
+
+QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
+QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
+
+QMAKE_AR = host-ar cqs
+QMAKE_OBJCOPY = host-objcopy
+QMAKE_RANLIB =
+
+QMAKE_TAR = tar -cf
+QMAKE_GZIP = gzip -9f
+
+QMAKE_COPY = cp -f
+QMAKE_COPY_FILE = $(COPY)
+QMAKE_COPY_DIR = $(COPY) -r
+QMAKE_MOVE = mv -f
+QMAKE_DEL_FILE = rm -f
+QMAKE_DEL_DIR = rmdir
+QMAKE_STRIP = host-strip
+QMAKE_STRIPFLAGS_LIB += --strip-unneeded
+QMAKE_CHK_DIR_EXISTS = test -d
+QMAKE_MKDIR = mkdir -p
+QMAKE_INSTALL_FILE = install -m 644 -p
+QMAKE_INSTALL_PROGRAM = install -m 755 -p
+
+include(../common/unix.conf)
+load(qt_config)
diff --git a/mkspecs/unsupported/linux-host-g++/qplatformdefs.h b/mkspecs/unsupported/linux-host-g++/qplatformdefs.h
new file mode 100644
index 0000000..60e0f5e
--- /dev/null
+++ b/mkspecs/unsupported/linux-host-g++/qplatformdefs.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** 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 qmake spec 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 "../../linux-g++/qplatformdefs.h"
diff --git a/projects.pro b/projects.pro
index 497acd0..d405a5b 100644
--- a/projects.pro
+++ b/projects.pro
@@ -48,7 +48,7 @@ for(PROJECT, $$list($$lower($$unique(QT_BUILD_PARTS)))) {
contains(QT_BUILD_PARTS, tools) {
include(translations/translations.pri) # ts targets
} else {
- SUBDIRS += tools/linguist/lrelease
+ !wince*:!symbian:SUBDIRS += tools/linguist/lrelease
}
SUBDIRS += translations # qm build step
} else:isEqual(PROJECT, qmake) {
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index afaf338..8379ed9 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -77,6 +77,15 @@
#define MMP_LINKEROPTION_CW "LINKEROPTION CW"
#define MMP_LINKEROPTION_ARMCC "LINKEROPTION ARMCC"
#define MMP_LINKEROPTION_GCCE "LINKEROPTION GCCE"
+#define MMP_CAPABILITY "CAPABILITY"
+#define MMP_EPOCALLOWDLLDATA "EPOCALLOWDLLDATA"
+#define MMP_EPOCHEAPSIZE "EPOCHEAPSIZE"
+#define MMP_EPOCSTACKSIZE "EPOCSTACKSIZE"
+#define MMP_UID "UID"
+#define MMP_VENDORID "VENDORID"
+#define MMP_VERSION "VERSION"
+#define MMP_START_RESOURCE "START RESOURCE"
+#define MMP_END_RESOURCE "END"
#define SIS_TARGET "sis"
#define OK_SIS_TARGET "ok_sis"
@@ -155,7 +164,7 @@ void SymbianMakefileGenerator::writeHeader(QTextStream &t)
{
t << "// ============================================================================" << endl;
t << "// * Makefile for building: " << escapeFilePath(var("TARGET")) << endl;
- t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: ";
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
t << "// * This file is generated by qmake and should not be modified by the" << endl;
t << "// * user." << endl;
@@ -444,7 +453,7 @@ void SymbianMakefileGenerator::writeCustomDefFile()
QTextStream t(&ft);
t << "; ==============================================================================" << endl;
- t << "; Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << "; Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: ";
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
t << "; This file is generated by qmake and should not be modified by the" << endl;
t << "; user." << endl;
@@ -646,30 +655,76 @@ void SymbianMakefileGenerator::initMmpVariables()
// Check MMP_RULES for singleton keywords that are overridden
QStringList overridableMmpKeywords;
+ QStringList restrictableMmpKeywords;
+ QStringList restrictedMmpKeywords;
+ bool inResourceBlock = false;
+
overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE);
+ restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID)
+ << QLatin1String(MMP_OPTION_CW) << QLatin1String(MMP_OPTION_ARMCC)
+ << QLatin1String(MMP_OPTION_GCCE) << QLatin1String(MMP_LINKEROPTION_CW)
+ << QLatin1String(MMP_LINKEROPTION_ARMCC) << QLatin1String(MMP_LINKEROPTION_GCCE)
+ << QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA)
+ << QLatin1String(MMP_EPOCHEAPSIZE) << QLatin1String(MMP_EPOCSTACKSIZE)
+ << QLatin1String(MMP_UID) << QLatin1String(MMP_VENDORID)
+ << QLatin1String(MMP_VERSION);
foreach (QString item, project->values("MMP_RULES")) {
if (project->values(item).isEmpty()) {
- checkOverridability(overridableMmpKeywords, item);
+ handleMmpRulesOverrides(item, inResourceBlock, restrictedMmpKeywords,
+ restrictableMmpKeywords, overridableMmpKeywords);
} else {
foreach (QString itemRow, project->values(item)) {
- checkOverridability(overridableMmpKeywords, itemRow);
+ handleMmpRulesOverrides(itemRow, inResourceBlock, restrictedMmpKeywords,
+ restrictableMmpKeywords, overridableMmpKeywords);
}
}
}
+
+ if (restrictedMmpKeywords.size()) {
+ fprintf(stderr, "Warning: Restricted statements detected in MMP_RULES:\n"
+ " (%s)\n"
+ " Use corresponding qmake variable(s) instead.\n",
+ qPrintable(restrictedMmpKeywords.join(", ")));
+ }
}
-void SymbianMakefileGenerator::checkOverridability(QStringList &overridableKeywords, QString &checkString)
+void SymbianMakefileGenerator::handleMmpRulesOverrides(QString &checkString,
+ bool &inResourceBlock,
+ QStringList &restrictedMmpKeywords,
+ const QStringList &restrictableMmpKeywords,
+ const QStringList &overridableMmpKeywords)
{
- // Check if checkString contains overridable keyword and
- // add the keyword to overridden keywords list if so.
QString simplifiedString = checkString.simplified();
- foreach (QString item, overridableKeywords) {
- if (simplifiedString.startsWith(item))
- appendIfnotExist(overriddenMmpKeywords, item);
+
+ if (!inResourceBlock && simplifiedString.startsWith(MMP_START_RESOURCE, Qt::CaseInsensitive))
+ inResourceBlock = true;
+ else if (inResourceBlock && simplifiedString.startsWith(MMP_END_RESOURCE, Qt::CaseInsensitive))
+ inResourceBlock = false;
+
+ // Allow restricted and overridable items in RESOURCE blocks as those do not actually
+ // override anything.
+ if (!inResourceBlock) {
+ appendKeywordIfMatchFound(overriddenMmpKeywords, overridableMmpKeywords, simplifiedString);
+ appendKeywordIfMatchFound(restrictedMmpKeywords, restrictableMmpKeywords, simplifiedString);
+ }
+}
+
+void SymbianMakefileGenerator::appendKeywordIfMatchFound(QStringList &list,
+ const QStringList &keywordList,
+ QString &checkString)
+{
+ // Check if checkString starts with any supplied keyword and
+ // add the found keyword to list if it does.
+ foreach (QString item, keywordList) {
+ if (checkString.startsWith(QString(item).append(" "), Qt::CaseInsensitive)
+ || checkString.compare(item, Qt::CaseInsensitive) == 0) {
+ appendIfnotExist(list, item);
+ }
}
}
+
bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList &stringList)
{
QStringList tmpStringList;
@@ -690,7 +745,7 @@ bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList &stringList)
void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t)
{
t << "// ==============================================================================" << endl;
- t << "// Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << "// Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: ";
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
t << "// This file is generated by qmake and should not be modified by the" << endl;
t << "// user." << endl;
@@ -775,7 +830,7 @@ void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t)
void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value)
{
- t << "MACRO" << "\t\t" << value << endl;
+ t << "MACRO\t\t" << value << endl;
}
@@ -784,28 +839,28 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t)
bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE);
if (targetType == TypeExe) {
- t << MMP_TARGET << "\t\t" << fixedTarget << ".exe" << endl;
+ t << MMP_TARGET "\t\t" << fixedTarget << ".exe" << endl;
if (!skipTargetType) {
if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
- t << MMP_TARGETTYPE << "\t\t" << "STDEXE" << endl;
+ t << MMP_TARGETTYPE "\t\tSTDEXE" << endl;
else
- t << MMP_TARGETTYPE << "\t\t" << "EXE" << endl;
+ t << MMP_TARGETTYPE "\t\tEXE" << endl;
}
} else if (targetType == TypeDll || targetType == TypePlugin) {
- t << MMP_TARGET << "\t\t" << fixedTarget << ".dll" << endl;
+ t << MMP_TARGET "\t\t" << fixedTarget << ".dll" << endl;
if (!skipTargetType) {
if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
- t << MMP_TARGETTYPE << "\t\t" << "STDDLL" << endl;
+ t << MMP_TARGETTYPE "\t\tSTDDLL" << endl;
else
- t << MMP_TARGETTYPE << "\t\t" << "DLL" << endl;
+ t << MMP_TARGETTYPE "\t\tDLL" << endl;
}
} else if (targetType == TypeLib) {
- t << MMP_TARGET << "\t\t" << fixedTarget << ".lib" << endl;
+ t << MMP_TARGET "\t\t" << fixedTarget << ".lib" << endl;
if (!skipTargetType) {
if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
- t << MMP_TARGETTYPE << "\t\t" << "STDLIB" << endl;
+ t << MMP_TARGETTYPE "\t\tSTDLIB" << endl;
else
- t << MMP_TARGETTYPE << "\t\t" << "LIB" << endl;
+ t << MMP_TARGETTYPE "\t\tLIB" << endl;
}
} else {
fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType);
@@ -813,30 +868,30 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t)
t << endl;
- t << "UID" << "\t\t" << uid2 << " " << uid3 << endl;
+ t << MMP_UID "\t\t" << uid2 << " " << uid3 << endl;
if (0 != project->values("TARGET.SID").size()) {
- t << MMP_SECUREID << "\t\t" << project->values("TARGET.SID").join(" ") << endl;
+ t << MMP_SECUREID "\t\t" << project->values("TARGET.SID").join(" ") << endl;
} else {
if (0 == uid3.size())
- t << MMP_SECUREID << "\t\t" << "0" << endl;
+ t << MMP_SECUREID "\t\t0" << endl;
else
- t << MMP_SECUREID << "\t\t" << uid3 << endl;
+ t << MMP_SECUREID "\t\t" << uid3 << endl;
}
// default value used from mkspecs is 0
if (0 != project->values("TARGET.VID").size()) {
- t << "VENDORID" << "\t\t" << project->values("TARGET.VID").join(" ") << endl;
+ t << MMP_VENDORID "\t\t" << project->values("TARGET.VID").join(" ") << endl;
}
t << endl;
if (0 != project->first("TARGET.EPOCSTACKSIZE").size())
- t << "EPOCSTACKSIZE" << "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl;
+ t << MMP_EPOCSTACKSIZE "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl;
if (0 != project->values("TARGET.EPOCHEAPSIZE").size())
- t << "EPOCHEAPSIZE" << "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl;
+ t << MMP_EPOCHEAPSIZE "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl;
if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size())
- t << "EPOCALLOWDLLDATA" << endl;
+ t << MMP_EPOCALLOWDLLDATA << endl;
if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {
// Use custom def file for Qt plugins
@@ -865,20 +920,20 @@ void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringL
t << lang << " "; // no endl
}
t << endl;
- t << "START RESOURCE\t\t" << locTarget << endl;
+ t << MMP_START_RESOURCE "\t\t" << locTarget << endl;
t << "HEADER" << endl;
t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl;
- t << "END" << endl << endl;
+ t << MMP_END_RESOURCE << endl << endl;
QString regTarget = fixedTarget;
regTarget.append("_reg.rss");
t << "SOURCEPATH\t\t\t." << endl;
- t << "START RESOURCE\t\t" << regTarget << endl;
+ t << MMP_START_RESOURCE "\t\t" << regTarget << endl;
if (isForSymbianSbsv2())
t << "DEPENDS " << fixedTarget << ".rsg" << endl;
t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl;
- t << "END" << endl << endl;
+ t << MMP_END_RESOURCE << endl << endl;
}
}
@@ -890,7 +945,7 @@ void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t)
QStringList values = it.value();
for (int i = 0; i < values.size(); ++i) {
QString handledPath = values.at(i);
- t << "SYSTEMINCLUDE" << "\t\t" << fixPathForMmp(handledPath, current) << endl;
+ t << "SYSTEMINCLUDE\t\t" << fixPathForMmp(handledPath, current) << endl;
}
}
@@ -946,14 +1001,14 @@ void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t)
{
if (0 != project->first("TARGET.CAPABILITY").size()) {
QStringList &capabilities = project->values("TARGET.CAPABILITY");
- t << "CAPABILITY" << "\t\t";
+ t << MMP_CAPABILITY "\t\t";
for (int i = 0; i < capabilities.size(); ++i) {
QString cap = capabilities.at(i);
t << cap << " ";
}
} else {
- t << "CAPABILITY" << "\t\t" << "None";
+ t << MMP_CAPABILITY "\t\tNone";
}
t << endl << endl;
}
@@ -1048,21 +1103,21 @@ void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t)
if (!gccelink.isEmpty() && gccelink[gccelink.size()-1] == ' ')
gccelink.chop(1);
- if (!cw.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_CW))
+ if (!cw.isEmpty())
t << MMP_OPTION_CW " " << cw << endl;
- if (!armcc.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_ARMCC))
+ if (!armcc.isEmpty())
t << MMP_OPTION_ARMCC " " << armcc << endl;
- if (!gcce.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_GCCE))
+ if (!gcce.isEmpty())
t << MMP_OPTION_GCCE " " << gcce << endl;
- if (!cwlink.isEmpty() && !overriddenMmpKeywords.contains(MMP_LINKEROPTION_CW))
+ if (!cwlink.isEmpty())
t << MMP_LINKEROPTION_CW " " << cwlink << endl;
- if (!armlink.isEmpty() && !overriddenMmpKeywords.contains(MMP_LINKEROPTION_ARMCC))
+ if (!armlink.isEmpty())
t << MMP_LINKEROPTION_ARMCC " " << armlink << endl;
- if (!gccelink.isEmpty() && !overriddenMmpKeywords.contains(MMP_LINKEROPTION_GCCE))
+ if (!gccelink.isEmpty())
t << MMP_LINKEROPTION_GCCE " " << gccelink << endl;
- t << endl;
+ t << endl;
}
void SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t)
@@ -1098,7 +1153,7 @@ void SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t)
mmpVersion = "10.0"; // Default binary version for symbian is 10.0
}
- t << "VERSION " << mmpVersion << endl;
+ t << MMP_VERSION " " << mmpVersion << endl;
}
void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t)
@@ -1265,7 +1320,7 @@ void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems)
generatedFiles << ft.fileName();
QTextStream t(&ft);
t << "// ============================================================================" << endl;
- t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: ";
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
t << "// * This file is generated by qmake and should not be modified by the" << endl;
t << "// * user." << endl;
@@ -1274,8 +1329,7 @@ void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems)
t << "#include <" << fixedTarget << ".rsg>" << endl;
t << "#include <appinfo.rh>" << endl;
t << endl;
- //t << "#include <data_caging_paths.hrh>" << "\n" << endl;
- t << "UID2 " << "KUidAppRegistrationResourceFile" << endl;
+ t << "UID2 KUidAppRegistrationResourceFile" << endl;
t << "UID3 " << uid3 << endl << endl;
t << "RESOURCE APP_REGISTRATION_INFO" << endl;
t << "\t{" << endl;
@@ -1300,7 +1354,7 @@ void SymbianMakefileGenerator::writeRssFile(QString &numberOfIcons, QString &ico
generatedFiles << ft.fileName();
QTextStream t(&ft);
t << "// ============================================================================" << endl;
- t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: ";
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
t << "// * This file is generated by qmake and should not be modified by the" << endl;
t << "// * user." << endl;
@@ -1346,7 +1400,7 @@ void SymbianMakefileGenerator::writeLocFile(QStringList &symbianLangCodes)
generatedFiles << ft.fileName();
QTextStream t(&ft);
t << "// ============================================================================" << endl;
- t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: ";
+ t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: ";
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
t << "// * This file is generated by qmake and should not be modified by the" << endl;
t << "// * user." << endl;
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
index 2e78c46..1a20e64 100644
--- a/qmake/generators/symbian/symmake.h
+++ b/qmake/generators/symbian/symmake.h
@@ -96,7 +96,14 @@ protected:
QString generateUID3();
void initMmpVariables();
- void checkOverridability(QStringList &overridableKeywords, QString &checkString);
+ void handleMmpRulesOverrides(QString &checkString,
+ bool &inResourceBlock,
+ QStringList &restrictedMmpKeywords,
+ const QStringList &restrictableMmpKeywords,
+ const QStringList &overridableMmpKeywords);
+ void appendKeywordIfMatchFound(QStringList &list,
+ const QStringList &keywordList,
+ QString &checkString);
void writeHeader(QTextStream &t);
void writeBldInfContent(QTextStream& t, bool addDeploymentExtension, const QString &iconFile);
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index d529f67..bc0d35e 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -373,6 +373,13 @@ QVariantAnimation::~QVariantAnimation()
Another example is QEasingCurve::InOutElastic, which provides an
elastic effect on the values of the interpolated variant.
+ QVariantAnimation will use the QEasingCurve::valueForProgress() to
+ transform the "normalized progress" (currentTime / totalDuration)
+ of the animation into the effective progress actually
+ used by the animation. It is this effective progress that will be
+ the progress when interpolated() is called. Also, the steps in the
+ keyValues are referring to this effective progress.
+
The easing curve is used with the interpolator, the interpolated()
virtual function, the animation's duration, and iterationCount, to
control how the current value changes as the animation progresses.
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h
index f831700..6170272 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -161,7 +161,7 @@ public:
QByteArray fromUnicode(const QString& str);
QByteArray fromUnicode(const QChar *uc, int len);
#ifdef QT3_SUPPORT
- QByteArray fromUnicode(const QString& uc, int& lenInOut);
+ QT3_SUPPORT QByteArray fromUnicode(const QString& uc, int& lenInOut);
#endif
bool hasFailure() const;
private:
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 62b5409..0c94482 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -77,6 +77,7 @@
#include <e32def.h>
#include <e32debug.h>
#include <f32file.h>
+#include <e32math.h>
# include "private/qcore_symbian_p.h"
_LIT(qt_S60Filter, "Series60v?.*.sis");
@@ -2493,7 +2494,7 @@ bool qputenv(const char *varName, const QByteArray& value)
#endif
}
-#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
+#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD)
# if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500)
// older versions of INTEGRITY used a long instead of a uint for the seed.
@@ -2516,8 +2517,6 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
Sets the argument \a seed to be used to generate a new random number sequence of
pseudo random integers to be returned by qrand().
- If no seed value is provided, qrand() is automatically seeded with a value of 1.
-
The sequence of random numbers generated is deterministic per thread. For example,
if two threads call qsrand(1) and subsequently calls qrand(), the threads will get
the same random number sequence.
@@ -2541,8 +2540,9 @@ void qsrand(uint seed)
srand(seed);
}
#else
- // On Windows srand() and rand() already use Thread-Local-Storage
+ // On Windows and Symbian srand() and rand() already use Thread-Local-Storage
// to store the seed between calls
+ // this is also valid for QT_NO_THREAD
srand(seed);
#endif
}
@@ -2558,7 +2558,7 @@ void qsrand(uint seed)
*/
void qsrand()
{
-#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
+#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD)
SeedStorage *seedStorage = randTLS();
if (seedStorage) {
SeedStorageType *pseed = seedStorage->localData();
@@ -2572,24 +2572,28 @@ void qsrand()
*pseed = QDateTime::currentDateTime().toTime_t()
+ quintptr(&pseed)
+ serial.fetchAndAddRelaxed(1);
-#if defined(Q_OS_WIN)
- // for Windows the srand function must still be called.
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ // for Windows and Symbian the srand function must still be called.
srand(*pseed);
#endif
}
-#elif defined(Q_OS_WIN)
+//QT_NO_THREAD implementations
+#else
static unsigned int seed = 0;
if (seed)
return;
+#if defined(Q_OS_SYMBIAN)
+ seed = Math::Random();
+#elif defined(Q_OS_WIN)
seed = GetTickCount();
- srand(seed);
#else
- // Symbian?
-
-#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
+ seed = quintptr(&seed) + QDateTime::currentDateTime().toTime_t();
+#endif
+ srand(seed);
+#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD)
}
/*!
@@ -2626,8 +2630,9 @@ int qrand()
return rand();
}
#else
- // On Windows srand() and rand() already use Thread-Local-Storage
+ // On Windows and Symbian srand() and rand() already use Thread-Local-Storage
// to store the seed between calls
+ // this is also valid for QT_NO_THREAD
return rand();
#endif
}
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 37161bc..c78af3c 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -275,7 +275,7 @@ QProcessEnvironment &QProcessEnvironment::operator=(const QProcessEnvironment &o
*/
bool QProcessEnvironment::operator==(const QProcessEnvironment &other) const
{
- return d->hash == other.d->hash;
+ return d == other.d || (d && other.d && d->hash == other.d->hash);
}
/*!
@@ -334,6 +334,7 @@ bool QProcessEnvironment::contains(const QString &name) const
*/
void QProcessEnvironment::insert(const QString &name, const QString &value)
{
+ // d detaches from null
d->hash.insert(prepareName(name), prepareValue(value));
}
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index 5885591..d0dc7be 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -129,7 +129,7 @@ static inline bool time_update(struct timeval *tv, const struct timeval &start,
// clock source is monotonic, so we can recalculate how much timeout is left
struct timeval now = qt_gettime();
*tv = timeout + start - now;
- return true;
+ return tv->tv_sec >= 0;
}
int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
@@ -154,7 +154,8 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
// recalculate the timeout
if (!time_update(&timeout, start, *orig_timeout)) {
- // clock reset, fake timeout error
+ // timeout during update
+ // or clock reset, fake timeout error
return 0;
}
}
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 115049f..693ed25 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -524,7 +524,11 @@ LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
}
}
}
+#ifdef Q_OS_WINCE
+ return 0;
+#else
return CallNextHookEx(0, code, wp, lp);
+#endif
}
static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher)
@@ -651,11 +655,13 @@ void QEventDispatcherWin32::createInternalHwnd()
return;
d->internalHwnd = qt_create_internal_window(this);
+#ifndef Q_OS_WINCE
// setup GetMessage hook needed to drive our posted events
d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId());
if (!d->getMessageHook) {
qFatal("Qt: INTERNALL ERROR: failed to install GetMessage hook");
}
+#endif
// register all socket notifiers
QList<int> sockets = (d->sn_read.keys().toSet()
@@ -746,6 +752,11 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
}
}
if (haveMessage) {
+#ifdef Q_OS_WINCE
+ // WinCE doesn't support hooks at all, so we have to call this by hand :(
+ (void) qt_GetMessageHook(0, PM_REMOVE, (LPARAM) &msg);
+#endif
+
if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
if (seenWM_QT_SENDPOSTEDEVENTS) {
// when calling processEvents() "manually", we only want to send posted
@@ -1082,9 +1093,11 @@ void QEventDispatcherWin32::closingDown()
d->timerVec.clear();
d->timerDict.clear();
+#ifndef Q_OS_WINCE
if (d->getMessageHook)
UnhookWindowsHookEx(d->getMessageHook);
d->getMessageHook = 0;
+#endif
}
bool QEventDispatcherWin32::event(QEvent *e)
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 91bf4ae..c8b11d6 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -145,7 +145,7 @@ QObjectPrivate::QObjectPrivate(int version)
receiveChildEvents = true;
postedEvents = 0;
extraData = 0;
- connectedSignals = 0;
+ connectedSignals[0] = connectedSignals[1] = 0;
inEventHandler = false;
inThreadChangeEvent = false;
deleteWatch = 0;
@@ -153,15 +153,6 @@ QObjectPrivate::QObjectPrivate(int version)
hasGuards = false;
}
-#ifdef Q_CC_INTEL
-/* Workaround for a bug in win32-icc where it seems to inline ~QObjectPrivate too aggressive.
- When icc compiles QtGui, it inlines ~QObjectPrivate so that it would generate a call to
- ~QObjectData. However, ~QObjectData is not exported from QtCore, so it does not link.
- See also QTBUG-5145 for info on how this manifested itself.
- */
-# pragma auto_inline(off)
-#endif
-
QObjectPrivate::~QObjectPrivate()
{
delete static_cast<QAbstractDynamicMetaObject*>(metaObject);
@@ -173,9 +164,6 @@ QObjectPrivate::~QObjectPrivate()
delete extraData;
#endif
}
-#ifdef Q_CC_INTEL
-# pragma auto_inline(on)
-#endif
int *QObjectPrivate::setDeleteWatch(QObjectPrivate *d, int *w) {
@@ -2950,9 +2938,9 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
QObjectPrivate *const sender_d = QObjectPrivate::get(s);
if (signal_index < 0) {
- sender_d->connectedSignals = ~ulong(0);
+ sender_d->connectedSignals[0] = sender_d->connectedSignals[1] = ~0;
} else if (signal_index < (int)sizeof(sender_d->connectedSignals) * 8) {
- sender_d->connectedSignals |= ulong(1) << signal_index;
+ sender_d->connectedSignals[signal_index >> 5] |= (1 << (signal_index & 0x1f));
}
return true;
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 340498f..1a178e2 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -91,7 +91,11 @@ template<typename T> inline QList<T> qFindChildren(const QObject *, const QRegEx
# endif
#endif
-class QObjectData {
+class
+#if defined(__INTEL_COMPILER) && defined(Q_OS_WIN)
+Q_CORE_EXPORT
+#endif
+QObjectData {
public:
virtual ~QObjectData() = 0;
QObject *q_ptr;
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index a92ae3b..bcd67a1 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -172,7 +172,7 @@ public:
}
int signalIndex(const char *signalName) const;
- inline bool isSignalConnected(int signalIdx) const;
+ inline bool isSignalConnected(uint signalIdx) const;
public:
QString objectName;
@@ -183,7 +183,7 @@ public:
Connection *senders; // linked list of connections connected to this object
Sender *currentSender; // object currently activating the object
- mutable ulong connectedSignals;
+ mutable quint32 connectedSignals[2];
#ifdef QT3_SUPPORT
QList<QObject *> pendingChildInsertedEvents;
@@ -205,6 +205,7 @@ public:
int *deleteWatch;
};
+
/*! \internal
Returns true if the signal with index \a signal_index from object \a sender is connected.
@@ -213,12 +214,12 @@ public:
\a signal_index must be the index returned by QObjectPrivate::signalIndex;
*/
-inline bool QObjectPrivate::isSignalConnected(int signal_index) const
+inline bool QObjectPrivate::isSignalConnected(uint signal_index) const
{
- return signal_index >= (int)sizeof(connectedSignals) * 8
+ return signal_index >= sizeof(connectedSignals) * 8
|| qt_signal_spy_callback_set.signal_begin_callback
|| qt_signal_spy_callback_set.signal_end_callback
- || (connectedSignals & (ulong(1) << signal_index));
+ || (connectedSignals[signal_index >> 5] & (1 << (signal_index & 0x1f)));
}
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 3c10788..74ff17f 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -458,7 +458,7 @@ inline void qVariantSetValue(QVariant &v, const T &t)
//if possible we reuse the current QVariant private
const uint type = qMetaTypeId<T>(reinterpret_cast<T *>(0));
QVariant::Private &d = v.data_ptr();
- if (v.isDetached() && (type <= uint(QVariant::Char) || type == d.type)) {
+ if (v.isDetached() && (type == d.type || (type <= uint(QVariant::Char) && d.type <= uint(QVariant::Char)))) {
d.type = type;
d.is_null = false;
T *old = reinterpret_cast<T*>(d.is_shared ? d.data.shared->ptr : &d.data.ptr);
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index 46e20b1..66f9f73 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -70,8 +70,9 @@ class QCache
if (l == &n) l = n.p;
if (f == &n) f = n.n;
total -= n.c;
- delete n.t;
+ T *obj = n.t;
hash.remove(*n.keyPtr);
+ delete obj;
}
inline T *relink(const Key &key) {
typename QHash<Key, Node>::iterator i = hash.find(key);
diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h
index 2bad40e..8a46b98 100644
--- a/src/corelib/tools/qregexp.h
+++ b/src/corelib/tools/qregexp.h
@@ -119,7 +119,9 @@ public:
#endif
int matchedLength() const;
#ifndef QT_NO_REGEXP_CAPTURE
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numCaptures() const;
+#endif
int captureCount() const;
QStringList capturedTexts() const;
QStringList capturedTexts();
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp
index cd3483d..ce49e3f 100644
--- a/src/corelib/tools/qtimeline.cpp
+++ b/src/corelib/tools/qtimeline.cpp
@@ -125,7 +125,7 @@ void QTimeLinePrivate::setCurrentTime(int msecs)
#ifdef QTIMELINE_DEBUG
qDebug() << "QTimeLinePrivate::setCurrentTime: frameForTime" << currentTime << currentFrame;
#endif
- if (lastValue != q->currentValue())
+ if (!qFuzzyCompare(lastValue, q->currentValue()))
emit q->valueChanged(q->currentValue());
if (lastFrame != currentFrame) {
const int transitionframe = (direction == QTimeLine::Forward ? endFrame : startFrame);
diff --git a/src/dbus/qdbusargument_p.h b/src/dbus/qdbusargument_p.h
index 47c5e62..17302b4 100644
--- a/src/dbus/qdbusargument_p.h
+++ b/src/dbus/qdbusargument_p.h
@@ -54,7 +54,7 @@
//
#include <qdbusargument.h>
-#include <qdbus_symbols_p.h>
+#include "qdbus_symbols_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index b65e101..d6f7598 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -67,7 +67,7 @@
#include <QtCore/qvarlengtharray.h>
#include <QtCore/qvector.h>
-#include <qdbus_symbols_p.h>
+#include "qdbus_symbols_p.h"
#include <qdbusmessage.h>
diff --git a/src/dbus/qdbusconnectioninterface.cpp b/src/dbus/qdbusconnectioninterface.cpp
index 0f9a67f..ec61859 100644
--- a/src/dbus/qdbusconnectioninterface.cpp
+++ b/src/dbus/qdbusconnectioninterface.cpp
@@ -49,7 +49,7 @@
#include <QtCore/QVariant>
#include <QtCore/QDebug>
-#include <qdbus_symbols_p.h> // for the DBUS_* constants
+#include "qdbus_symbols_p.h" // for the DBUS_* constants
QT_BEGIN_NAMESPACE
diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp
index 5c2fa2b..a48b878 100644
--- a/src/dbus/qdbuserror.cpp
+++ b/src/dbus/qdbuserror.cpp
@@ -44,7 +44,7 @@
#include <qdebug.h>
#include <qvarlengtharray.h>
-#include <qdbus_symbols_p.h>
+#include "qdbus_symbols_p.h"
#include "qdbusmessage.h"
#include "qdbusmessage_p.h"
diff --git a/src/dbus/qdbusintegrator_p.h b/src/dbus/qdbusintegrator_p.h
index 5b18aca..85c6cb2 100644
--- a/src/dbus/qdbusintegrator_p.h
+++ b/src/dbus/qdbusintegrator_p.h
@@ -54,7 +54,7 @@
#ifndef QDBUSINTEGRATOR_P_H
#define QDBUSINTEGRATOR_P_H
-#include <qdbus_symbols_p.h>
+#include "qdbus_symbols_p.h"
#include "qcoreevent.h"
#include "qeventloop.h"
diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp
index d0a693f..c05e6a9 100644
--- a/src/dbus/qdbusinterface.cpp
+++ b/src/dbus/qdbusinterface.cpp
@@ -41,7 +41,7 @@
#include "qdbusinterface.h"
-#include <qdbus_symbols_p.h>
+#include "qdbus_symbols_p.h"
#include <QtCore/qpointer.h>
#include <QtCore/qstringlist.h>
diff --git a/src/dbus/qdbusinterface_p.h b/src/dbus/qdbusinterface_p.h
index 3d11af1..a601608 100644
--- a/src/dbus/qdbusinterface_p.h
+++ b/src/dbus/qdbusinterface_p.h
@@ -54,8 +54,8 @@
#ifndef QDBUSINTERFACEPRIVATE_H
#define QDBUSINTERFACEPRIVATE_H
-#include <qdbusabstractinterface_p.h>
-#include <qdbusmetaobject_p.h>
+#include "qdbusabstractinterface_p.h"
+#include "qdbusmetaobject_p.h"
#include <qdbusinterface.h>
QT_BEGIN_NAMESPACE
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index acd04d3..37110c5 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -41,7 +41,7 @@
#include "qdbusconnection_p.h"
-#include <qdbus_symbols_p.h>
+#include "qdbus_symbols_p.h"
#include <QtCore/qcoreapplication.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qstringlist.h>
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 4f1950b..a37ba1f 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -44,7 +44,7 @@
#include <qdebug.h>
#include <qstringlist.h>
-#include <qdbus_symbols_p.h>
+#include "qdbus_symbols_p.h"
#include "qdbusargument_p.h"
#include "qdbuserror.h"
diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp
index 237aea3..afa3bbf 100644
--- a/src/dbus/qdbusmetatype.cpp
+++ b/src/dbus/qdbusmetatype.cpp
@@ -42,7 +42,7 @@
#include "qdbusmetatype.h"
#include <string.h>
-#include <qdbus_symbols_p.h>
+#include "qdbus_symbols_p.h"
#include <qbytearray.h>
#include <qglobal.h>
diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp
index bf5a739..01b1dbd 100644
--- a/src/dbus/qdbusutil.cpp
+++ b/src/dbus/qdbusutil.cpp
@@ -41,7 +41,7 @@
#include "qdbusutil_p.h"
-#include <qdbus_symbols_p.h>
+#include "qdbus_symbols_p.h"
#include <QtCore/qstringlist.h>
diff --git a/src/dbus/qdbusxmlparser_p.h b/src/dbus/qdbusxmlparser_p.h
index 3dbae1b..1a0523b 100644
--- a/src/dbus/qdbusxmlparser_p.h
+++ b/src/dbus/qdbusxmlparser_p.h
@@ -56,7 +56,7 @@
#include <QtCore/qmap.h>
#include <QtXml/qdom.h>
#include <qdbusmacros.h>
-#include <qdbusintrospection_p.h>
+#include "qdbusintrospection_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri
index 65ffccf..4e1b9a7 100644
--- a/src/gui/dialogs/dialogs.pri
+++ b/src/gui/dialogs/dialogs.pri
@@ -28,13 +28,27 @@ HEADERS += \
dialogs/qprintpreviewdialog.h
!embedded:mac {
- OBJECTIVE_SOURCES += dialogs/qcolordialog_mac.mm \
- dialogs/qfiledialog_mac.mm \
+ OBJECTIVE_SOURCES += dialogs/qfiledialog_mac.mm \
dialogs/qfontdialog_mac.mm \
dialogs/qnspanelproxy_mac.mm \
dialogs/qpagesetupdialog_mac.mm \
dialogs/qprintdialog_mac.mm
+
+# Compile qcolordialog_mac.mm with exception support, disregarding the -no-exceptions
+# configure option. (qcolordialog_mac needs to catch exceptions thrown by cocoa)
+ EXCEPTION_SOURCES = dialogs/qcolordialog_mac.mm
+ exceptions_compiler.commands = $$QMAKE_CXX -c
+ exceptions_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
+ exceptions_compiler.commands += -fexceptions
+ exceptions_compiler.dependency_type = TYPE_C
+ exceptions_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
+ exceptions_compiler.input = EXCEPTION_SOURCES
+ exceptions_compiler.variable_out = OBJECTS
+ exceptions_compiler.name = compiling[exceptopns] ${QMAKE_FILE_IN}
+ silent:exceptions_compiler.commands = @echo compiling[exceptopns] ${QMAKE_FILE_IN} && $$exceptions_compiler.commands
+ QMAKE_EXTRA_COMPILERS += exceptions_compiler
}
+
win32 {
HEADERS += dialogs/qwizard_win_p.h \
dialogs/qfiledialog_win_p.h
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 239e29c..d6cabaa 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -160,6 +160,10 @@ QRectF QGraphicsEffectSource::boundingRect(Qt::CoordinateSystem system) const
/*!
Returns the bounding rectangle of the source mapped to the given \a system.
+ Calling this function with Qt::DeviceCoordinates outside of
+ QGraphicsEffect::draw() will give undefined results, as there is no device
+ context available.
+
\sa draw()
*/
QRectF QGraphicsEffect::sourceBoundingRect(Qt::CoordinateSystem system) const
@@ -348,6 +352,10 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse
The returned pixmap is clipped to the current painter's device rectangle when
\a system is Qt::DeviceCoordinates.
+ Calling this function with Qt::DeviceCoordinates outside of
+ QGraphicsEffect::draw() will give undefined results, as there is no device
+ context available.
+
\sa draw(), boundingRect()
*/
QPixmap QGraphicsEffect::sourcePixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const
@@ -398,8 +406,8 @@ QGraphicsEffect::~QGraphicsEffect()
/*!
Returns the effective bounding rectangle for this effect, i.e., the
- bounding rectangle of the source, adjusted by any margins applied by
- the effect itself.
+ bounding rectangle of the source in device coordinates, adjusted by
+ any margins applied by the effect itself.
\sa boundingRectFor(), updateBoundingRect()
*/
@@ -413,7 +421,7 @@ QRectF QGraphicsEffect::boundingRect() const
/*!
Returns the effective bounding rectangle for this effect, given the
- provided \a rect in the source's coordinate space. When writing
+ provided \a rect in the device coordinates. When writing
you own custom effect, you must call updateBoundingRect() whenever any
parameters are changed that may cause this this function to return a
different value.
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index 2d37edb..4d4410a 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -229,6 +229,15 @@ void QEglProperties::setRenderableType(QEgl::API api)
// reductions in complexity are possible.
bool QEglProperties::reduceConfiguration()
{
+ // EGL chooses configs with the highest color depth over
+ // those with smaller (but faster) lower color depths. One
+ // way around this is to set EGL_BUFFER_SIZE to 16, which
+ // trumps the others. Of course, there may not be a 16-bit
+ // config avaliable, so it's the first restraint we remove.
+ if (value(EGL_BUFFER_SIZE) == 16) {
+ removeValue(EGL_BUFFER_SIZE);
+ return true;
+ }
if (removeValue(EGL_SAMPLE_BUFFERS)) {
removeValue(EGL_SAMPLES);
return true;
diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h
index b3246f9..7ab49fb 100644
--- a/src/gui/embedded/qscreen_qws.h
+++ b/src/gui/embedded/qscreen_qws.h
@@ -243,7 +243,9 @@ public:
int totalSize() const { return mapsize; }
QRgb * clut() { return screenclut; }
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numCols() { return screencols; }
+#endif
int colorCount() { return screencols; }
virtual QSize mapToDevice(const QSize &) const;
diff --git a/src/gui/graphicsview/qgraph_p.h b/src/gui/graphicsview/qgraph_p.h
index 0a2bf27..076b8fa 100644
--- a/src/gui/graphicsview/qgraph_p.h
+++ b/src/gui/graphicsview/qgraph_p.h
@@ -236,11 +236,13 @@ public:
EdgeData *data = edgeData(v, v1);
bool forward = data->from == v;
if (forward) {
- edges += QString::fromAscii("\"%1\"->\"%2\" [label=\"[%3,%4,%5]\" dir=both color=\"#000000:#a0a0a0\"] \n")
+ edges += QString::fromAscii("\"%1\"->\"%2\" [label=\"[%3,%4,%5,%6,%7]\" color=\"#000000\"] \n")
.arg(v->toString())
.arg(v1->toString())
.arg(data->minSize)
+ .arg(data->minPrefSize)
.arg(data->prefSize)
+ .arg(data->maxPrefSize)
.arg(data->maxSize)
;
}
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index 6718a28..f504c54 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -321,14 +321,14 @@ void QGraphicsAnchorLayout::addCornerAnchors(QGraphicsLayoutItem *firstItem,
// Horizontal anchor
Qt::AnchorPoint firstEdge = (firstCorner & 1 ? Qt::AnchorRight: Qt::AnchorLeft);
Qt::AnchorPoint secondEdge = (secondCorner & 1 ? Qt::AnchorRight: Qt::AnchorLeft);
- d->addAnchor(firstItem, firstEdge, secondItem, secondEdge);
+ if (d->addAnchor(firstItem, firstEdge, secondItem, secondEdge)) {
+ // Vertical anchor
+ firstEdge = (firstCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop);
+ secondEdge = (secondCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop);
+ d->addAnchor(firstItem, firstEdge, secondItem, secondEdge);
- // Vertical anchor
- firstEdge = (firstCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop);
- secondEdge = (secondCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop);
- d->addAnchor(firstItem, firstEdge, secondItem, secondEdge);
-
- invalidate();
+ invalidate();
+ }
}
/*!
@@ -351,11 +351,14 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem,
QGraphicsLayoutItem *secondItem,
Qt::Orientations orientations)
{
+ bool ok = true;
if (orientations & Qt::Horizontal) {
- addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft);
- addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight);
+ // Currently, if the first is ok, then the rest of the calls should be ok
+ ok = addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft) != 0;
+ if (ok)
+ addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight);
}
- if (orientations & Qt::Vertical) {
+ if (orientations & Qt::Vertical && ok) {
addAnchor(secondItem, Qt::AnchorTop, firstItem, Qt::AnchorTop);
addAnchor(firstItem, Qt::AnchorBottom, secondItem, Qt::AnchorBottom);
}
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index a6f5992..1dc6873 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -49,20 +49,34 @@
#endif
#include "qgraphicsanchorlayout_p.h"
+
#ifndef QT_NO_GRAPHICSVIEW
QT_BEGIN_NAMESPACE
+// To ensure that all variables inside the simplex solver are non-negative,
+// we limit the size of anchors in the interval [-limit, limit]. Then before
+// sending them to the simplex solver we add "limit" as an offset, so that
+// they are actually calculated in the interval [0, 2 * limit]
+// To avoid numerical errors in platforms where we use single precision,
+// we use a tighter limit for the variables range.
+const qreal g_offset = (sizeof(qreal) == sizeof(double)) ? QWIDGETSIZE_MAX : QWIDGETSIZE_MAX / 32;
QGraphicsAnchorPrivate::QGraphicsAnchorPrivate(int version)
: QObjectPrivate(version), layoutPrivate(0), data(0),
sizePolicy(QSizePolicy::Fixed), preferredSize(0),
- hasSize(true), reversed(false)
+ hasSize(true)
{
}
QGraphicsAnchorPrivate::~QGraphicsAnchorPrivate()
{
- layoutPrivate->removeAnchor(data->from, data->to);
+ if (data) {
+ // The QGraphicsAnchor was already deleted at this moment. We must clean
+ // the dangling pointer to avoid double deletion in the AnchorData dtor.
+ data->graphicsAnchor = 0;
+
+ layoutPrivate->removeAnchor(data->from, data->to);
+ }
}
void QGraphicsAnchorPrivate::setSizePolicy(QSizePolicy::Policy policy)
@@ -80,27 +94,12 @@ void QGraphicsAnchorPrivate::setSpacing(qreal value)
return;
}
- const qreal rawValue = reversed ? -preferredSize : preferredSize;
- if (hasSize && (rawValue == value))
+ if (hasSize && (preferredSize == value))
return;
// The anchor has an user-defined size
hasSize = true;
-
- // The simplex solver cannot handle negative sizes. To workaround that,
- // if value is less than zero, we reverse the anchor and set the absolute
- // value;
- if (value >= 0) {
- preferredSize = value;
- if (reversed)
- qSwap(data->from, data->to);
- reversed = false;
- } else {
- preferredSize = -value;
- if (!reversed)
- qSwap(data->from, data->to);
- reversed = true;
- }
+ preferredSize = value;
layoutPrivate->q_func()->invalidate();
}
@@ -114,9 +113,6 @@ void QGraphicsAnchorPrivate::unsetSpacing()
// Return to standard direction
hasSize = false;
- if (reversed)
- qSwap(data->from, data->to);
- reversed = false;
layoutPrivate->q_func()->invalidate();
}
@@ -128,14 +124,14 @@ qreal QGraphicsAnchorPrivate::spacing() const
return 0;
}
- return reversed ? -preferredSize : preferredSize;
+ return preferredSize;
}
-static void internalSizeHints(QSizePolicy::Policy policy,
- qreal minSizeHint, qreal prefSizeHint, qreal maxSizeHint,
- qreal *minSize, qreal *prefSize,
- qreal *maxSize)
+static void applySizePolicy(QSizePolicy::Policy policy,
+ qreal minSizeHint, qreal prefSizeHint, qreal maxSizeHint,
+ qreal *minSize, qreal *prefSize,
+ qreal *maxSize)
{
// minSize, prefSize and maxSize are initialized
// with item's preferred Size: this is QSizePolicy::Fixed.
@@ -167,6 +163,18 @@ static void internalSizeHints(QSizePolicy::Policy policy,
*prefSize = prefSizeHint;
}
+AnchorData::~AnchorData()
+{
+ if (graphicsAnchor) {
+ // Remove reference to ourself to avoid double removal in
+ // QGraphicsAnchorPrivate dtor.
+ graphicsAnchor->d_func()->data = 0;
+
+ delete graphicsAnchor;
+ }
+}
+
+
void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
{
QSizePolicy::Policy policy;
@@ -182,6 +190,9 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
maxSize = QWIDGETSIZE_MAX;
if (isCenterAnchor)
maxSize /= 2;
+
+ minPrefSize = prefSize;
+ maxPrefSize = maxSize;
return;
} else {
if (orientation == QGraphicsAnchorLayoutPrivate::Horizontal) {
@@ -206,14 +217,18 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
// It is a user-created anchor, fetch size information from the associated QGraphicsAnchor
Q_ASSERT(graphicsAnchor);
QGraphicsAnchorPrivate *anchorPrivate = graphicsAnchor->d_func();
+
+ // Policy, min and max sizes are straightforward
policy = anchorPrivate->sizePolicy;
minSizeHint = 0;
+ maxSizeHint = QWIDGETSIZE_MAX;
+
+ // Preferred Size
if (anchorPrivate->hasSize) {
- // One can only configure the preferred size of a normal anchor. Their minimum and
- // maximum "size hints" are always 0 and QWIDGETSIZE_MAX, correspondingly. However,
- // their effective size hints might be narrowed down due to their size policies.
+ // Anchor has user-defined size
prefSizeHint = anchorPrivate->preferredSize;
} else {
+ // Fetch size information from style
const Qt::Orientation orient = Qt::Orientation(QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge) + 1);
qreal s = styleInfo->defaultSpacing(orient);
if (s < 0) {
@@ -229,10 +244,14 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
}
prefSizeHint = s;
}
- maxSizeHint = QWIDGETSIZE_MAX;
}
- internalSizeHints(policy, minSizeHint, prefSizeHint, maxSizeHint,
- &minSize, &prefSize, &maxSize);
+
+ // Fill minSize, prefSize and maxSize based on policy and sizeHints
+ applySizePolicy(policy, minSizeHint, prefSizeHint, maxSizeHint,
+ &minSize, &prefSize, &maxSize);
+
+ minPrefSize = prefSize;
+ maxPrefSize = maxSize;
// Set the anchor effective sizes to preferred.
//
@@ -252,13 +271,7 @@ void ParallelAnchorData::updateChildrenSizes()
firstEdge->sizeAtPreferred = sizeAtPreferred;
firstEdge->sizeAtMaximum = sizeAtMaximum;
- // We have the convention that the first children will define the direction of the
- // pararell group. So we can check whether the second edge is "forward" in relation
- // to the group if it have the same direction as the first edge. Note that we don't
- // use 'this->from' because it might be changed by vertex simplification.
- const bool secondForward = (firstEdge->from == secondEdge->from);
-
- if (secondForward) {
+ if (secondForward()) {
secondEdge->sizeAtMinimum = sizeAtMinimum;
secondEdge->sizeAtPreferred = sizeAtPreferred;
secondEdge->sizeAtMaximum = sizeAtMaximum;
@@ -272,21 +285,40 @@ void ParallelAnchorData::updateChildrenSizes()
secondEdge->updateChildrenSizes();
}
-bool ParallelAnchorData::calculateSizeHints()
-{
- // Note that parallel groups can lead to unfeasibility, so during calculation, we can
- // find out one unfeasibility. Because of that this method return boolean. This can't
- // happen in sequential, so there the method is void.
+/*
+ \internal
- // Account for parallel anchors where the second edge is backwards.
- // We rely on the fact that a forward anchor of sizes min, pref, max is equivalent
- // to a backwards anchor of size (-max, -pref, -min)
+ Initialize the parallel anchor size hints using the sizeHint information from
+ its children.
- // Also see comments in updateChildrenSizes().
- const bool secondForward = (firstEdge->from == secondEdge->from);
- const qreal secondMin = secondForward ? secondEdge->minSize : -secondEdge->maxSize;
- const qreal secondPref = secondForward ? secondEdge->prefSize : -secondEdge->prefSize;
- const qreal secondMax = secondForward ? secondEdge->maxSize : -secondEdge->minSize;
+ Note that parallel groups can lead to unfeasibility, so during calculation, we can
+ find out one unfeasibility. Because of that this method return boolean. This can't
+ happen in sequential, so there the method is void.
+ */
+bool ParallelAnchorData::calculateSizeHints()
+{
+ // Normalize second child sizes.
+ // A negative anchor of sizes min, minPref, pref, maxPref and max, is equivalent
+ // to a forward anchor of sizes -max, -maxPref, -pref, -minPref, -min
+ qreal secondMin;
+ qreal secondMinPref;
+ qreal secondPref;
+ qreal secondMaxPref;
+ qreal secondMax;
+
+ if (secondForward()) {
+ secondMin = secondEdge->minSize;
+ secondMinPref = secondEdge->minPrefSize;
+ secondPref = secondEdge->prefSize;
+ secondMaxPref = secondEdge->maxPrefSize;
+ secondMax = secondEdge->maxSize;
+ } else {
+ secondMin = -secondEdge->maxSize;
+ secondMinPref = -secondEdge->maxPrefSize;
+ secondPref = -secondEdge->prefSize;
+ secondMaxPref = -secondEdge->minPrefSize;
+ secondMax = -secondEdge->minSize;
+ }
minSize = qMax(firstEdge->minSize, secondMin);
maxSize = qMin(firstEdge->maxSize, secondMax);
@@ -298,23 +330,72 @@ bool ParallelAnchorData::calculateSizeHints()
return false;
}
- // The equivalent preferred Size of a parallel anchor is calculated as to
- // reduce the deviation from the original preferred sizes _and_ to avoid shrinking
- // items below their preferred sizes, unless strictly needed.
-
- // ### This logic only holds if all anchors in the layout are "well-behaved" in the
- // following terms:
+ // Preferred size calculation
+ // The calculation of preferred size is done as follows:
+ //
+ // 1) Check whether one of the child anchors is the layout structural anchor
+ // If so, we can simply copy the preferred information from the other child,
+ // after bounding it to our minimum and maximum sizes.
+ // If not, then we proceed with the actual calculations.
+ //
+ // 2) The whole algorithm for preferred size calculation is based on the fact
+ // that, if a given anchor cannot remain at its preferred size, it'd rather
+ // grow than shrink.
//
- // - There are no negative-sized anchors
- // - All sequential anchors are composed of children in the same direction as the
- // sequential anchor itself
+ // What happens though is that while this affirmative is true for simple
+ // anchors, it may not be true for sequential anchors that have one or more
+ // reversed anchors inside it. That happens because when a sequential anchor
+ // grows, any reversed anchors inside it may be required to shrink, something
+ // we try to avoid, as said above.
//
- // With these assumptions we can grow a child knowing that no hidden items will
- // have to shrink as the result of that.
- // If any of these does not hold, we have a situation where the ParallelAnchor
- // does not have enough information to calculate its equivalent prefSize.
- prefSize = qMax(firstEdge->prefSize, secondPref);
- prefSize = qMin(prefSize, maxSize);
+ // To overcome this, besides their actual preferred size "prefSize", each anchor
+ // exports what we call "minPrefSize" and "maxPrefSize". These two values define
+ // a surrounding interval where, if required to move, the anchor would rather
+ // remain inside.
+ //
+ // For standard anchors, this area simply represents the region between
+ // prefSize and maxSize, which makes sense since our first affirmation.
+ // For composed anchors, these values are calculated as to reduce the global
+ // "damage", that is, to reduce the total deviation and the total amount of
+ // anchors that had to shrink.
+
+ if (firstEdge->isLayoutAnchor) {
+ prefSize = qBound(minSize, secondPref, maxSize);
+ minPrefSize = qBound(minSize, secondMinPref, maxSize);
+ maxPrefSize = qBound(minSize, secondMaxPref, maxSize);
+ } else if (secondEdge->isLayoutAnchor) {
+ prefSize = qBound(minSize, firstEdge->prefSize, maxSize);
+ minPrefSize = qBound(minSize, firstEdge->minPrefSize, maxSize);
+ maxPrefSize = qBound(minSize, firstEdge->maxPrefSize, maxSize);
+ } else {
+ // Calculate the intersection between the "preferred" regions of each child
+ const qreal lowerBoundary =
+ qBound(minSize, qMax(firstEdge->minPrefSize, secondMinPref), maxSize);
+ const qreal upperBoundary =
+ qBound(minSize, qMin(firstEdge->maxPrefSize, secondMaxPref), maxSize);
+ const qreal prefMean =
+ qBound(minSize, (firstEdge->prefSize + secondPref) / 2, maxSize);
+
+ if (lowerBoundary < upperBoundary) {
+ // If there is an intersection between the two regions, this intersection
+ // will be used as the preferred region of the parallel anchor itself.
+ // The preferred size will be the bounded average between the two preferred
+ // sizes.
+ prefSize = qBound(lowerBoundary, prefMean, upperBoundary);
+ minPrefSize = lowerBoundary;
+ maxPrefSize = upperBoundary;
+ } else {
+ // If there is no intersection, we have to attribute "damage" to at least
+ // one of the children. The minimum total damage is achieved in points
+ // inside the region that extends from (1) the upper boundary of the lower
+ // region to (2) the lower boundary of the upper region.
+ // Then, we expose this region as _our_ preferred region and once again,
+ // use the bounded average as our preferred size.
+ prefSize = qBound(upperBoundary, prefMean, lowerBoundary);
+ minPrefSize = upperBoundary;
+ maxPrefSize = lowerBoundary;
+ }
+ }
// See comment in AnchorData::refreshSizeHints() about sizeAt* values
sizeAtMinimum = prefSize;
@@ -332,19 +413,28 @@ bool ParallelAnchorData::calculateSizeHints()
1 is at Maximum
*/
static QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> getFactor(qreal value, qreal min,
- qreal pref, qreal max)
+ qreal minPref, qreal pref,
+ qreal maxPref, qreal max)
{
QGraphicsAnchorLayoutPrivate::Interval interval;
qreal lower;
qreal upper;
- if (value < pref) {
- interval = QGraphicsAnchorLayoutPrivate::MinToPreferred;
+ if (value < minPref) {
+ interval = QGraphicsAnchorLayoutPrivate::MinimumToMinPreferred;
lower = min;
+ upper = minPref;
+ } else if (value < pref) {
+ interval = QGraphicsAnchorLayoutPrivate::MinPreferredToPreferred;
+ lower = minPref;
upper = pref;
- } else {
- interval = QGraphicsAnchorLayoutPrivate::PreferredToMax;
+ } else if (value < maxPref) {
+ interval = QGraphicsAnchorLayoutPrivate::PreferredToMaxPreferred;
lower = pref;
+ upper = maxPref;
+ } else {
+ interval = QGraphicsAnchorLayoutPrivate::MaxPreferredToMaximum;
+ lower = maxPref;
upper = max;
}
@@ -359,19 +449,26 @@ static QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> getFactor(qreal valu
}
static qreal interpolate(const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> &factor,
- qreal min, qreal pref,
- qreal max)
+ qreal min, qreal minPref, qreal pref, qreal maxPref, qreal max)
{
qreal lower;
qreal upper;
switch (factor.first) {
- case QGraphicsAnchorLayoutPrivate::MinToPreferred:
+ case QGraphicsAnchorLayoutPrivate::MinimumToMinPreferred:
lower = min;
+ upper = minPref;
+ break;
+ case QGraphicsAnchorLayoutPrivate::MinPreferredToPreferred:
+ lower = minPref;
upper = pref;
break;
- case QGraphicsAnchorLayoutPrivate::PreferredToMax:
+ case QGraphicsAnchorLayoutPrivate::PreferredToMaxPreferred:
lower = pref;
+ upper = maxPref;
+ break;
+ case QGraphicsAnchorLayoutPrivate::MaxPreferredToMaximum:
+ lower = maxPref;
upper = max;
break;
}
@@ -381,34 +478,43 @@ static qreal interpolate(const QPair<QGraphicsAnchorLayoutPrivate::Interval, qre
void SequentialAnchorData::updateChildrenSizes()
{
- // ### REMOVE ME
- // ### check whether we are guarantee to get those or we need to warn stuff at this
- // point.
- Q_ASSERT(sizeAtMinimum > minSize || qAbs(sizeAtMinimum - minSize) < 0.00000001);
- Q_ASSERT(sizeAtPreferred > minSize || qAbs(sizeAtPreferred - minSize) < 0.00000001);
- Q_ASSERT(sizeAtMaximum > minSize || qAbs(sizeAtMaximum - minSize) < 0.00000001);
-
- // These may be false if this anchor was in parallel with the layout stucture
- // Q_ASSERT(sizeAtMinimum < maxSize || qAbs(sizeAtMinimum - maxSize) < 0.00000001);
- // Q_ASSERT(sizeAtPreferred < maxSize || qAbs(sizeAtPreferred - maxSize) < 0.00000001);
- // Q_ASSERT(sizeAtMaximum < maxSize || qAbs(sizeAtMaximum - maxSize) < 0.00000001);
-
// Band here refers if the value is in the Minimum To Preferred
// band (the lower band) or the Preferred To Maximum (the upper band).
const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> minFactor =
- getFactor(sizeAtMinimum, minSize, prefSize, maxSize);
+ getFactor(sizeAtMinimum, minSize, minPrefSize, prefSize, maxPrefSize, maxSize);
const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> prefFactor =
- getFactor(sizeAtPreferred, minSize, prefSize, maxSize);
+ getFactor(sizeAtPreferred, minSize, minPrefSize, prefSize, maxPrefSize, maxSize);
const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> maxFactor =
- getFactor(sizeAtMaximum, minSize, prefSize, maxSize);
+ getFactor(sizeAtMaximum, minSize, minPrefSize, prefSize, maxPrefSize, maxSize);
+
+ // XXX This is not safe if Vertex simplification takes place after the sequential
+ // anchor is created. In that case, "prev" will be a group-vertex, different from
+ // "from" or "to", that _contains_ one of them.
+ AnchorVertex *prev = from;
for (int i = 0; i < m_edges.count(); ++i) {
AnchorData *e = m_edges.at(i);
- e->sizeAtMinimum = interpolate(minFactor, e->minSize, e->prefSize, e->maxSize);
- e->sizeAtPreferred = interpolate(prefFactor, e->minSize, e->prefSize, e->maxSize);
- e->sizeAtMaximum = interpolate(maxFactor, e->minSize, e->prefSize, e->maxSize);
+ const bool edgeIsForward = (e->from == prev);
+ if (edgeIsForward) {
+ e->sizeAtMinimum = interpolate(minFactor, e->minSize, e->minPrefSize,
+ e->prefSize, e->maxPrefSize, e->maxSize);
+ e->sizeAtPreferred = interpolate(prefFactor, e->minSize, e->minPrefSize,
+ e->prefSize, e->maxPrefSize, e->maxSize);
+ e->sizeAtMaximum = interpolate(maxFactor, e->minSize, e->minPrefSize,
+ e->prefSize, e->maxPrefSize, e->maxSize);
+ prev = e->to;
+ } else {
+ Q_ASSERT(prev == e->to);
+ e->sizeAtMinimum = interpolate(minFactor, e->maxSize, e->maxPrefSize,
+ e->prefSize, e->minPrefSize, e->minSize);
+ e->sizeAtPreferred = interpolate(prefFactor, e->maxSize, e->maxPrefSize,
+ e->prefSize, e->minPrefSize, e->minSize);
+ e->sizeAtMaximum = interpolate(maxFactor, e->maxSize, e->maxPrefSize,
+ e->prefSize, e->minPrefSize, e->minSize);
+ prev = e->from;
+ }
e->updateChildrenSizes();
}
@@ -419,12 +525,31 @@ void SequentialAnchorData::calculateSizeHints()
minSize = 0;
prefSize = 0;
maxSize = 0;
+ minPrefSize = 0;
+ maxPrefSize = 0;
+
+ AnchorVertex *prev = from;
for (int i = 0; i < m_edges.count(); ++i) {
AnchorData *edge = m_edges.at(i);
- minSize += edge->minSize;
- prefSize += edge->prefSize;
- maxSize += edge->maxSize;
+
+ const bool edgeIsForward = (edge->from == prev);
+ if (edgeIsForward) {
+ minSize += edge->minSize;
+ prefSize += edge->prefSize;
+ maxSize += edge->maxSize;
+ minPrefSize += edge->minPrefSize;
+ maxPrefSize += edge->maxPrefSize;
+ prev = edge->to;
+ } else {
+ Q_ASSERT(prev == edge->to);
+ minSize -= edge->maxSize;
+ prefSize -= edge->prefSize;
+ maxSize -= edge->minSize;
+ minPrefSize -= edge->maxPrefSize;
+ maxPrefSize -= edge->minPrefSize;
+ prev = edge->from;
+ }
}
// See comment in AnchorData::refreshSizeHints() about sizeAt* values
@@ -588,16 +713,25 @@ AnchorData *QGraphicsAnchorLayoutPrivate::addAnchorMaybeParallel(AnchorData *new
AnchorData *child = children[i];
QList<QSimplexConstraint *> *childConstraints = childrenConstraints[i];
+ // We need to fix the second child constraints if the parallel group will have the
+ // opposite direction of the second child anchor. For the point of view of external
+ // entities, this anchor was reversed. So if at some point we say that the parallel
+ // has a value of 20, this mean that the second child (when reversed) will be
+ // assigned -20.
+ const bool needsReverse = i == 1 && !parallel->secondForward();
+
if (!child->isCenterAnchor)
continue;
parallel->isCenterAnchor = true;
- for (int i = 0; i < constraints.count(); ++i) {
- QSimplexConstraint *c = constraints[i];
+ for (int j = 0; j < constraints.count(); ++j) {
+ QSimplexConstraint *c = constraints[j];
if (c->variables.contains(child)) {
childConstraints->append(c);
qreal v = c->variables.take(child);
+ if (needsReverse)
+ v *= -1;
c->variables.insert(parallel, v);
}
}
@@ -628,24 +762,10 @@ static AnchorData *createSequence(Graph<AnchorVertex, AnchorData> *graph,
const QVector<AnchorVertex*> &vertices,
AnchorVertex *after)
{
- AnchorData *data = graph->edgeData(before, vertices.first());
- Q_ASSERT(data);
-
- const bool forward = (before == data->from);
- QVector<AnchorVertex *> orderedVertices;
-
- if (forward) {
- orderedVertices = vertices;
- } else {
- qSwap(before, after);
- for (int i = vertices.count() - 1; i >= 0; --i)
- orderedVertices.append(vertices.at(i));
- }
-
#if defined(QT_DEBUG) && 0
QString strVertices;
- for (int i = 0; i < orderedVertices.count(); ++i) {
- strVertices += QString::fromAscii("%1 - ").arg(orderedVertices.at(i)->toString());
+ for (int i = 0; i < vertices.count(); ++i) {
+ strVertices += QString::fromAscii("%1 - ").arg(vertices.at(i)->toString());
}
QString strPath = QString::fromAscii("%1 - %2%3").arg(before->toString(), strVertices, after->toString());
qDebug("simplifying [%s] to [%s - %s]", qPrintable(strPath), qPrintable(before->toString()), qPrintable(after->toString()));
@@ -654,15 +774,22 @@ static AnchorData *createSequence(Graph<AnchorVertex, AnchorData> *graph,
AnchorVertex *prev = before;
QVector<AnchorData *> edges;
- for (int i = 0; i <= orderedVertices.count(); ++i) {
- AnchorVertex *next = (i < orderedVertices.count()) ? orderedVertices.at(i) : after;
+ // Take from the graph, the edges that will be simplificated
+ for (int i = 0; i < vertices.count(); ++i) {
+ AnchorVertex *next = vertices.at(i);
AnchorData *ad = graph->takeEdge(prev, next);
Q_ASSERT(ad);
edges.append(ad);
prev = next;
}
- SequentialAnchorData *sequence = new SequentialAnchorData(orderedVertices, edges);
+ // Take the last edge (not covered in the loop above)
+ AnchorData *ad = graph->takeEdge(vertices.last(), after);
+ Q_ASSERT(ad);
+ edges.append(ad);
+
+ // Create sequence
+ SequentialAnchorData *sequence = new SequentialAnchorData(vertices, edges);
sequence->from = before;
sequence->to = after;
@@ -922,7 +1049,6 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
QStack<QPair<AnchorVertex *, AnchorVertex *> > stack;
stack.push(qMakePair(static_cast<AnchorVertex *>(0), layoutFirstVertex[orientation]));
QVector<AnchorVertex*> candidates;
- bool candidatesForward = true;
// Walk depth-first, in the stack we store start of the candidate sequence (beforeSequence)
// and the vertex to be visited.
@@ -938,9 +1064,8 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
// A vertex can trigger an end of sequence if
// (a) it is a layout vertex, we don't simplify away the layout vertices;
// (b) it does not have exactly 2 adjacents;
- // (c) it will change the direction of the sequence;
- // (d) its next adjacent is already visited (a cycle in the graph);
- // (e) the next anchor is a center anchor.
+ // (c) its next adjacent is already visited (a cycle in the graph).
+ // (d) the next anchor is a center anchor.
const QList<AnchorVertex *> &adjacents = g.adjacentVertices(v);
const bool isLayoutVertex = v->m_item == q;
@@ -955,19 +1080,10 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
endOfSequence = isLayoutVertex || adjacents.count() != 2;
if (!endOfSequence) {
- // If this is the first vertice, determine what is the direction to use for this
- // sequence.
- if (candidates.isEmpty()) {
- const AnchorData *data = g.edgeData(beforeSequence, v);
- Q_ASSERT(data);
- candidatesForward = (beforeSequence == data->from);
- }
-
// This is a tricky part. We peek at the next vertex to find out whether
//
- // - the edge from this vertex to the next vertex has the same direction;
- // - we already visited the next vertex;
- // - the next anchor is a center.
+ // - we already visited the next vertex (c);
+ // - the next anchor is a center (d).
//
// Those are needed to identify the remaining end of sequence cases. Note that unlike
// (a) and (b), we preempt the end of sequence by looking into the next vertex.
@@ -985,22 +1101,17 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
const AnchorData *data = g.edgeData(v, after);
Q_ASSERT(data);
- const bool willChangeDirection = (candidatesForward != (v == data->from));
const bool cycleFound = visited.contains(after);
- // Now cases (c), (d) and (e)...
- endOfSequence = willChangeDirection || cycleFound || data->isCenterAnchor;
+ // Now cases (c) and (d)...
+ endOfSequence = cycleFound || data->isCenterAnchor;
- if (endOfSequence) {
- if (!willChangeDirection) {
- // If the direction will not change, we can add the current vertex to the
- // candidates list and we know that 'after' can be used as afterSequence.
- candidates.append(v);
- afterSequence = after;
- }
- } else {
+ if (!endOfSequence) {
// If it's not an end of sequence, then the vertex didn't trigger neither of the
- // previously four cases, so it can be added to the candidates list.
+ // previously three cases, so it can be added to the candidates list.
+ candidates.append(v);
+ } else if (cycleFound && (beforeSequence != after)) {
+ afterSequence = after;
candidates.append(v);
}
}
@@ -1143,9 +1254,15 @@ void QGraphicsAnchorLayoutPrivate::restoreSimplifiedConstraints(ParallelAnchorDa
c->variables.insert(parallel->firstEdge, v);
}
+ // When restoring, we might have to revert constraints back. See comments on
+ // addAnchorMaybeParallel().
+ const bool needsReverse = !parallel->secondForward();
+
for (int i = 0; i < parallel->m_secondConstraints.count(); ++i) {
QSimplexConstraint *c = parallel->m_secondConstraints.at(i);
qreal v = c->variables[parallel];
+ if (needsReverse)
+ v *= -1;
c->variables.remove(parallel);
c->variables.insert(parallel->secondEdge, v);
}
@@ -1187,7 +1304,22 @@ void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation)
Graph<AnchorVertex, AnchorData> &g = graph[orientation];
QList<AnchorVertexPair *> &toRestore = simplifiedVertices[orientation];
- // We will restore the vertices in the inverse order of creation, this way we ensure that
+ // Since we keep a list of parallel anchors and vertices that were created during vertex
+ // simplification, we can now iterate on those lists instead of traversing the graph
+ // recursively.
+
+ // First, restore the constraints changed when we created parallel anchors. Note that this
+ // works at this point because the constraints doesn't depend on vertex information and at
+ // this point it's always safe to identify whether the second child is forward or backwards.
+ // In the next step, we'll change the anchors vertices so that would not be possible anymore.
+ QList<AnchorData *> &parallelAnchors = anchorsFromSimplifiedVertices[orientation];
+
+ for (int i = parallelAnchors.count() - 1; i >= 0; --i) {
+ ParallelAnchorData *parallel = static_cast<ParallelAnchorData *>(parallelAnchors.at(i));
+ restoreSimplifiedConstraints(parallel);
+ }
+
+ // Then, we will restore the vertices in the inverse order of creation, this way we ensure that
// the vertex being restored was not wrapped by another simplification.
for (int i = toRestore.count() - 1; i >= 0; --i) {
AnchorVertexPair *pair = toRestore.at(i);
@@ -1231,20 +1363,9 @@ void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation)
delete pair;
}
- toRestore.clear();
-
- // The restoration process for vertex simplification also restored the effect of the
- // parallel anchors created during vertex simplification, so we just need to restore
- // the constraints in case of parallels that contain center anchors. For the same
- // reason as above, order matters here.
- QList<AnchorData *> &parallelAnchors = anchorsFromSimplifiedVertices[orientation];
-
- for (int i = parallelAnchors.count() - 1; i >= 0; --i) {
- ParallelAnchorData *parallel = static_cast<ParallelAnchorData *>(parallelAnchors.at(i));
- restoreSimplifiedConstraints(parallel);
- delete parallel;
- }
+ qDeleteAll(parallelAnchors);
parallelAnchors.clear();
+ toRestore.clear();
}
QGraphicsAnchorLayoutPrivate::Orientation
@@ -1545,6 +1666,13 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi
return 0;
}
+ const QGraphicsLayoutItem *parentWidget = q->parentLayoutItem();
+ if (firstItem == parentWidget || secondItem == parentWidget) {
+ qWarning("QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ return 0;
+ }
+
// In QGraphicsAnchorLayout, items are represented in its internal
// graph as four anchors that connect:
// - Left -> HCenter
@@ -1652,6 +1780,10 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::getAnchor(QGraphicsLayoutItem *fi
QGraphicsLayoutItem *secondItem,
Qt::AnchorPoint secondEdge)
{
+ // Do not expose internal anchors
+ if (firstItem == secondItem)
+ return 0;
+
const Orientation orientation = edgeOrientation(firstEdge);
AnchorVertex *v1 = internalVertex(firstItem, firstEdge);
AnchorVertex *v2 = internalVertex(secondItem, secondEdge);
@@ -1659,8 +1791,16 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::getAnchor(QGraphicsLayoutItem *fi
QGraphicsAnchor *graphicsAnchor = 0;
AnchorData *data = graph[orientation].edgeData(v1, v2);
- if (data)
- graphicsAnchor = acquireGraphicsAnchor(data);
+ if (data) {
+ // We could use "acquireGraphicsAnchor" here, but to avoid a regression where
+ // an internal anchor was wrongly exposed, I want to ensure no new
+ // QGraphicsAnchor instances are created by this call.
+ // This assumption must hold because anchors are either user-created (and already
+ // have their public object created), or they are internal (and must not reach
+ // this point).
+ Q_ASSERT(data->graphicsAnchor);
+ graphicsAnchor = data->graphicsAnchor;
+ }
return graphicsAnchor;
}
@@ -1675,12 +1815,16 @@ void QGraphicsAnchorLayoutPrivate::removeAnchor(AnchorVertex *firstVertex,
{
Q_Q(QGraphicsAnchorLayout);
- // Actually delete the anchor
- removeAnchor_helper(firstVertex, secondVertex);
-
+ // Save references to items while it's safe to assume the vertices exist
QGraphicsLayoutItem *firstItem = firstVertex->m_item;
QGraphicsLayoutItem *secondItem = secondVertex->m_item;
+ // Delete the anchor (may trigger deletion of center vertices)
+ removeAnchor_helper(firstVertex, secondVertex);
+
+ // Ensure no dangling pointer is left behind
+ firstVertex = secondVertex = 0;
+
// Checking if the item stays in the layout or not
bool keepFirstItem = false;
bool keepSecondItem = false;
@@ -2047,6 +2191,25 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs(
/*!
\internal
+ Shift all the constraints by a certain amount. This allows us to deal with negative values in
+ the linear program if they are bounded by a certain limit. Functions should be careful to
+ call it again with a negative amount, to shift the constraints back.
+*/
+static void shiftConstraints(const QList<QSimplexConstraint *> &constraints, qreal amount)
+{
+ for (int i = 0; i < constraints.count(); ++i) {
+ QSimplexConstraint *c = constraints.at(i);
+ qreal multiplier = 0;
+ foreach (qreal v, c->variables.values()) {
+ multiplier += v;
+ }
+ c->constant += multiplier * amount;
+ }
+}
+
+/*!
+ \internal
+
Calculate the sizes for all anchors which are part of the trunk. This works
on top of a (possibly) simplified graph.
*/
@@ -2067,12 +2230,14 @@ bool QGraphicsAnchorLayoutPrivate::calculateTrunk(Orientation orientation, const
QList<QSimplexConstraint *> sizeHintConstraints = constraintsFromSizeHints(variables);
QList<QSimplexConstraint *> allConstraints = constraints + sizeHintConstraints;
+ shiftConstraints(allConstraints, g_offset);
+
// Solve min and max size hints
qreal min, max;
feasible = solveMinMax(allConstraints, path, &min, &max);
if (feasible) {
- solvePreferred(allConstraints, variables);
+ solvePreferred(constraints, variables);
// Calculate and set the preferred size for the layout,
// from the edge sizes that were calculated above.
@@ -2090,6 +2255,7 @@ bool QGraphicsAnchorLayoutPrivate::calculateTrunk(Orientation orientation, const
}
qDeleteAll(sizeHintConstraints);
+ shiftConstraints(constraints, -g_offset);
} else {
// No Simplex is necessary because the path was simplified all the way to a single
@@ -2120,8 +2286,8 @@ bool QGraphicsAnchorLayoutPrivate::calculateTrunk(Orientation orientation, const
bool QGraphicsAnchorLayoutPrivate::calculateNonTrunk(const QList<QSimplexConstraint *> &constraints,
const QList<AnchorData *> &variables)
{
- QList<QSimplexConstraint *> sizeHintConstraints = constraintsFromSizeHints(variables);
- bool feasible = solvePreferred(constraints + sizeHintConstraints, variables);
+ shiftConstraints(constraints, g_offset);
+ bool feasible = solvePreferred(constraints, variables);
if (feasible) {
// Propagate size at preferred to other sizes. Semi-floats always will be
@@ -2134,7 +2300,7 @@ bool QGraphicsAnchorLayoutPrivate::calculateNonTrunk(const QList<QSimplexConstra
}
}
- qDeleteAll(sizeHintConstraints);
+ shiftConstraints(constraints, -g_offset);
return feasible;
}
@@ -2298,17 +2464,23 @@ QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin
if (ad->dependency == AnchorData::Slave)
continue;
- if ((ad->minSize == ad->maxSize) || qFuzzyCompare(ad->minSize, ad->maxSize)) {
+ // To use negative variables inside simplex, we shift them so the minimum negative value is
+ // mapped to zero before solving. To make sure that it works, we need to guarantee that the
+ // variables are all inside a certain boundary.
+ qreal boundedMin = qBound(-g_offset, ad->minSize, g_offset);
+ qreal boundedMax = qBound(-g_offset, ad->maxSize, g_offset);
+
+ if ((boundedMin == boundedMax) || qFuzzyCompare(boundedMin, boundedMax)) {
QSimplexConstraint *c = new QSimplexConstraint;
c->variables.insert(ad, 1.0);
- c->constant = ad->minSize;
+ c->constant = boundedMin;
c->ratio = QSimplexConstraint::Equal;
anchorConstraints += c;
unboundedProblem = false;
} else {
QSimplexConstraint *c = new QSimplexConstraint;
c->variables.insert(ad, 1.0);
- c->constant = ad->minSize;
+ c->constant = boundedMin;
c->ratio = QSimplexConstraint::MoreOrEqual;
anchorConstraints += c;
@@ -2320,7 +2492,7 @@ QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin
c = new QSimplexConstraint;
c->variables.insert(ad, 1.0);
- c->constant = ad->maxSize;
+ c->constant = boundedMax;
c->ratio = QSimplexConstraint::LessOrEqual;
anchorConstraints += c;
unboundedProblem = false;
@@ -2331,7 +2503,8 @@ QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin
if (unboundedProblem) {
QSimplexConstraint *c = new QSimplexConstraint;
c->variables.insert(layoutEdge, 1.0);
- c->constant = QWIDGETSIZE_MAX;
+ // The maximum size that the layout can take
+ c->constant = g_offset;
c->ratio = QSimplexConstraint::LessOrEqual;
anchorConstraints += c;
}
@@ -2597,6 +2770,8 @@ void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation(
result = getFactor(current,
sizeHints[orientation][Qt::MinimumSize],
sizeHints[orientation][Qt::PreferredSize],
+ sizeHints[orientation][Qt::PreferredSize],
+ sizeHints[orientation][Qt::PreferredSize],
sizeHints[orientation][Qt::MaximumSize]);
interpolationInterval[orientation] = result.first;
@@ -2625,6 +2800,7 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, AnchorDat
interpolationProgress[orientation]);
qreal edgeDistance = interpolate(factor, edge->sizeAtMinimum, edge->sizeAtPreferred,
+ edge->sizeAtPreferred, edge->sizeAtPreferred,
edge->sizeAtMaximum);
Q_ASSERT(edge->from == base || edge->to == base);
@@ -2652,34 +2828,46 @@ bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList<QSimplexConstraint *>
for (iter = path.negatives.constBegin(); iter != path.negatives.constEnd(); ++iter)
objective.variables.insert(*iter, -1.0);
+ const qreal objectiveOffset = (path.positives.count() - path.negatives.count()) * g_offset;
simplex.setObjective(&objective);
// Calculate minimum values
- *min = simplex.solveMin();
+ *min = simplex.solveMin() - objectiveOffset;
// Save sizeAtMinimum results
QList<AnchorData *> variables = getVariables(constraints);
for (int i = 0; i < variables.size(); ++i) {
AnchorData *ad = static_cast<AnchorData *>(variables.at(i));
- ad->sizeAtMinimum = ad->result;
- Q_ASSERT(ad->sizeAtMinimum >= ad->minSize ||
- qAbs(ad->sizeAtMinimum - ad->minSize) < 0.00000001);
+ ad->sizeAtMinimum = ad->result - g_offset;
}
// Calculate maximum values
- *max = simplex.solveMax();
+ *max = simplex.solveMax() - objectiveOffset;
// Save sizeAtMaximum results
for (int i = 0; i < variables.size(); ++i) {
AnchorData *ad = static_cast<AnchorData *>(variables.at(i));
- ad->sizeAtMaximum = ad->result;
- // Q_ASSERT(ad->sizeAtMaximum <= ad->maxSize ||
- // qAbs(ad->sizeAtMaximum - ad->maxSize) < 0.00000001);
+ ad->sizeAtMaximum = ad->result - g_offset;
}
}
return feasible;
}
+enum slackType { Grower = -1, Shrinker = 1 };
+static QPair<QSimplexVariable *, QSimplexConstraint *> createSlack(QSimplexConstraint *sizeConstraint,
+ qreal interval, slackType type)
+{
+ QSimplexVariable *slack = new QSimplexVariable;
+ sizeConstraint->variables.insert(slack, type);
+
+ QSimplexConstraint *limit = new QSimplexConstraint;
+ limit->variables.insert(slack, 1.0);
+ limit->ratio = QSimplexConstraint::LessOrEqual;
+ limit->constant = interval;
+
+ return qMakePair(slack, limit);
+}
+
bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint *> &constraints,
const QList<AnchorData *> &variables)
{
@@ -2690,7 +2878,8 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint
// Fill the objective coefficients for this variable. In the
// end the objective function will be
//
- // z = n * (A_shrink + B_shrink + ...) + (A_grower + B_grower + ...)
+ // z = n * (A_shrinker_hard + A_grower_hard + B_shrinker_hard + B_grower_hard + ...) +
+ // (A_shrinker_soft + A_grower_soft + B_shrinker_soft + B_grower_soft + ...)
//
// where n is the number of variables that have
// slacks. Note that here we use the number of variables
@@ -2702,7 +2891,7 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint
// and we now fill the values for the slack constraints (one per variable),
// which have this form (the constant A_pref was set when creating the slacks):
//
- // A + A_shrinker - A_grower = A_pref
+ // A + A_shrinker_hard + A_shrinker_soft - A_grower_hard - A_grower_soft = A_pref
//
for (int i = 0; i < variables.size(); ++i) {
AnchorData *ad = variables.at(i);
@@ -2711,22 +2900,58 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint
if (ad->isLayoutAnchor)
continue;
- QSimplexVariable *grower = new QSimplexVariable;
- QSimplexVariable *shrinker = new QSimplexVariable;
- QSimplexConstraint *c = new QSimplexConstraint;
- c->variables.insert(ad, 1.0);
- c->variables.insert(shrinker, 1.0);
- c->variables.insert(grower, -1.0);
- c->constant = ad->prefSize;
+ // By default, all variables are equal to their preferred size. If they have room to
+ // grow or shrink, such flexibility will be added by the additional variables below.
+ QSimplexConstraint *sizeConstraint = new QSimplexConstraint;
+ preferredConstraints += sizeConstraint;
+ sizeConstraint->variables.insert(ad, 1.0);
+ sizeConstraint->constant = ad->prefSize + g_offset;
+
+ // Can easily shrink
+ QPair<QSimplexVariable *, QSimplexConstraint *> slack;
+ const qreal softShrinkInterval = ad->prefSize - ad->minPrefSize;
+ if (softShrinkInterval) {
+ slack = createSlack(sizeConstraint, softShrinkInterval, Shrinker);
+ preferredVariables += slack.first;
+ preferredConstraints += slack.second;
+
+ // Add to objective with ratio == 1 (soft)
+ objective.variables.insert(slack.first, 1.0);
+ }
- preferredConstraints += c;
- preferredVariables += grower;
- preferredVariables += shrinker;
+ // Can easily grow
+ const qreal softGrowInterval = ad->maxPrefSize - ad->prefSize;
+ if (softGrowInterval) {
+ slack = createSlack(sizeConstraint, softGrowInterval, Grower);
+ preferredVariables += slack.first;
+ preferredConstraints += slack.second;
- objective.variables.insert(grower, 1.0);
- objective.variables.insert(shrinker, variables.size());
- }
+ // Add to objective with ratio == 1 (soft)
+ objective.variables.insert(slack.first, 1.0);
+ }
+
+ // Can shrink if really necessary
+ const qreal hardShrinkInterval = ad->minPrefSize - ad->minSize;
+ if (hardShrinkInterval) {
+ slack = createSlack(sizeConstraint, hardShrinkInterval, Shrinker);
+ preferredVariables += slack.first;
+ preferredConstraints += slack.second;
+
+ // Add to objective with ratio == N (hard)
+ objective.variables.insert(slack.first, variables.size());
+ }
+ // Can grow if really necessary
+ const qreal hardGrowInterval = ad->maxSize - ad->maxPrefSize;
+ if (hardGrowInterval) {
+ slack = createSlack(sizeConstraint, hardGrowInterval, Grower);
+ preferredVariables += slack.first;
+ preferredConstraints += slack.second;
+
+ // Add to objective with ratio == N (hard)
+ objective.variables.insert(slack.first, variables.size());
+ }
+ }
QSimplex *simplex = new QSimplex;
bool feasible = simplex->setConstraints(constraints + preferredConstraints);
@@ -2739,7 +2964,7 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint
// Save sizeAtPreferred results
for (int i = 0; i < variables.size(); ++i) {
AnchorData *ad = variables.at(i);
- ad->sizeAtPreferred = ad->result;
+ ad->sizeAtPreferred = ad->result - g_offset;
}
// Make sure we delete the simplex solver -before- we delete the
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index 8529e2e..3be9d41 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -123,17 +123,17 @@ struct AnchorData : public QSimplexVariable {
AnchorData()
: QSimplexVariable(), from(0), to(0),
minSize(0), prefSize(0), maxSize(0),
+ minPrefSize(0), maxPrefSize(0),
sizeAtMinimum(0), sizeAtPreferred(0),
sizeAtMaximum(0), item(0), graphicsAnchor(0),
type(Normal), isLayoutAnchor(false),
isCenterAnchor(false), orientation(0),
dependency(Independent) {}
+ virtual ~AnchorData();
virtual void updateChildrenSizes() {}
void refreshSizeHints(const QLayoutStyleInfo *styleInfo = 0);
- virtual ~AnchorData() {}
-
#ifdef QT_DEBUG
void dump(int indent = 2);
inline QString toString() const;
@@ -154,6 +154,9 @@ struct AnchorData : public QSimplexVariable {
qreal prefSize;
qreal maxSize;
+ qreal minPrefSize;
+ qreal maxPrefSize;
+
// Calculated sizes
// These attributes define which sizes should that anchor be in when the
// layout is at its minimum, preferred or maximum sizes. Values are
@@ -213,7 +216,8 @@ struct ParallelAnchorData : public AnchorData
Q_ASSERT(((first->from == second->from) && (first->to == second->to)) ||
((first->from == second->to) && (first->to == second->from)));
- // We arbitrarily choose the direction of the first child as "our" direction
+ // Our convention will be that the parallel group anchor will have the same
+ // direction as the first anchor.
from = first->from;
to = first->to;
#ifdef QT_DEBUG
@@ -224,6 +228,13 @@ struct ParallelAnchorData : public AnchorData
virtual void updateChildrenSizes();
bool calculateSizeHints();
+ bool secondForward() const {
+ // We have the convention that the first children will define the direction of the
+ // pararell group. Note that we can't rely on 'this->from' or 'this->to' because they
+ // might be changed by vertex simplification.
+ return firstEdge->from == secondEdge->from;
+ }
+
AnchorData* firstEdge;
AnchorData* secondEdge;
@@ -343,7 +354,6 @@ public:
qreal preferredSize;
uint hasSize : 1; // if false, get size from style.
- uint reversed : 1; // if true, the anchor was inverted to keep its value positive
};
@@ -365,8 +375,10 @@ public:
//
// Interval represents which interpolation interval are we operating in.
enum Interval {
- MinToPreferred = 0,
- PreferredToMax
+ MinimumToMinPreferred = 0,
+ MinPreferredToPreferred,
+ PreferredToMaxPreferred,
+ MaxPreferredToMaximum
};
// Several structures internal to the layout are duplicated to handle
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index bc47872..d955f16 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1341,8 +1341,8 @@ QGraphicsItem::~QGraphicsItem()
}
if (!d_ptr->children.isEmpty()) {
- QList<QGraphicsItem *> oldChildren = d_ptr->children;
- qDeleteAll(oldChildren);
+ while (!d_ptr->children.isEmpty())
+ delete d_ptr->children.first();
Q_ASSERT(d_ptr->children.isEmpty());
}
@@ -2554,6 +2554,8 @@ QGraphicsEffect *QGraphicsItem::graphicsEffect() const
If \a effect is the installed on a different item, setGraphicsEffect() will remove
the effect from the item and install it on this item.
+ QGraphicsItem takes ownership of \a effect.
+
\note This function will apply the effect on itself and all its children.
\since 4.6
@@ -2563,38 +2565,54 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
if (d_ptr->graphicsEffect == effect)
return;
- if (d_ptr->graphicsEffect && effect) {
+ if (d_ptr->graphicsEffect) {
delete d_ptr->graphicsEffect;
d_ptr->graphicsEffect = 0;
}
- if (!effect) {
- // Unset current effect.
- QGraphicsEffectPrivate *oldEffectPrivate = d_ptr->graphicsEffect->d_func();
- d_ptr->graphicsEffect = 0;
- if (oldEffectPrivate) {
- oldEffectPrivate->setGraphicsEffectSource(0); // deletes the current source.
- if (d_ptr->scene) { // Update the views directly.
- d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/false,
- /*force=*/false, /*ignoreOpacity=*/false,
- /*removeItemFromScene=*/true);
- }
- }
- } else {
+ if (effect) {
// Set new effect.
QGraphicsEffectSourcePrivate *sourced = new QGraphicsItemEffectSourcePrivate(this);
QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced);
d_ptr->graphicsEffect = effect;
effect->d_func()->setGraphicsEffectSource(source);
+ prepareGeometryChange();
}
-
- prepareGeometryChange();
}
#endif //QT_NO_GRAPHICSEFFECT
/*!
\internal
\since 4.6
+ Returns the effective bounding rect of the given item space rect.
+ If the item has no effect, the rect is returned unmodified.
+ If the item has an effect, the effective rect can be extend beyond the
+ item's bounding rect, depending on the effect.
+
+ \sa boundingRect()
+*/
+QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
+{
+#ifndef QT_NO_GRAPHICSEFFECT
+ Q_Q(const QGraphicsItem);
+ QGraphicsEffect *effect = graphicsEffect;
+ if (scene && effect && effect->isEnabled()) {
+ QRectF sceneRect = q->mapRectToScene(rect);
+ QRectF sceneEffectRect;
+ foreach (QGraphicsView *view, scene->views()) {
+ QRectF deviceRect = view->d_func()->mapRectFromScene(sceneRect);
+ QRect deviceEffectRect = effect->boundingRectFor(deviceRect).toAlignedRect();
+ sceneEffectRect |= view->d_func()->mapRectToScene(deviceEffectRect);
+ }
+ return q->mapRectFromScene(sceneEffectRect);
+ }
+#endif //QT_NO_GRAPHICSEFFECT
+ return rect;
+}
+
+/*!
+ \internal
+ \since 4.6
Returns the effective bounding rect of the item.
If the item has no effect, this is the same as the item's bounding rect.
If the item has an effect, the effective rect can be larger than the item's
@@ -2605,16 +2623,19 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
QRectF QGraphicsItemPrivate::effectiveBoundingRect() const
{
#ifndef QT_NO_GRAPHICSEFFECT
- QGraphicsEffect *effect = graphicsEffect;
- QRectF brect = effect && effect->isEnabled() ? effect->boundingRect() : q_ptr->boundingRect();
+ Q_Q(const QGraphicsItem);
+ QRectF brect = effectiveBoundingRect(q_ptr->boundingRect());
if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
return brect;
const QGraphicsItem *effectParent = parent;
while (effectParent) {
- effect = effectParent->d_ptr->graphicsEffect;
- if (effect && effect->isEnabled())
- brect = effect->boundingRectFor(brect);
+ QGraphicsEffect *effect = effectParent->d_ptr->graphicsEffect;
+ if (scene && effect && effect->isEnabled()) {
+ const QRectF brectInParentSpace = q->mapRectToItem(effectParent, brect);
+ const QRectF effectRectInParentSpace = effectParent->d_ptr->effectiveBoundingRect(brectInParentSpace);
+ brect = effectParent->mapRectToItem(q, effectRectInParentSpace);
+ }
if (effectParent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
return brect;
effectParent = effectParent->d_ptr->parent;
@@ -7305,13 +7326,6 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture)
*/
/*!
- \property QGraphicsObject::id
- \brief the id of of the item
-
- \sa QObject::objectName(), QObject::setObjectName()
-*/
-
-/*!
\property QGraphicsObject::opacity
\brief the opacity of the item
@@ -10523,6 +10537,20 @@ void QGraphicsItemGroup::addToGroup(QGraphicsItem *item)
if (!item->pos().isNull())
newItemTransform *= QTransform::fromTranslate(-item->x(), -item->y());
+ // removing additional transformations properties applied with itemTransform()
+ QPointF origin = item->transformOriginPoint();
+ QMatrix4x4 m;
+ QList<QGraphicsTransform*> transformList = item->transformations();
+ for (int i = 0; i < transformList.size(); ++i)
+ transformList.at(i)->applyTo(&m);
+ newItemTransform *= m.toTransform().inverted();
+ newItemTransform.translate(origin.x(), origin.y());
+ newItemTransform.rotate(-item->rotation());
+ newItemTransform.scale(1/item->scale(), 1/item->scale());
+ newItemTransform.translate(-origin.x(), -origin.y());
+
+ // ### Expensive, we could maybe use dirtySceneTransform bit for optimization
+
item->setTransform(newItemTransform);
item->d_func()->setIsMemberOfGroup(true);
prepareGeometryChange();
@@ -10547,11 +10575,39 @@ void QGraphicsItemGroup::removeFromGroup(QGraphicsItem *item)
}
QGraphicsItem *newParent = d_ptr->parent;
+
+ // COMBINE
+ bool ok;
+ QTransform itemTransform;
+ if (newParent)
+ itemTransform = item->itemTransform(newParent, &ok);
+ else
+ itemTransform = item->sceneTransform();
+
QPointF oldPos = item->mapToItem(newParent, 0, 0);
item->setParentItem(newParent);
- // ### This function should remap the item's matrix to keep the item's
- // transformation unchanged relative to the scene.
item->setPos(oldPos);
+
+ // removing position from translation component of the new transform
+ if (!item->pos().isNull())
+ itemTransform *= QTransform::fromTranslate(-item->x(), -item->y());
+
+ // removing additional transformations properties applied
+ // with itemTransform() or sceneTransform()
+ QPointF origin = item->transformOriginPoint();
+ QMatrix4x4 m;
+ QList<QGraphicsTransform*> transformList = item->transformations();
+ for (int i = 0; i < transformList.size(); ++i)
+ transformList.at(i)->applyTo(&m);
+ itemTransform *= m.toTransform().inverted();
+ itemTransform.translate(origin.x(), origin.y());
+ itemTransform.rotate(-item->rotation());
+ itemTransform.scale(1 / item->scale(), 1 / item->scale());
+ itemTransform.translate(-origin.x(), -origin.y());
+
+ // ### Expensive, we could maybe use dirtySceneTransform bit for optimization
+
+ item->setTransform(itemTransform);
item->d_func()->setIsMemberOfGroup(item->group() != 0);
// ### Quite expensive. But removeFromGroup() isn't called very often.
@@ -10667,17 +10723,26 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func();
const QRectF sourceRect = boundingRect(system);
- QRect effectRect;
+ QRectF effectRectF;
if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) {
- effectRect = item->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
+ if (info) {
+ effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
+ if (info && system == Qt::LogicalCoordinates)
+ effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
+ } else {
+ // no choice but to send a logical coordinate bounding rect to boundingRectFor
+ effectRectF = item->graphicsEffect()->boundingRectFor(sourceRect);
+ }
} else if (mode == QGraphicsEffect::PadToTransparentBorder) {
// adjust by 1.5 to account for cosmetic pens
- effectRect = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5).toAlignedRect();
+ effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5);
} else {
- effectRect = sourceRect.toAlignedRect();
+ effectRectF = sourceRect;
}
+ QRect effectRect = effectRectF.toAlignedRect();
+
if (offset)
*offset = effectRect.topLeft();
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index 8bbe9f1..8818a0b 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -537,7 +537,6 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
{
Q_OBJECT
Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false)
- Q_PROPERTY(QString id READ objectName WRITE setObjectName)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index d6ffb1a..2d8de65 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -236,6 +236,8 @@ public:
QRectF effectiveBoundingRect() const;
QRectF sceneEffectiveBoundingRect() const;
+ QRectF effectiveBoundingRect(const QRectF &rect) const;
+
virtual void resolveFont(uint inheritedMask)
{
for (int i = 0; i < children.size(); ++i)
@@ -562,7 +564,10 @@ public:
{}
inline void detach()
- { item->setGraphicsEffect(0); }
+ {
+ item->d_ptr->graphicsEffect = 0;
+ item->prepareGeometryChange();
+ }
inline const QGraphicsItem *graphicsItem() const
{ return item; }
diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp
index 2e9a30c..1e426c8 100644
--- a/src/gui/graphicsview/qgraphicslayout.cpp
+++ b/src/gui/graphicsview/qgraphicslayout.cpp
@@ -148,6 +148,10 @@ QT_BEGIN_NAMESPACE
\a parent is passed to QGraphicsLayoutItem's constructor and the
QGraphicsLayoutItem's isLayout argument is set to \e true.
+
+ If \a parent is a QGraphicsWidget the layout will be installed
+ on that widget. (Note that installing a layout will delete the old one
+ installed.)
*/
QGraphicsLayout::QGraphicsLayout(QGraphicsLayoutItem *parent)
: QGraphicsLayoutItem(*new QGraphicsLayoutPrivate)
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 82d2e2f..b1c1ea0 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -569,14 +569,10 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
item->d_ptr->clearSubFocus();
- if (!item->d_ptr->inDestructor && item == tabFocusFirst) {
- QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
- widget->d_func()->fixFocusChainBeforeReparenting(0, 0);
- }
-
if (item->flags() & QGraphicsItem::ItemSendsScenePositionChanges)
unregisterScenePosItem(item);
+ QGraphicsScene *oldScene = item->d_func()->scene;
item->d_func()->scene = 0;
//We need to remove all children first because they might use their parent
@@ -587,6 +583,11 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
q->removeItem(item->d_ptr->children.at(i));
}
+ if (!item->d_ptr->inDestructor && item == tabFocusFirst) {
+ QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
+ widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0);
+ }
+
// Unregister focus proxy.
item->d_ptr->resetFocusProxy();
@@ -613,6 +614,19 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
if (item == lastActivePanel)
lastActivePanel = 0;
+ // Cancel active touches
+ {
+ QMap<int, QGraphicsItem *>::iterator it = itemForTouchPointId.begin();
+ while (it != itemForTouchPointId.end()) {
+ if (it.value() == item) {
+ sceneCurrentTouchPoints.remove(it.key());
+ it = itemForTouchPointId.erase(it);
+ } else {
+ ++it;
+ }
+ }
+ }
+
// Disable selectionChanged() for individual items
++selectionChanging;
int oldSelectedItemsSize = selectedItems.size();
@@ -4235,7 +4249,6 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &
if (!subPix.isNull()) {
// Blit the subpixmap into the main pixmap.
pixmapPainter.begin(pix);
- pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source);
pixmapPainter.setClipRegion(pixmapExposed);
pixmapPainter.drawPixmap(br.topLeft(), subPix);
pixmapPainter.end();
@@ -5682,17 +5695,22 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
touchEvent->setAccepted(acceptTouchEvents);
res = acceptTouchEvents && sendEvent(item, touchEvent);
eventAccepted = touchEvent->isAccepted();
- item->d_ptr->acceptedTouchBeginEvent = (res && eventAccepted);
+ if (itemForTouchPointId.value(touchEvent->touchPoints().first().id()) == 0) {
+ // item was deleted
+ item = 0;
+ } else {
+ item->d_ptr->acceptedTouchBeginEvent = (res && eventAccepted);
+ }
touchEvent->spont = false;
if (res && eventAccepted) {
// the first item to accept the TouchBegin gets an implicit grab.
for (int i = 0; i < touchEvent->touchPoints().count(); ++i) {
const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i);
- itemForTouchPointId[touchPoint.id()] = item;
+ itemForTouchPointId[touchPoint.id()] = item; // can be zero
}
break;
}
- if (item->isPanel())
+ if (item && item->isPanel())
break;
}
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 3f9f443..ffe64aa 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -545,6 +545,32 @@ qint64 QGraphicsViewPrivate::verticalScroll() const
/*!
\internal
+
+ Maps the given rectangle to the scene using QTransform::mapRect()
+*/
+QRectF QGraphicsViewPrivate::mapRectToScene(const QRect &rect) const
+{
+ if (dirtyScroll)
+ const_cast<QGraphicsViewPrivate *>(this)->updateScroll();
+ QRectF scrolled = QRectF(rect.translated(scrollX, scrollY));
+ return identityMatrix ? scrolled : matrix.inverted().mapRect(scrolled);
+}
+
+
+/*!
+ \internal
+
+ Maps the given rectangle from the scene using QTransform::mapRect()
+*/
+QRectF QGraphicsViewPrivate::mapRectFromScene(const QRectF &rect) const
+{
+ if (dirtyScroll)
+ const_cast<QGraphicsViewPrivate *>(this)->updateScroll();
+ return (identityMatrix ? rect : matrix.mapRect(rect)).translated(-scrollX, -scrollY);
+}
+
+/*!
+ \internal
*/
void QGraphicsViewPrivate::updateScroll()
{
diff --git a/src/gui/graphicsview/qgraphicsview.h b/src/gui/graphicsview/qgraphicsview.h
index 2aed0e6..90576e5 100644
--- a/src/gui/graphicsview/qgraphicsview.h
+++ b/src/gui/graphicsview/qgraphicsview.h
@@ -278,6 +278,7 @@ private:
friend class QGraphicsSceneWidget;
friend class QGraphicsScene;
friend class QGraphicsScenePrivate;
+ friend class QGraphicsItemPrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsView::CacheMode)
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h
index cd161ad..d4b718e 100644
--- a/src/gui/graphicsview/qgraphicsview_p.h
+++ b/src/gui/graphicsview/qgraphicsview_p.h
@@ -86,6 +86,9 @@ public:
qint64 horizontalScroll() const;
qint64 verticalScroll() const;
+ QRectF mapRectToScene(const QRect &rect) const;
+ QRectF mapRectFromScene(const QRectF &rect) const;
+
QPointF mousePressItemPoint;
QPointF mousePressScenePoint;
QPoint mousePressViewPoint;
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 1bb6375..4e6b269 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1084,7 +1084,7 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
break;
case ItemParentChange: {
QGraphicsItem *parent = qVariantValue<QGraphicsItem *>(value);
- d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast<QGraphicsWidget *>(parent) : 0);
+ d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast<QGraphicsWidget *>(parent) : 0, scene());
// Deliver ParentAboutToChange.
QEvent event(QEvent::ParentAboutToChange);
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index b747a30..5b6490f 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -743,7 +743,7 @@ bool QGraphicsWidgetPrivate::hasDecoration() const
/**
* is called after a reparent has taken place to fix up the focus chain(s)
*/
-void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *newScene)
+void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *oldScene, QGraphicsScene *newScene)
{
Q_Q(QGraphicsWidget);
@@ -789,7 +789,7 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
// update tabFocusFirst for oldScene if the item is going to be removed from oldScene
if (newParent)
newScene = newParent->scene();
- QGraphicsScene *oldScene = q->scene();
+
if (oldScene && newScene != oldScene)
oldScene->d_func()->tabFocusFirst = firstOld;
diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h
index d2f898e..39cbfcd 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.h
+++ b/src/gui/graphicsview/qgraphicswidget_p.h
@@ -99,7 +99,7 @@ public:
mutable qreal *margins;
void ensureMargins() const;
- void fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *newScene = 0);
+ void fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *oldScene, QGraphicsScene *newScene = 0);
void setLayout_helper(QGraphicsLayout *l);
// Layouts
diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h
index a5816d1..2004471 100644
--- a/src/gui/graphicsview/qsimplex_p.h
+++ b/src/gui/graphicsview/qsimplex_p.h
@@ -107,7 +107,7 @@ struct QSimplexConstraint
Q_ASSERT(constant > 0 || qFuzzyCompare(1, 1 + constant));
- if ((leftHandSide == constant) || qAbs(leftHandSide - constant) < 0.00000001)
+ if ((leftHandSide == constant) || qAbs(leftHandSide - constant) < 0.0000001)
return true;
switch (ratio) {
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index d8809ef..ce7f450 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -165,12 +165,16 @@ public:
QRect rect() const;
int depth() const;
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numColors() const;
+#endif
int colorCount() const;
QRgb color(int i) const;
void setColor(int i, QRgb c);
+#ifdef QT_DEPRECATED
QT_DEPRECATED void setNumColors(int);
+#endif
void setColorCount(int);
bool allGray() const;
@@ -178,7 +182,9 @@ public:
uchar *bits();
const uchar *bits() const;
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numBytes() const;
+#endif
int byteCount() const;
uchar *scanLine(int);
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index d95b4ee..e02b0d6 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -185,7 +185,9 @@ public:
const uchar *qwsBits() const;
int qwsBytesPerLine() const;
QRgb *clut() const;
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numCols() const;
+#endif
int colorCount() const;
#elif defined(Q_WS_MAC)
Qt::HANDLE macQDHandle() const;
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index b0b7d72..b7b29d7 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -424,6 +424,11 @@ QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
Q_GLOBAL_STATIC(QPMCache, pm_cache)
+int Q_AUTOTEST_EXPORT q_QPixmapCache_keyHashSize()
+{
+ return pm_cache()->size();
+}
+
QPixmapCacheEntry::~QPixmapCacheEntry()
{
pm_cache()->releaseKey(key);
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index bdff5e7..a295d66 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -437,6 +437,10 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
void QCoeFepInputContext::applyFormat(QList<QInputMethodEvent::Attribute> *attributes)
{
TCharFormat cFormat;
+ QColor styleTextColor = QApplication::palette("QLineEdit").text().color();
+ TLogicalRgb tontColor(TRgb(styleTextColor.red(), styleTextColor.green(), styleTextColor.blue(), styleTextColor.alpha()));
+ cFormat.iFontPresentation.iTextColor = tontColor;
+
TInt numChars = 0;
TInt charPos = 0;
int oldSize = attributes->size();
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index de6e6cb..4a450b7 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2867,6 +2867,8 @@ int QAbstractItemView::sizeHintForRow(int row) const
if (row < 0 || row >= d->model->rowCount() || !model())
return -1;
+ ensurePolished();
+
QStyleOptionViewItemV4 option = d->viewOptionsV4();
int height = 0;
int colCount = d->model->columnCount(d->root);
@@ -2896,6 +2898,8 @@ int QAbstractItemView::sizeHintForColumn(int column) const
if (column < 0 || column >= d->model->columnCount() || !model())
return -1;
+ ensurePolished();
+
QStyleOptionViewItemV4 option = d->viewOptionsV4();
int width = 0;
int rows = d->model->rowCount(d->root);
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 5dd1d76..0ce0e5e 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -173,10 +173,11 @@ void QListModel::move(int srcRow, int dstRow)
{
if (srcRow == dstRow
|| srcRow < 0 || srcRow >= items.count()
- || dstRow < 0 || dstRow >= items.count())
+ || dstRow < 0 || dstRow > items.count())
return;
- beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow);
+ if (!beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow))
+ return;
if (srcRow < dstRow)
--dstRow;
items.move(srcRow, dstRow);
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 3ad9fbb..bcf9cfb 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2774,6 +2774,7 @@ int QTreeView::sizeHintForColumn(int column) const
d->executePostedLayout();
if (d->viewItems.isEmpty())
return -1;
+ ensurePolished();
int w = 0;
QStyleOptionViewItemV4 option = d->viewOptionsV4();
const QVector<QTreeViewItem> viewItems = d->viewItems;
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index c675c9e..edf077b 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -4092,9 +4092,15 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents);
touchEvent->setWidget(widget);
touchEvent->setAccepted(acceptTouchEvents);
+ QWeakPointer<QWidget> p = widget;
res = acceptTouchEvents && d->notify_helper(widget, touchEvent);
eventAccepted = touchEvent->isAccepted();
- widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, res && eventAccepted);
+ if (p.isNull()) {
+ // widget was deleted
+ widget = 0;
+ } else {
+ widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, res && eventAccepted);
+ }
touchEvent->spont = false;
if (res && eventAccepted) {
// the first widget to accept the TouchBegin gets an implicit grab.
@@ -4103,7 +4109,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
d->widgetForTouchPointId[touchPoint.id()] = widget;
}
break;
- } else if (widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) {
+ } else if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) {
break;
}
QPoint offset = widget->pos();
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 1acc9b3..0e98f39 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -246,15 +246,22 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys)
break;
}
- int command = (softKeyAction->objectName().contains("_q_menuSoftKeyAction"))
+ int command = (softKeyAction->objectName().contains(QLatin1String("_q_menuSoftKeyAction")))
? EAknSoftkeyOptions
: s60CommandStart + index;
+ // _q_menuSoftKeyAction action is set to "invisible" and all invisible actions are by default
+ // disabled. However we never want to dim options softkey, even it is set to "invisible"
+ bool dimmed = (command == EAknSoftkeyOptions) ? false : !softKeyAction->isEnabled();
+
if (position != -1) {
const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut);
QString iconText = softKeyAction->iconText();
TPtrC text = qt_QString2TPtrC( underlineShortCut ? softKeyAction->text() : iconText);
- QT_TRAP_THROWING(nativeContainer->SetCommandL(position, command, text));
+ QT_TRAP_THROWING(
+ nativeContainer->SetCommandL(position, command, text);
+ nativeContainer->DimCommand(command, dimmed);
+ );
}
}
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 685d7ec..e0b1499 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -4963,6 +4963,8 @@ QGraphicsEffect *QWidget::graphicsEffect() const
If \a effect is the installed on a different widget, setGraphicsEffect() will remove
the effect from the widget and install it on this widget.
+ QWidget takes ownership of \a effect.
+
\note This function will apply the effect on itself and all its children.
\since 4.6
@@ -4976,28 +4978,22 @@ void QWidget::setGraphicsEffect(QGraphicsEffect *effect)
if (d->graphicsEffect == effect)
return;
- if (d->graphicsEffect && effect) {
+ if (d->graphicsEffect) {
+ d->invalidateBuffer(rect());
delete d->graphicsEffect;
d->graphicsEffect = 0;
}
- if (!effect) {
- // Unset current effect.
- QGraphicsEffectPrivate *oldEffectPrivate = d->graphicsEffect->d_func();
- d->graphicsEffect = 0;
- if (oldEffectPrivate) {
- oldEffectPrivate->setGraphicsEffectSource(0); // deletes the current source.
- }
- } else {
+ if (effect) {
// Set new effect.
QGraphicsEffectSourcePrivate *sourced = new QWidgetEffectSourcePrivate(this);
QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced);
d->graphicsEffect = effect;
effect->d_func()->setGraphicsEffectSource(source);
+ update();
}
d->updateIsOpaque();
- update();
}
#endif //QT_NO_GRAPHICSEFFECT
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 5ba1d23..0824db3 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -744,6 +744,7 @@ private:
friend struct QWidgetExceptionCleaner;
friend class QGestureManager;
friend class QWinNativePanGestureRecognizer;
+ friend class QWidgetEffectSourcePrivate;
#ifdef Q_WS_MAC
friend class QCoreGraphicsPaintEnginePrivate;
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index c75358d..34a9eed 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3654,6 +3654,16 @@ void QWidgetPrivate::setFocus_sys()
}
}
+NSComparisonResult compareViews2Raise(id view1, id view2, void *context)
+{
+ id topView = reinterpret_cast<id>(context);
+ if (view1 == topView)
+ return NSOrderedDescending;
+ if (view2 == topView)
+ return NSOrderedAscending;
+ return NSOrderedSame;
+}
+
void QWidgetPrivate::raise_sys()
{
Q_Q(QWidget);
@@ -3661,7 +3671,6 @@ void QWidgetPrivate::raise_sys()
return;
#if QT_MAC_USE_COCOA
- QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
// Calling orderFront shows the window on Cocoa too.
if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
@@ -3673,16 +3682,9 @@ void QWidgetPrivate::raise_sys()
SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
}
} else {
- // Cocoa doesn't really have an idea of Z-ordering, but you can
- // fake it by changing the order of it. But beware, removing an
- // NSView will also remove it as the first responder. So we re-set
- // the first responder just in case:
NSView *view = qt_mac_nativeview_for(q);
NSView *parentView = [view superview];
- NSResponder *firstResponder = [[view window] firstResponder];
- [view removeFromSuperview];
- [parentView addSubview:view];
- [[view window] makeFirstResponder:firstResponder];
+ [parentView sortSubviewsUsingFunction:compareViews2Raise context:reinterpret_cast<void *>(view)];
}
#else
if(q->isWindow()) {
@@ -3700,47 +3702,29 @@ void QWidgetPrivate::raise_sys()
#endif
}
+NSComparisonResult compareViews2Lower(id view1, id view2, void *context)
+{
+ id topView = reinterpret_cast<id>(context);
+ if (view1 == topView)
+ return NSOrderedAscending;
+ if (view2 == topView)
+ return NSOrderedDescending;
+ return NSOrderedSame;
+}
+
void QWidgetPrivate::lower_sys()
{
Q_Q(QWidget);
if((q->windowType() == Qt::Desktop))
return;
#ifdef QT_MAC_USE_COCOA
- QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
OSWindowRef window = qt_mac_window_for(q);
[window orderBack:window];
} else {
- // Cocoa doesn't really have an idea of Z-ordering, but you can
- // fake it by changing the order of it. In this case
- // we put the item at the beginning of the list, but that means
- // we must re-insert everything since we cannot modify the list directly.
- NSView *myview = qt_mac_nativeview_for(q);
- NSView *parentView = [myview superview];
- NSArray *tmpViews = [parentView subviews];
- NSMutableArray *subviews = [[NSMutableArray alloc] initWithCapacity:[tmpViews count]];
- [subviews addObjectsFromArray:tmpViews];
- NSResponder *firstResponder = [[myview window] firstResponder];
- // Implicit assumption that myViewIndex is included in subviews, that's why I'm not checking
- // myViewIndex.
- NSUInteger index = 0;
- NSUInteger myViewIndex = 0;
- bool foundMyView = false;
- for (NSView *subview in subviews) {
- [subview removeFromSuperview];
- if (subview == myview) {
- foundMyView = true;
- myViewIndex = index;
- }
- ++index;
- }
- [parentView addSubview:myview];
- if (foundMyView)
- [subviews removeObjectAtIndex:myViewIndex];
- for (NSView *subview in subviews)
- [parentView addSubview:subview];
- [subviews release];
- [[myview window] makeFirstResponder:firstResponder];
+ NSView *view = qt_mac_nativeview_for(q);
+ NSView *parentView = [view superview];
+ [parentView sortSubviewsUsingFunction:compareViews2Lower context:reinterpret_cast<void *>(view)];
}
#else
if(q->isWindow()) {
@@ -3753,6 +3737,16 @@ void QWidgetPrivate::lower_sys()
#endif
}
+NSComparisonResult compareViews2StackUnder(id view1, id view2, void *context)
+{
+ const QHash<NSView *, int> &viewOrder = *reinterpret_cast<QHash<NSView *, int> *>(context);
+ if (viewOrder[view1] < viewOrder[view2])
+ return NSOrderedAscending;
+ if (viewOrder[view1] > viewOrder[view2])
+ return NSOrderedDescending;
+ return NSOrderedSame;
+}
+
void QWidgetPrivate::stackUnder_sys(QWidget *w)
{
// stackUnder
@@ -3761,37 +3755,23 @@ void QWidgetPrivate::stackUnder_sys(QWidget *w)
return;
#ifdef QT_MAC_USE_COCOA
// Do the same trick as lower_sys() and put this widget before the widget passed in.
- QMacCocoaAutoReleasePool pool;
- NSView *myview = qt_mac_nativeview_for(q);
+ NSView *myView = qt_mac_nativeview_for(q);
NSView *wView = qt_mac_nativeview_for(w);
- NSView *parentView = [myview superview];
- NSArray *tmpViews = [parentView subviews];
- NSMutableArray *subviews = [[NSMutableArray alloc] initWithCapacity:[tmpViews count]];
- [subviews addObjectsFromArray:tmpViews];
- // Implicit assumption that myViewIndex and wViewIndex is included in subviews,
- // that's why I'm not checking myViewIndex.
- NSUInteger index = 0;
- NSUInteger myViewIndex = 0;
- NSUInteger wViewIndex = 0;
- for (NSView *subview in subviews) {
- [subview removeFromSuperview];
- if (subview == myview)
- myViewIndex = index;
- else if (subview == wView)
- wViewIndex = index;
- ++index;
- }
- index = 0;
+ QHash<NSView *, int> viewOrder;
+ NSView *parentView = [myView superview];
+ NSArray *subviews = [parentView subviews];
+ NSUInteger index = 1;
+ // make a hash of view->zorderindex and make sure z-value is always odd,
+ // so that when we modify the order we create a new (even) z-value which
+ // will not interfere with others.
for (NSView *subview in subviews) {
- if (index == myViewIndex)
- continue;
- if (index == wViewIndex)
- [parentView addSubview:myview];
- [parentView addSubview:subview];
+ viewOrder.insert(subview, index * 2);
++index;
}
- [subviews release];
+ viewOrder[myView] = viewOrder[wView] - 1;
+
+ [parentView sortSubviewsUsingFunction:compareViews2StackUnder context:reinterpret_cast<void *>(&viewOrder)];
#else
QWidget *p = q->parentWidget();
if(!p || p != w->parentWidget())
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 64e3290..19c71f1 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -825,7 +825,7 @@ public:
{}
inline void detach()
- { m_widget->setGraphicsEffect(0); }
+ { m_widget->d_func()->graphicsEffect = 0; }
inline const QGraphicsItem *graphicsItem() const
{ return 0; }
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index 7dbd0c2..c284871 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -166,8 +166,6 @@ inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &
inline QPointF QBezier::pointAt(qreal t) const
{
- Q_ASSERT(t >= 0);
- Q_ASSERT(t <= 1);
#if 1
qreal a, b, c, d;
coefficients(t, a, b, c, d);
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 152b3c9..af48bcb 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -102,7 +102,9 @@ public:
bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); }
qreal determinant() const { return _m11*_m22 - _m12*_m21; }
+#ifdef QT_DEPRECATED
QT_DEPRECATED qreal det() const { return _m11*_m22 - _m12*_m21; }
+#endif
QMatrix inverted(bool *invertible = 0) const;
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 9148e4b..0f8191e 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -96,7 +96,9 @@ public:
int logicalDpiY() const { return metric(PdmDpiY); }
int physicalDpiX() const { return metric(PdmPhysicalDpiX); }
int physicalDpiY() const { return metric(PdmPhysicalDpiY); }
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numColors() const { return metric(PdmNumColors); }
+#endif
int colorCount() const { return metric(PdmNumColors); }
int depth() const { return metric(PdmDepth); }
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 4a72434..aa3b89e 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3018,10 +3018,10 @@ void QRasterPaintEngine::drawCachedGlyphs(const QPointF &p, const QTextItemInt &
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) : d->glyphCacheType;
QImageTextureGlyphCache *cache =
- (QImageTextureGlyphCache *) ti.fontEngine->glyphCache(glyphType, s->matrix);
+ (QImageTextureGlyphCache *) ti.fontEngine->glyphCache(0, glyphType, s->matrix);
if (!cache) {
cache = new QImageTextureGlyphCache(glyphType, s->matrix);
- ti.fontEngine->setGlyphCache(glyphType, cache);
+ ti.fontEngine->setGlyphCache(0, cache);
}
cache->populate(ti, glyphs, positions);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 30f8c9e..8ed126f 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1317,6 +1317,90 @@ void QPainterPrivate::updateState(QPainterState *newState)
Another workaround is to convert the paths to polygons first and then draw the
polygons instead.
+ \section1 Performance
+
+ QPainter is a rich framework that allows developers to do a great
+ variety of graphical operations, such as gradients, composition
+ modes and vector graphics. And QPainter can do this across a
+ variety of different hardware and software stacks. Naturally the
+ underlying combination of hardware and software has some
+ implications for performance, and ensuring that every single
+ operation is fast in combination with all the various combinations
+ of composition modes, brushes, clipping, transformation, etc, is
+ close to an impossible task because of the number of
+ permutations. As a compromise we have selected a subset of the
+ QPainter API and backends, were performance is guaranteed to be as
+ good as we can sensibly get it for the given combination of
+ hardware and software.
+
+ The backends we focus on as high-performance engines are:
+
+ \list
+
+ \o Raster - This backend implements all rendering in pure software
+ and is always used to render into QImages. For optimal performance
+ only use the format types QImage::Format_ARGB32_Premultiplied,
+ QImage::Format_RGB32 or QImage::Format_RGB16. Any other format,
+ including QImage::Format_ARGB32, has significantly worse
+ performance. This engine is also used by default on Windows and on
+ QWS. It can be used as default graphics system on any
+ OS/hardware/software combination by passing \c {-graphicssystem
+ raster} on the command line
+
+ \o OpenGL 2.0 (ES) - This backend is the primary backend for
+ hardware accelerated graphics. It can be run on desktop machines
+ and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0
+ specification. This includes most graphics chips produced in the
+ last couple of years. The engine can be enabled by using QPainter
+ onto a QGLWidget or by passing \c {-graphicssystem opengl} on the
+ command line when the underlying system supports it.
+
+ \o OpenVG - This backend implements the Khronos standard for 2D
+ and Vector Graphics. It is primarily for embedded devices with
+ hardware support for OpenVG. The engine can be enabled by
+ passing \c {-graphicssystem openvg} on the command line when
+ the underlying system supports it.
+
+ \endlist
+
+ These operations are:
+
+ \list
+
+ \o Simple transformations, meaning translation and scaling, pluss
+ 0, 90, 180, 270 degree rotations.
+
+ \o \c drawPixmap() in combination with simple transformations and
+ opacity with non-smooth transformation mode
+ (\c QPainter::SmoothPixmapTransform not enabled as a render hint).
+
+ \o Text drawing with regular font sizes with simple
+ transformations with solid colors using no or 8-bit antialiasing.
+
+ \o Rectangle fills with solid color, two-color linear gradients
+ and simple transforms.
+
+ \o Rectangular clipping with simple transformations and intersect
+ clip.
+
+ \o Composition Modes \c QPainter::CompositionMode_Source and
+ QPainter::CompositionMode_SourceOver
+
+ \o Rounded rectangle filling using solid color and two-color
+ linear gradients fills.
+
+ \o 3x3 patched pixmaps, via qDrawBorderPixmap.
+
+ \endlist
+
+ This list gives an indication of which features to safely use in
+ an application where performance is critical. For certain setups,
+ other operations may be fast too, but before making extensive use
+ of them, it is recommended to benchmark and verify them on the
+ system where the software will run in the end. There are also
+ cases where expensive operations are ok to use, for instance when
+ the result is cached in a QPixmap.
+
\sa QPaintDevice, QPaintEngine, {QtSvg Module}, {Basic Drawing Example},
{Drawing Utility Functions}
*/
@@ -7630,7 +7714,7 @@ start_lengthVariant:
// in the paint engines when drawing on floating point offsets
const qreal scale = painter->transform().m22();
if (scale != 0)
- yoff = qRound(yoff * scale) / scale;
+ yoff = -qRound(-yoff * scale) / scale;
}
}
}
diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp
index 6684ff7..930785b 100644
--- a/src/gui/painting/qprinterinfo_unix.cpp
+++ b/src/gui/painting/qprinterinfo_unix.cpp
@@ -75,7 +75,9 @@ private:
QString m_name;
bool m_isNull;
bool m_default;
- QList<QPrinter::PaperSize> m_paperSizes;
+ mutable bool m_mustGetPaperSizes;
+ mutable QList<QPrinter::PaperSize> m_paperSizes;
+ int m_cupsPrinterIndex;
QPrinterInfo* q_ptr;
};
@@ -838,16 +840,7 @@ QList<QPrinterInfo> QPrinterInfo::availablePrinters()
list.append(QPrinterInfo(printerName));
if (cupsPrinters[i].is_default)
list[i].d_ptr->m_default = true;
- // Find paper sizes.
- cups.setCurrentPrinter(i);
- const ppd_option_t* sizes = cups.pageSizes();
- if (sizes) {
- for (int j = 0; j < sizes->num_choices; ++j) {
- list[i].d_ptr->m_paperSizes.append(
- QPrinterInfoPrivate::string2PaperSize(
- QLatin1String(sizes->choices[j].choice)));
- }
- }
+ list[i].d_ptr->m_cupsPrinterIndex = i;
}
} else {
#endif
@@ -909,16 +902,7 @@ QPrinterInfo::QPrinterInfo(const QPrinter& printer)
if (printerName == printer.printerName()) {
if (cupsPrinters[i].is_default)
d->m_default = true;
- // Find paper sizes.
- cups.setCurrentPrinter(i);
- const ppd_option_t* sizes = cups.pageSizes();
- if (sizes) {
- for (int j = 0; j < sizes->num_choices; ++j) {
- d->m_paperSizes.append(
- QPrinterInfoPrivate::string2PaperSize(
- QLatin1String(sizes->choices[j].choice)));
- }
- }
+ d->m_cupsPrinterIndex = i;
return;
}
}
@@ -983,6 +967,26 @@ bool QPrinterInfo::isDefault() const
QList< QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
{
const Q_D(QPrinterInfo);
+ if (d->m_mustGetPaperSizes) {
+ d->m_mustGetPaperSizes = false;
+
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
+ QCUPSSupport cups;
+ if (QCUPSSupport::isAvailable()) {
+ // Find paper sizes from CUPS.
+ cups.setCurrentPrinter(d->m_cupsPrinterIndex);
+ const ppd_option_t* sizes = cups.pageSizes();
+ if (sizes) {
+ for (int j = 0; j < sizes->num_choices; ++j) {
+ d->m_paperSizes.append(
+ QPrinterInfoPrivate::string2PaperSize(
+ QLatin1String(sizes->choices[j].choice)));
+ }
+ }
+ }
+#endif
+
+ }
return d->m_paperSizes;
}
@@ -993,6 +997,8 @@ QPrinterInfoPrivate::QPrinterInfoPrivate()
{
m_isNull = true;
m_default = false;
+ m_mustGetPaperSizes = true;
+ m_cupsPrinterIndex = 0;
q_ptr = 0;
}
@@ -1001,6 +1007,8 @@ QPrinterInfoPrivate::QPrinterInfoPrivate(const QString& name)
m_name = name;
m_isNull = false;
m_default = false;
+ m_mustGetPaperSizes = true;
+ m_cupsPrinterIndex = 0;
q_ptr = 0;
}
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index 2a1be86..f99fbf6 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -116,7 +116,9 @@ public:
QRect boundingRect() const;
QVector<QRect> rects() const;
void setRects(const QRect *rect, int num);
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numRects() const;
+#endif
int rectCount() const;
const QRegion operator|(const QRegion &r) const;
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 57473d1..bb0c630 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -76,7 +76,7 @@ class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache
{
public:
QTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
- : QFontEngineGlyphCache(matrix), m_w(0), m_h(0), m_cx(0), m_cy(0), m_type(type) { }
+ : QFontEngineGlyphCache(matrix, type), m_w(0), m_h(0), m_cx(0), m_cy(0) { }
virtual ~QTextureGlyphCache() { }
@@ -98,8 +98,6 @@ public:
virtual void resizeTextureData(int width, int height) = 0;
virtual int glyphMargin() const { return 0; }
- QFontEngineGlyphCache::Type cacheType() const { return m_type; }
-
virtual void fillTexture(const Coord &coord, glyph_t glyph) = 0;
inline void createCache(int width, int height) {
@@ -121,7 +119,6 @@ protected:
int m_h; // image height
int m_cx; // current x
int m_cy; // current y
- QFontEngineGlyphCache::Type m_type;
};
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index afa3325..e10bb41 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -3375,12 +3375,28 @@ QIcon QGtkStyle::standardIconImplementation(StandardPixmap standardIcon,
/*! \reimp */
QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
{
+ Q_D(const QGtkStyle);
+
QRect r = QCleanlooksStyle::subElementRect(element, option, widget);
switch (element) {
case SE_ProgressBarLabel:
case SE_ProgressBarContents:
case SE_ProgressBarGroove:
return option->rect;
+ case SE_PushButtonContents:
+ if (!d->gtk_check_version(2, 10, 0)) {
+ GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
+ GtkBorder *border = 0;
+ d->gtk_widget_style_get(gtkButton, "inner-border", &border, NULL);
+ if (border) {
+ r = option->rect.adjusted(border->left, border->top, -border->right, -border->bottom);
+ d->gtk_border_free(border);
+ } else {
+ r = option->rect.adjusted(1, 1, -1, -1);
+ }
+ r = visualRect(option->direction, option->rect, r);
+ }
+ break;
default:
break;
}
diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp
index 22dfc62..a644a5b 100644
--- a/src/gui/styles/qgtkstyle_p.cpp
+++ b/src/gui/styles/qgtkstyle_p.cpp
@@ -158,6 +158,7 @@ Ptr_gtk_window_get_type QGtkStylePrivate::gtk_window_get_type = 0;
Ptr_gtk_widget_get_type QGtkStylePrivate::gtk_widget_get_type = 0;
Ptr_gtk_rc_get_style_by_paths QGtkStylePrivate::gtk_rc_get_style_by_paths = 0;
Ptr_gtk_check_version QGtkStylePrivate::gtk_check_version = 0;
+Ptr_gtk_border_free QGtkStylePrivate::gtk_border_free = 0;
Ptr_pango_font_description_get_size QGtkStylePrivate::pango_font_description_get_size = 0;
Ptr_pango_font_description_get_weight QGtkStylePrivate::pango_font_description_get_weight = 0;
@@ -416,6 +417,7 @@ void QGtkStylePrivate::resolveGtk() const
gtk_widget_get_type =(Ptr_gtk_widget_get_type)libgtk.resolve("gtk_widget_get_type");
gtk_rc_get_style_by_paths =(Ptr_gtk_rc_get_style_by_paths)libgtk.resolve("gtk_rc_get_style_by_paths");
gtk_check_version =(Ptr_gtk_check_version)libgtk.resolve("gtk_check_version");
+ gtk_border_free =(Ptr_gtk_border_free)libgtk.resolve("gtk_border_free");
pango_font_description_get_size = (Ptr_pango_font_description_get_size)libgtk.resolve("pango_font_description_get_size");
pango_font_description_get_weight = (Ptr_pango_font_description_get_weight)libgtk.resolve("pango_font_description_get_weight");
pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family");
diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h
index f6ab8a3..c27308f 100644
--- a/src/gui/styles/qgtkstyle_p.h
+++ b/src/gui/styles/qgtkstyle_p.h
@@ -176,6 +176,7 @@ typedef GtkWidget* (*Ptr_gtk_file_chooser_dialog_new)(const gchar *title,
typedef void (*Ptr_gtk_file_chooser_set_current_name) (GtkFileChooser *, const gchar *);
typedef gboolean (*Ptr_gtk_file_chooser_set_filename) (GtkFileChooser *chooser, const gchar *name);
typedef gint (*Ptr_gtk_dialog_run) (GtkDialog*);
+typedef void (*Ptr_gtk_border_free)(GtkBorder *);
typedef guchar* (*Ptr_gdk_pixbuf_get_pixels) (const GdkPixbuf *pixbuf);
typedef int (*Ptr_gdk_pixbuf_get_width) (const GdkPixbuf *pixbuf);
@@ -371,6 +372,7 @@ public:
static Ptr_gtk_widget_get_type gtk_widget_get_type;
static Ptr_gtk_rc_get_style_by_paths gtk_rc_get_style_by_paths;
static Ptr_gtk_check_version gtk_check_version;
+ static Ptr_gtk_border_free gtk_border_free;
static Ptr_pango_font_description_get_size pango_font_description_get_size;
static Ptr_pango_font_description_get_weight pango_font_description_get_weight;
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index dca78ca..93b517f 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -84,9 +84,6 @@ extern Q_GUI_EXPORT int qt_defaultDpiY();
const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFlags =
SkinElementFlags(SF_PointNorth | SF_StateEnabled);
-static const QByteArray propertyKeyLayouts = "layouts";
-static const QByteArray propertyKeyCurrentlayout = "currentlayout";
-
static const qreal goldenRatio = 1.618;
const layoutHeader QS60StylePrivate::m_layoutHeaders[] = {
@@ -454,9 +451,6 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const
Q_UNUSED(app)
QPalette widgetPalette = QPalette(Qt::white);
setThemePalette(&widgetPalette);
- QApplication::setPalette(widgetPalette); //calling QApplication::setPalette clears palette hash
- setThemePaletteHash(&widgetPalette);
- storeThemePalette(&widgetPalette);
}
QPalette* QS60StylePrivate::themePalette()
@@ -470,8 +464,6 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
QPalette applicationPalette = QApplication::palette();
applicationPalette.setBrush(QPalette::Window, backgroundTexture());
setThemePalette(&applicationPalette);
- QApplication::setPalette(applicationPalette);
- setThemePaletteHash(&applicationPalette);
}
void QS60StylePrivate::deleteBackground()
@@ -659,7 +651,7 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const
palette->setColor(QPalette::WindowText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
palette->setColor(QPalette::ButtonText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 20, 0));
palette->setColor(QPalette::Text,
s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
palette->setColor(QPalette::ToolTipText,
@@ -687,6 +679,10 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const
palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125));
palette->setColor(QPalette::Mid, palette->color(QPalette::Button).darker(150));
palette->setColor(QPalette::Shadow, Qt::black);
+
+ QApplication::setPalette(*palette); //calling QApplication::setPalette clears palette hash
+ setThemePaletteHash(palette);
+ storeThemePalette(palette);
}
void QS60StylePrivate::deleteThemePalette()
@@ -754,13 +750,15 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
QApplication::setPalette(widgetPalette, "QTableView");
widgetPalette = *palette;
+ widgetPalette.setColor(QPalette::Text,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 27, 0));
widgetPalette.setColor(QPalette::HighlightedText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
QApplication::setPalette(widgetPalette, "QLineEdit");
widgetPalette = *palette;
widgetPalette.setColor(QPalette::Text,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 34, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 27, 0));
widgetPalette.setColor(QPalette::HighlightedText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
QApplication::setPalette(widgetPalette, "QTextEdit");
@@ -2344,10 +2342,10 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
int retValue = -1;
switch (sh) {
case SH_Table_GridLineColor:
- retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0).rgb();
+ retValue = int(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0).rgba());
break;
case SH_GroupBox_TextLabelColor:
- retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0).rgb();
+ retValue = int(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0).rgba());
break;
case SH_ScrollBar_ScrollWhenPointerLeavesControl:
retValue = true;
@@ -2403,10 +2401,9 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
retValue = QFormLayout::WrapLongRows;
break;
default:
+ retValue = QCommonStyle::styleHint(sh, opt, widget, hret);
break;
}
- if (retValue == -1)
- retValue = QCommonStyle::styleHint(sh, opt, widget, hret);
return retValue;
}
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 5ab2308..eed66dc 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -443,7 +443,7 @@ public:
static QSize naviPaneSize();
//Checks that the current brush is transparent or has BrushStyle NoBrush,
- //so that theme graphic background can be drawn.
+ //so that theme graphic background can be drawn.
static bool canDrawThemeBackground(const QBrush &backgroundBrush);
private:
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 48b8fad..fbea644 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -62,6 +62,7 @@
#include <AknLayoutFont.h>
#include <aknutils.h>
#include <aknnavi.h>
+#include <gulicon.h>
#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
@@ -69,6 +70,7 @@ QT_BEGIN_NAMESPACE
enum TDrawType {
EDrawIcon,
+ EDrawGulIcon,
EDrawBackground,
ENoDraw
};
@@ -80,8 +82,11 @@ enum TSupportRelease {
ES60_5_0 = 0x0004,
ES60_5_1 = 0x0008,
ES60_5_2 = 0x0010,
+ ES60_3_X = ES60_3_1 | ES60_3_2,
+ // Releases before Symbian Foundation
+ ES60_PreSF = ES60_3_1 | ES60_3_2 | ES60_5_0,
// Add all new releases here
- ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2
+ ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2
};
typedef struct {
@@ -101,11 +106,12 @@ public:
static QPixmap colorSkinnedGraphics(const QS60StyleEnums::SkinParts &stylepart,
const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags);
static QColor colorValue(const TAknsItemID &colorGroup, int colorIndex);
- static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format);
+ static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize& targetSize);
static bool disabledPartGraphic(QS60StyleEnums::SkinParts &part);
static bool disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame);
static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
static QSize naviPaneSize();
+ static TAknsItemID partSpecificThemeId(int part);
private:
static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part,
@@ -115,209 +121,205 @@ private:
const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags);
static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID &centerId);
static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect);
- static void checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap);
- static void checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitmap);
- static void unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap);
- static void fallbackInfo(const QS60StyleEnums::SkinParts &stylepart, TDes& fallbackFileName, TInt& fallbackIndex);
+ static void fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex);
static bool checkSupport(const int supportedRelease);
- static TAknsItemID checkAndUpdateReleaseSpecificGraphics(int part);
// Array to match the skin ID, fallback graphics and Qt widget graphics.
static const partMapEntry m_partMap[];
};
const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
- /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_AllReleases, -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},
+ /* 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_AllReleases, -1,-1},
- /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiSliderEdit */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_AllReleases, -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},
+ /* 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},
// 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead.
- /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
- /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/
- /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/
-
- /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_AllReleases, -1,-1},
-
- /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_AllReleases, -1,-1},
-
- /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, //todo: use "normal button" from 5.0 onwards
- /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
+ /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/
+ /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/
+
+ /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_All, -1,-1},
+
+ /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_All, -1,-1},
+
+ /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_All, -1,-1},
+
+ /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_All, -1, -1},
+
+ /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_All, -1,-1},
+
+ /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_All, -1,-1},
+
+ /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_All, -1,-1},
+
+ /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_All, -1,-1},
+
+ /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_All, -1,-1},
+
+ /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_All, -1,-1},
// ToolTip graphics different in 3.1 vs. 3.2+.
- /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */
- /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6},
- /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3},
- /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4},
- /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca},
- /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7},
- /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8},
- /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9},
- /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2},
-
- /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */
+ /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6},
+ /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3},
+ /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4},
+ /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca},
+ /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7},
+ /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8},
+ /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9},
+ /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2},
+
+ /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_All, -1,-1},
// No toolbar frame for 5.0+ releases.
- /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_X, -1,-1},
// Toolbar graphics is different in 3.1/3.2 vs. 5.0
- /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/
- /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2302},
- /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2303},
- /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2304},
- /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2305},
- /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2306},
- /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2307},
- /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2308},
- /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/
+ /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/
+ /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2302},
+ /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2303},
+ /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2304},
+ /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2305},
+ /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2306},
+ /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2307},
+ /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2308},
+ /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/
// No pressed state for toolbar button in 3.1/3.2.
- /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/
- /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2622},
- /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2623},
- /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2624},
- /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2625},
- /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2626},
- /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2627},
- /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2628},
- /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2629},
+ /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/
+ /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2622},
+ /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2623},
+ /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2624},
+ /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2625},
+ /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2626},
+ /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2627},
+ /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2628},
+ /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2629},
// No inactive button graphics in 3.1/3.2
- /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/
- /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b2},
- /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b3},
- /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b4},
- /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b5},
- /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b6},
- /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b7},
- /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b8},
- /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9},
+ /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/
+ /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b2},
+ /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b3},
+ /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b4},
+ /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b5},
+ /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b6},
+ /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b7},
+ /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b8},
+ /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_X, EAknsMajorSkin, 0x21b9},
};
@@ -349,7 +351,7 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics(
}
QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics(
- const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter,
+ const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter,
QS60StylePrivate::SkinElementFlags flags)
{
QPixmap colorGraphics;
@@ -357,155 +359,118 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics(
return error ? QPixmap() : colorGraphics;
}
-void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &stylepart, TDes& fallbackFileName, TInt& fallbackIndex)
+void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex)
{
- switch(stylepart) {
+ switch(stylePart) {
case QS60StyleEnums::SP_QgnGrafBarWait:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_wait_1;
break;
case QS60StyleEnums::SP_QgnGrafBarFrameCenter:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_frame_center;
break;
case QS60StyleEnums::SP_QgnGrafBarFrameSideL:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_l;
break;
case QS60StyleEnums::SP_QgnGrafBarFrameSideR:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_r;
break;
case QS60StyleEnums::SP_QgnGrafBarProgress:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_progress;
break;
case QS60StyleEnums::SP_QgnGrafTabActiveL:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_active_l;
break;
case QS60StyleEnums::SP_QgnGrafTabActiveM:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_active_m;
break;
case QS60StyleEnums::SP_QgnGrafTabActiveR:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_active_r;
break;
case QS60StyleEnums::SP_QgnGrafTabPassiveL:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_passive_l;
break;
case QS60StyleEnums::SP_QgnGrafTabPassiveM:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_passive_m;
break;
case QS60StyleEnums::SP_QgnGrafTabPassiveR:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_passive_r;
break;
case QS60StyleEnums::SP_QgnIndiCheckboxOff:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_checkbox_off;
break;
case QS60StyleEnums::SP_QgnIndiCheckboxOn:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_checkbox_on;
break;
case QS60StyleEnums::SP_QgnIndiHlColSuper:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x4456; /* EMbmAvkonQgn_indi_hl_col_super */
break;
case QS60StyleEnums::SP_QgnIndiHlExpSuper:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x4458; /* EMbmAvkonQgn_indi_hl_exp_super */
break;
case QS60StyleEnums::SP_QgnIndiHlLineBranch:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x445A; /* EMbmAvkonQgn_indi_hl_line_branch */
break;
case QS60StyleEnums::SP_QgnIndiHlLineEnd:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x445C; /* EMbmAvkonQgn_indi_hl_line_end */
break;
case QS60StyleEnums::SP_QgnIndiHlLineStraight:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x445E; /* EMbmAvkonQgn_indi_hl_line_straight */
break;
case QS60StyleEnums::SP_QgnIndiMarkedAdd:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_marked_add;
break;
case QS60StyleEnums::SP_QgnIndiNaviArrowLeft:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_left;
break;
case QS60StyleEnums::SP_QgnIndiNaviArrowRight:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_right;
break;
case QS60StyleEnums::SP_QgnIndiRadiobuttOff:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_radiobutt_off;
break;
case QS60StyleEnums::SP_QgnIndiRadiobuttOn:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_radiobutt_on;
break;
case QS60StyleEnums::SP_QgnIndiSliderEdit:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_slider_edit;
break;
case QS60StyleEnums::SP_QgnIndiSubMenu:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_submenu;
break;
case QS60StyleEnums::SP_QgnNoteErased:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_erased;
break;
case QS60StyleEnums::SP_QgnNoteError:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_error;
break;
case QS60StyleEnums::SP_QgnNoteInfo:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_info;
break;
case QS60StyleEnums::SP_QgnNoteOk:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_ok;
break;
case QS60StyleEnums::SP_QgnNoteQuery:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_query;
break;
case QS60StyleEnums::SP_QgnNoteWarning:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_warning;
break;
case QS60StyleEnums::SP_QgnPropFileSmall:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_file_small;
break;
case QS60StyleEnums::SP_QgnPropFolderCurrent:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_folder_current;
break;
case QS60StyleEnums::SP_QgnPropFolderSmall:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_folder_small;
break;
case QS60StyleEnums::SP_QgnPropFolderSmallNew:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_folder_small_new;
break;
case QS60StyleEnums::SP_QgnPropPhoneMemcLarge:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_phone_memc_large;
break;
default:
- fallbackFileName = KNullDesC();
fallbackIndex = -1;
break;
}
@@ -521,8 +486,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX(
TInt fallbackGraphicID = -1;
HBufC* iconFile = HBufC::NewLC( KMaxFileName );
- TPtr fileNamePtr = iconFile->Des();
- fallbackInfo(stylepart, fileNamePtr, fallbackGraphicID);
+ fallbackInfo(stylepart, fallbackGraphicID);
TAknsItemID colorGroup = KAknsIIDQsnIconColors;
TRgb defaultColor = KRgbBlack;
@@ -543,10 +507,18 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX(
fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
AknsUtils::CreateColorIconLC(
- skinInstance, skinId, colorGroup, colorIndex, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID, defaultColor);
- User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved));
- User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved));
- QPixmap result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode()));
+ skinInstance,
+ skinId,
+ colorGroup,
+ colorIndex,
+ icon,
+ iconMask,
+ AknIconUtils::AvkonIconFileName(),
+ fallbackGraphicID,
+ fallbackGraphicsMaskID,
+ defaultColor);
+
+ QPixmap result = fromFbsBitmap(icon, iconMask, flags, targetSize);
CleanupStack::PopAndDestroy(3); //icon, iconMask, iconFile
return result;
}
@@ -566,55 +538,43 @@ struct QAutoFbsBitmapHeapLock
CFbsBitmap* mBmp;
};
-QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format)
+QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize &targetSize)
{
Q_ASSERT(icon);
- const TSize iconSize = icon->SizeInPixels();
- const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, icon->DisplayMode());
- const int iconBytesCount = iconBytesPerLine * iconSize.iHeight;
- QImage iconImage(qt_TSize2QSize(iconSize), format);
- if (iconImage.isNull())
- return QPixmap();
+ AknIconUtils::DisableCompression(icon);
+ TInt error = AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved);
- checkAndUnCompressBitmap(icon);
- if (!icon) //checkAndUnCompressBitmap might set icon to NULL
+ if (mask && !error) {
+ AknIconUtils::DisableCompression(mask);
+ error = AknIconUtils::SetSize(mask, targetSize, EAspectRatioNotPreserved);
+ }
+ if (error)
return QPixmap();
- icon->LockHeap();
- const uchar *const iconBytes = (uchar*)icon->DataAddress();
- // The icon data needs to be copied, since the color format will be
- // automatically converted to Format_ARGB32 when setAlphaChannel is called.
- memcpy(iconImage.bits(), iconBytes, iconBytesCount);
- icon->UnlockHeap();
- if (mask) {
- checkAndUnCompressBitmap(mask);
- if (mask) { //checkAndUnCompressBitmap might set mask to NULL
- const TSize maskSize = icon->SizeInPixels();
- const int maskBytesPerLine = CFbsBitmap::ScanLineLength(maskSize.iWidth, mask->DisplayMode());
- // heap lock object required because QImage ctor might throw
- QAutoFbsBitmapHeapLock maskHeapLock(mask);
- const uchar *const maskBytes = (uchar *)mask->DataAddress();
- // Since no other bitmap should be locked, we can just "borrow" the mask data for setAlphaChannel
- const QImage maskImage(maskBytes, maskSize.iWidth, maskSize.iHeight, maskBytesPerLine, QImage::Format_Indexed8);
- if (!maskImage.isNull())
- iconImage.setAlphaChannel(maskImage);
+ QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(icon);
+ if (mask)
+ pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask));
+
+ if ((flags & QS60StylePrivate::SF_PointEast) ||
+ (flags & QS60StylePrivate::SF_PointSouth) ||
+ (flags & QS60StylePrivate::SF_PointWest)) {
+ QImage iconImage = pixmap.toImage();
+ QTransform imageTransform;
+ if (flags & QS60StylePrivate::SF_PointEast) {
+ imageTransform.rotate(90);
+ } else if (flags & QS60StylePrivate::SF_PointSouth) {
+ imageTransform.rotate(180);
+ iconImage = iconImage.transformed(imageTransform);
+ } else if (flags & QS60StylePrivate::SF_PointWest) {
+ imageTransform.rotate(270);
}
- }
+ if (imageTransform.isRotating())
+ iconImage = iconImage.transformed(imageTransform);
- QTransform imageTransform;
- if (flags & QS60StylePrivate::SF_PointEast) {
- imageTransform.rotate(90);
- } else if (flags & QS60StylePrivate::SF_PointSouth) {
- imageTransform.rotate(180);
- iconImage = iconImage.transformed(imageTransform);
- } else if (flags & QS60StylePrivate::SF_PointWest) {
- imageTransform.rotate(270);
+ pixmap = QPixmap::fromImage(iconImage);
}
- if (imageTransform.isRotating())
- iconImage = iconImage.transformed(imageTransform);
-
- return QPixmap::fromImage(iconImage);
+ return pixmap;
}
bool QS60StylePrivate::isTouchSupported()
@@ -645,7 +605,7 @@ QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
}
QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
- QS60StyleEnums::SkinParts part, const QSize &size,
+ QS60StyleEnums::SkinParts part, const QSize &size,
QS60StylePrivate::SkinElementFlags flags)
{
// this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
@@ -653,7 +613,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
return QPixmap();
// Check release support and change part, if necessary.
- const TAknsItemID skinId = checkAndUpdateReleaseSpecificGraphics((int)part);
+ const TAknsItemID skinId = partSpecificThemeId((int)part);
const int stylepartIndex = (int)part;
const TDrawType drawType = m_partMap[stylepartIndex].drawType;
Q_ASSERT(drawType != ENoDraw);
@@ -667,24 +627,34 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
QPixmap result;
switch (drawType) {
+ case EDrawGulIcon: {
+ CGulIcon* icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), skinId, EFalse );
+ if (icon)
+ result = fromFbsBitmap(icon->Bitmap(), icon->Mask(), flags, targetSize);
+ delete icon;
+ break;
+ }
case EDrawIcon: {
TInt fallbackGraphicID = -1;
- HBufC* iconFile = HBufC::NewLC( KMaxFileName );
- TPtr fileNamePtr = iconFile->Des();
- fallbackInfo(part, fileNamePtr, fallbackGraphicID);
- // todo: could we instead use AknIconUtils::AvkonIconFileName(); to avoid allocating each time?
+ fallbackInfo(part, fallbackGraphicID);
CFbsBitmap *icon = 0;
CFbsBitmap *iconMask = 0;
const TInt fallbackGraphicsMaskID =
fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
- // QS60WindowSurface::unlockBitmapHeap();
- AknsUtils::CreateIconLC(skinInstance, skinId, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID);
- User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved));
- User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved));
- result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode()));
- CleanupStack::PopAndDestroy(3); // iconMask, icon, iconFile
- // QS60WindowSurface::lockBitmapHeap();
+
+ AknsUtils::CreateIconL(
+ skinInstance,
+ skinId,
+ icon,
+ iconMask,
+ AknIconUtils::AvkonIconFileName(),
+ fallbackGraphicID ,
+ fallbackGraphicsMaskID);
+
+ result = fromFbsBitmap(icon, iconMask, flags, targetSize);
+ delete icon;
+ delete iconMask;
break;
}
case EDrawBackground: {
@@ -715,13 +685,16 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
KAknsDrawParamDefault | KAknsDrawParamRGBOnly);
if (drawn)
- result = fromFbsBitmap(background, NULL, flags, QImage::Format_RGB32);
+ result = fromFbsBitmap(background, NULL, flags, targetSize);
+ // if drawing fails in skin server, just ignore the background (probably OOM occured)
CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext
// QS60WindowSurface::lockBitmapHeap();
break;
}
}
+ if (!result)
+ result = QPixmap();
return result;
}
@@ -755,24 +728,46 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr
User::LeaveIfError(bitmapDev->CreateContext(bitmapGc));
CleanupStack::PushL(bitmapGc);
+#ifndef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
frame->LockHeap();
memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4); // 4: argb bytes
frame->UnlockHeap();
+#endif
const TRect outerRect(TPoint(0, 0), targetSize);
const TRect innerRect = innerRectFromElement(frameElement, outerRect);
TAknsItemID frameSkinID, centerSkinID;
- frameSkinID = centerSkinID = checkAndUpdateReleaseSpecificGraphics(QS60StylePrivate::m_frameElementsData[frameElement].center);
+ frameSkinID = centerSkinID = partSpecificThemeId(QS60StylePrivate::m_frameElementsData[frameElement].center);
frameIdAndCenterId(frameElement, frameSkinID, centerSkinID);
- const TBool drawn = AknsDrawUtils::DrawFrame( skinInstance,
- *bitmapGc, outerRect, innerRect,
- frameSkinID, centerSkinID,
- drawParam );
+
+ TBool drawn = AknsDrawUtils::DrawFrame(
+ skinInstance,
+ *bitmapGc,
+ outerRect,
+ innerRect,
+ frameSkinID,
+ centerSkinID,
+ drawParam );
if (S60->supportsPremultipliedAlpha) {
- if (drawn)
- result = fromFbsBitmap(frame, NULL, flags, QImage::Format_ARGB32_Premultiplied);
+ if (drawn) {
+ result = fromFbsBitmap(frame, NULL, flags, targetSize);
+ } else {
+ // Drawing might fail due to OOM (we can do nothing about that),
+ // or due to skin item not being available.
+ // If the latter occurs, lets try switch to non-release specific items (if available)
+ // and re-try the drawing.
+ frameSkinID = centerSkinID = m_partMap[(int)QS60StylePrivate::m_frameElementsData[frameElement].center].skinID;
+ frameIdAndCenterId(frameElement, frameSkinID, centerSkinID);
+ drawn = AknsDrawUtils::DrawFrame( skinInstance,
+ *bitmapGc, outerRect, innerRect,
+ frameSkinID, centerSkinID,
+ drawParam );
+ // in case drawing fails, even after using default graphics, ignore the error
+ if (drawn)
+ result = fromFbsBitmap(frame, NULL, flags, targetSize);
+ }
} else {
TDisplayMode maskDepth = EGray2;
// Query the skin item for possible frame graphics mask details.
@@ -802,11 +797,12 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr
maskBitGc->Clear();
maskBitGc->SetBrushStyle(CGraphicsContext::ENullBrush);
- AknsDrawUtils::DrawFrame(skinInstance,
+ drawn = AknsDrawUtils::DrawFrame(skinInstance,
*maskBitGc, outerRect, innerRect,
frameSkinID, centerSkinID,
KAknsSDMAlphaOnly |KAknsDrawParamNoClearUnderImage);
- result = fromFbsBitmap(frame, frameMask, flags, QImage::Format_ARGB32);
+ if (drawn)
+ result = fromFbsBitmap(frame, frameMask, flags, targetSize);
}
CleanupStack::PopAndDestroy(3, frameMask);
}
@@ -880,10 +876,12 @@ bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease)
const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
return ( (currentRelease == QSysInfo::SV_S60_3_1 && supportedRelease & ES60_3_1) ||
(currentRelease == QSysInfo::SV_S60_3_2 && supportedRelease & ES60_3_2) ||
- (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0));
+ (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0) ||
+ (currentRelease == QSysInfo::SV_S60_5_1 && supportedRelease & ES60_5_1) ||
+ (currentRelease == QSysInfo::SV_S60_5_2 && supportedRelease & ES60_5_2));
}
-TAknsItemID QS60StyleModeSpecifics::checkAndUpdateReleaseSpecificGraphics(int part)
+TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part)
{
TAknsItemID newSkinId;
if (!checkSupport(m_partMap[(int)part].supportInfo))
@@ -893,33 +891,6 @@ TAknsItemID QS60StyleModeSpecifics::checkAndUpdateReleaseSpecificGraphics(int pa
return newSkinId;
}
-void QS60StyleModeSpecifics::checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitmap)
-{
- TRAPD(error, checkAndUnCompressBitmapL(aOriginalBitmap));
- if (error)
- aOriginalBitmap = NULL;
-}
-
-void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap)
-{
- const TSize iconSize = aOriginalBitmap->SizeInPixels();
- const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, aOriginalBitmap->DisplayMode());
- const int iconBytesCount = iconBytesPerLine * iconSize.iHeight;
- if (aOriginalBitmap->IsCompressedInRAM() || aOriginalBitmap->Header().iBitmapSize < iconBytesCount) {
- const TSize iconSize(aOriginalBitmap->SizeInPixels().iWidth,
- aOriginalBitmap->SizeInPixels().iHeight);
- CFbsBitmap* uncompressedBitmap = new (ELeave) CFbsBitmap();
- CleanupStack::PushL(uncompressedBitmap);
- User::LeaveIfError(uncompressedBitmap->Create(iconSize,
- aOriginalBitmap->DisplayMode()));
- unCompressBitmapL(iconSize, uncompressedBitmap, aOriginalBitmap);
- CleanupStack::Pop(uncompressedBitmap);
- User::LeaveIfError(aOriginalBitmap->Duplicate(
- uncompressedBitmap->Handle()));
- delete uncompressedBitmap;
- }
-}
-
QFont QS60StylePrivate::s60Font_specific(
QS60StyleEnums::FontCategories fontCategory, int pointSize)
{
@@ -1167,148 +1138,6 @@ QPixmap QS60StylePrivate::backgroundTexture()
return *m_background;
}
-// If the public SDK returns compressed images, please let us also uncompress those!
-void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap)
-{
- if (!aSrcBitmap)
- User::Leave(KErrArgument);
- if (!aTrgBitmap)
- User::Leave(KErrArgument);
-
- // Note! aSrcBitmap->IsCompressedInRAM() is always ETrue, since this method is called only if that applies!
- // Extra note! this function is also being used when bitmaps appear to be compressed (because DataSize is too small)
- // even when they pretend they are not. Assert removed.
-// ASSERT(aSrcBitmap->IsCompressedInRAM());
-
- TDisplayMode displayMode = aSrcBitmap->DisplayMode();
-
- if (displayMode != aTrgBitmap->DisplayMode())
- User::Leave(KErrArgument);
-
- const TSize trgSize = aTrgBitmap->SizeInPixels();
- const TSize srcSize = aSrcBitmap->SizeInPixels();
-
- // calculate the valid drawing area
- TRect drawRect = aTrgRect;
- drawRect.Intersection(TRect(TPoint(0, 0), trgSize));
-
- if (drawRect.IsEmpty())
- return;
-
- CFbsBitmap* realSource = new (ELeave) CFbsBitmap();
- CleanupStack::PushL(realSource);
- User::LeaveIfError(realSource->Create(srcSize, displayMode));
- CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(realSource);
- CleanupStack::PushL(dev);
- CFbsBitGc* gc = NULL;
- User::LeaveIfError(dev->CreateContext(gc));
- CleanupStack::PushL(gc);
- gc->BitBlt(TPoint(0, 0), aSrcBitmap);
- CleanupStack::PopAndDestroy(2); // dev, gc
-
- // Heap lock for FBServ large chunk is only needed with large bitmaps.
- if (realSource->IsLargeBitmap() || aTrgBitmap->IsLargeBitmap()) {
- aTrgBitmap->LockHeapLC(ETrue); // fbsheaplock
- } else {
- CleanupStack::PushL((TAny*) NULL);
- }
-
- TUint32* srcAddress = realSource->DataAddress();
- TUint32* trgAddress = aTrgBitmap->DataAddress();
-
- const TInt xSkip = (srcSize.iWidth << 8) / aTrgRect.Width();
- const TInt ySkip = (srcSize.iHeight << 8) / aTrgRect.Height();
-
- const TInt drawWidth = drawRect.Width();
- const TInt drawHeight = drawRect.Height();
-
- const TRect offsetRect(aTrgRect.iTl, drawRect.iTl);
- const TInt yPosOffset = ySkip * offsetRect.Height();
- const TInt xPosOffset = xSkip * offsetRect.Width();
-
- if ((displayMode == EGray256) || (displayMode == EColor256)) {
- const TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth,
- displayMode);
- const TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth,
- displayMode);
-
- TUint8* trgAddress8 = reinterpret_cast<TUint8*> (trgAddress);
-
- TInt yPos = yPosOffset;
- // skip left and top margins in the beginning
- trgAddress8 += trgScanLen8 * drawRect.iTl.iY + drawRect.iTl.iX;
-
- for (TInt y = 0; y < drawHeight; y++) {
- const TUint8* srcAddress8 = reinterpret_cast<const TUint8*> (srcAddress)
- + (srcScanLen8 * (yPos >> 8));
-
- TInt xPos = xPosOffset;
- for (TInt x = 0; x < drawWidth; x++) {
- *(trgAddress8++) = srcAddress8[xPos >> 8];
- xPos += xSkip;
- }
-
- yPos += ySkip;
-
- trgAddress8 += trgScanLen8 - drawWidth;
- }
- } else if (displayMode == EColor4K || displayMode == EColor64K) {
- const TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth,
- displayMode) >>1;
- const TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth,
- displayMode) >>1;
-
- TUint16* trgAddress16 = reinterpret_cast<TUint16*> (trgAddress);
-
- TInt yPos = yPosOffset;
- // skip left and top margins in the beginning
- trgAddress16 += trgScanLen16 * drawRect.iTl.iY + drawRect.iTl.iX;
-
- for (TInt y = 0; y < drawHeight; y++) {
- const TUint16* srcAddress16 = reinterpret_cast<const TUint16*> (srcAddress)
- + (srcScanLen16 * (yPos >> 8));
-
- TInt xPos = xPosOffset;
- for (TInt x = 0; x < drawWidth; x++) {
- *(trgAddress16++) = srcAddress16[xPos >> 8];
- xPos += xSkip;
- }
-
- yPos += ySkip;
-
- trgAddress16 += trgScanLen16 - drawWidth;
- }
- } else if (displayMode == EColor16MU || displayMode == EColor16MA) {
- const TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth,
- displayMode) >>2;
- const TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth,
- displayMode) >>2;
-
- TUint32* trgAddress32 = reinterpret_cast<TUint32*> (trgAddress);
-
- TInt yPos = yPosOffset;
- // skip left and top margins in the beginning
- trgAddress32 += trgScanLen32 * drawRect.iTl.iY + drawRect.iTl.iX;
-
- for (TInt y = 0; y < drawHeight; y++) {
- const TUint32* srcAddress32 = reinterpret_cast<const TUint32*> (srcAddress)
- + (srcScanLen32 * (yPos >> 8));
-
- TInt xPos = xPosOffset;
- for (TInt x = 0; x < drawWidth; x++) {
- *(trgAddress32++) = srcAddress32[xPos >> 8];
- xPos += xSkip;
- }
-
- yPos += ySkip;
-
- trgAddress32 += trgScanLen32 - drawWidth;
- }
- } else { User::Leave(KErrUnknown);}
-
- CleanupStack::PopAndDestroy(2); // fbsheaplock, realSource
-}
-
QSize QS60StylePrivate::screenSize()
{
const TSize screenSize = QS60Data::screenDevice()->SizeInPixels();
diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri
index 88a2cce..7e5c55a 100644
--- a/src/gui/styles/styles.pri
+++ b/src/gui/styles/styles.pri
@@ -168,7 +168,7 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) {
SOURCES += styles/qs60style.cpp
symbian {
SOURCES += styles/qs60style_s60.cpp
- LIBS += -laknicon -laknskins -laknskinsrv -lfontutils
+ LIBS += -laknicon -laknskins -laknskinsrv -lfontutils -legul
} else {
SOURCES += styles/qs60style_simulated.cpp
RESOURCES += styles/qstyle_s60_simulated.qrc
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 27fc3c1..d364025 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -185,22 +185,11 @@ QFontEngine::QFontEngine()
QFontEngine::~QFontEngine()
{
- for (GlyphPointerHash::const_iterator it = m_glyphPointerHash.constBegin(),
- end = m_glyphPointerHash.constEnd(); it != end; ++it) {
- for (QList<QFontEngineGlyphCache*>::const_iterator it2 = it.value().constBegin(),
- end2 = it.value().constEnd(); it2 != end2; ++it2) {
- delete *it2;
- }
- }
- m_glyphPointerHash.clear();
- for (GlyphIntHash::const_iterator it = m_glyphIntHash.constBegin(),
- end = m_glyphIntHash.constEnd(); it != end; ++it) {
- for (QList<QFontEngineGlyphCache*>::const_iterator it2 = it.value().constBegin(),
- end2 = it.value().constEnd(); it2 != end2; ++it2) {
- delete *it2;
- }
+ for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(),
+ end = m_glyphCaches.constEnd(); it != end; ++it) {
+ delete it->cache;
}
- m_glyphIntHash.clear();
+ m_glyphCaches.clear();
qHBFreeFace(hbFace);
}
@@ -713,103 +702,30 @@ QByteArray QFontEngine::getSfntTable(uint tag) const
return table;
}
-void QFontEngine::expireGlyphCache()
-{
- if (m_glyphCacheQueue.count() > 10) { // hold only 10 caches in memory.
- QFontEngineGlyphCache *old = m_glyphCacheQueue.takeFirst();
- // remove the value from either of our hashes
- for (GlyphPointerHash::iterator i = m_glyphPointerHash.begin(); i != m_glyphPointerHash.end(); ++i) {
- QList<QFontEngineGlyphCache *> list = i.value();
- if (list.removeAll(old)) {
- if (list.isEmpty())
- m_glyphPointerHash.remove(i.key());
- else
- m_glyphPointerHash.insert(i.key(), list);
- break;
- }
- }
- for (GlyphIntHash::iterator i = m_glyphIntHash.begin(); i != m_glyphIntHash.end(); ++i) {
- QList<QFontEngineGlyphCache *> list = i.value();
- if (list.removeAll(old)) {
- if (list.isEmpty())
- m_glyphIntHash.remove(i.key());
- else
- m_glyphIntHash.insert(i.key(), list);
- break;
- }
- }
- delete old;
- }
-}
-
void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data)
{
Q_ASSERT(data);
- QList<QFontEngineGlyphCache*> items = m_glyphPointerHash.value(key);
-
- for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
- QFontEngineGlyphCache *c = *it;
- if (qtransform_equals_no_translate(c->m_transform, data->m_transform)) {
- if (c == data)
- return;
- items.removeAll(c);
- delete c;
- break;
- }
- }
- items.append(data);
- m_glyphPointerHash.insert(key, items);
- m_glyphCacheQueue.append(data);
- expireGlyphCache();
-}
+ GlyphCacheEntry entry = { key, data };
+ if (m_glyphCaches.contains(entry))
+ return;
-void QFontEngine::setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data)
-{
- Q_ASSERT(data);
- QList<QFontEngineGlyphCache*> items = m_glyphIntHash.value(key);
-
- for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
- QFontEngineGlyphCache *c = *it;
- if (qtransform_equals_no_translate(c->m_transform, data->m_transform)) {
- if (c == data)
- return;
- items.removeAll(c);
- delete c;
- break;
- }
- }
- items.append(data);
- m_glyphIntHash.insert(key, items);
+ // Limit the glyph caches to 4. This covers all 90 degree rotations and limits
+ // memory use when there is continous or random rotation
+ if (m_glyphCaches.size() == 4)
+ delete m_glyphCaches.takeLast().cache;
- m_glyphCacheQueue.append(data);
- expireGlyphCache();
-}
+ m_glyphCaches.push_front(entry);
-QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, const QTransform &transform) const
-{
- QList<QFontEngineGlyphCache*> items = m_glyphPointerHash.value(key);
-
- for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
- QFontEngineGlyphCache *c = *it;
- if (qtransform_equals_no_translate(c->m_transform, transform)) {
- m_glyphCacheQueue.removeAll(c); // last used, move it up
- m_glyphCacheQueue.append(c);
- return c;
- }
- }
- return 0;
}
-QFontEngineGlyphCache *QFontEngine::glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const
+QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const
{
- QList<QFontEngineGlyphCache*> items = m_glyphIntHash.value(key);
-
- for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
- QFontEngineGlyphCache *c = *it;
- if (qtransform_equals_no_translate(c->m_transform, transform)) {
- m_glyphCacheQueue.removeAll(c); // last used, move it up
- m_glyphCacheQueue.append(c);
+ for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(), end = m_glyphCaches.constEnd(); it != end; ++it) {
+ QFontEngineGlyphCache *c = it->cache;
+ if (key == it->context
+ && type == c->cacheType()
+ && qtransform_equals_no_translate(c->m_transform, transform)) {
return c;
}
}
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 728c344..a9883b4 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -56,6 +56,7 @@
#include "QtCore/qglobal.h"
#include "QtCore/qatomic.h"
#include <QtCore/qvarlengtharray.h>
+#include <QtCore/QLinkedList>
#include "private/qtextengine_p.h"
#include "private/qfont_p.h"
@@ -219,9 +220,7 @@ public:
virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
void setGlyphCache(void *key, QFontEngineGlyphCache *data);
- void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data);
- QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform) const;
- QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const;
+ QFontEngineGlyphCache *glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const;
static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize);
static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode);
@@ -254,12 +253,13 @@ protected:
static const QVector<QRgb> &grayPalette();
private:
- /// remove old entries from the glyph cache. Helper method for the setGlyphCache ones.
- void expireGlyphCache();
+ struct GlyphCacheEntry {
+ void *context;
+ QFontEngineGlyphCache *cache;
+ bool operator==(const GlyphCacheEntry &other) { return context == other.context && cache == other.cache; }
+ };
- GlyphPointerHash m_glyphPointerHash;
- GlyphIntHash m_glyphIntHash;
- mutable QList<QFontEngineGlyphCache*> m_glyphCacheQueue;
+ mutable QLinkedList<GlyphCacheEntry> m_glyphCaches;
};
inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2)
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index e04f4ac..c6112ba 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -75,17 +75,20 @@ QT_BEGIN_NAMESPACE
class QFontEngineGlyphCache
{
public:
- QFontEngineGlyphCache(const QTransform &matrix) : m_transform(matrix) { }
-
enum Type {
Raster_RGBMask,
Raster_A8,
Raster_Mono
};
+ QFontEngineGlyphCache(const QTransform &matrix, Type type) : m_transform(matrix), m_type(type) { }
+
virtual ~QFontEngineGlyphCache() { }
+ Type cacheType() const { return m_type; }
+
QTransform m_transform;
+ QFontEngineGlyphCache::Type m_type;
};
typedef QHash<void *, QList<QFontEngineGlyphCache *> > GlyphPointerHash;
typedef QHash<int, QList<QFontEngineGlyphCache *> > GlyphIntHash;
diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp
index 1890d56..c6932de 100644
--- a/src/gui/util/qdesktopservices_s60.cpp
+++ b/src/gui/util/qdesktopservices_s60.cpp
@@ -41,7 +41,7 @@
// This flag changes the implementation to use S60 CDcoumentHandler
// instead of apparch when opening the files
-#undef USE_DOCUMENTHANDLER
+#define USE_DOCUMENTHANDLER
#include <qcoreapplication.h>
#include <qdir.h>
@@ -58,12 +58,14 @@
#include <rsendasmessage.h> // RSendAsMessage
#ifdef Q_WS_S60
-# include <pathinfo.h> // PathInfo
+# include <pathinfo.h> // PathInfo
# ifdef USE_DOCUMENTHANDLER
-# include <documenthandler.h> // CDocumentHandler
+# include <documenthandler.h> // CDocumentHandler
+# include <aknserverapp.h>
# endif
-#elif defined(USE_DOCUMENTHANDLER)
-# error CDocumentHandler requires support for S60
+#else
+# warning CDocumentHandler requires support for S60
+# undef USE_DOCUMENTHANDLER // Fallback to RApaLsSession based implementation
#endif
QT_BEGIN_NAMESPACE
@@ -95,6 +97,42 @@ private:
R* mPtr;
};
+#ifdef USE_DOCUMENTHANDLER
+class QS60DocumentHandler : public MAknServerAppExitObserver
+{
+public:
+ QS60DocumentHandler() :docHandler(0) {}
+
+ ~QS60DocumentHandler() {
+ delete docHandler;
+ }
+
+ CDocumentHandler& documentHandler() {
+ // In case user calls openUrl twice subsequently, before the first embedded app is closed
+ // we use the same CDocumentHandler instance. Using same instance makes sure the first
+ // launched embedded app is closed and latter one gets embedded to our app.
+ // Using different instance would help only theoretically since user cannot interact with
+ // several embedded apps at the same time.
+ if(!docHandler) {
+ QT_TRAP_THROWING(docHandler = CDocumentHandler::NewL());
+ docHandler->SetExitObserver(this);
+ }
+ return *docHandler;
+ }
+
+private: // From MAknServerAppExitObserver
+ void HandleServerAppExit(TInt /*aReason*/) {
+ delete docHandler;
+ docHandler = 0;
+ }
+
+private:
+ CDocumentHandler* docHandler;
+};
+Q_GLOBAL_STATIC(QS60DocumentHandler, qt_s60_documenthandler);
+#endif
+
+
static void handleMailtoSchemeLX(const QUrl &url)
{
// this function has many intermingled leaves and throws. Qt and Symbian objects do not have
@@ -264,21 +302,9 @@ static void openDocumentL(const TDesC& aUrl)
CleanupStack::PopAndDestroy(); // appArcSession
#else
// This is an alternative way to launch app associated to MIME type
- // CDocumentHandler would support opening apps in embedded mode,
- // but our Qt application window group seems to always get switched on top of embedded one
- // -> Cannot use menus etc of embedded app -> used
-
- CDocumentHandler* docHandler = CDocumentHandler::NewLC();
+ // CDocumentHandler also supports opening apps in embedded mode.
TDataType temp;
- //Standalone file opening fails for some file-types at least in S60 3.1 emulator
- //For example .txt file fails with KErrAlreadyInUse and music files with KERN-EXEC 0
- //Workaround is to use OpenFileEmbeddedL
- //docHandler->OpenFileL(aUrl, temp);
-
- // Opening file with CDocumentHandler will leave if file does not exist
- // Leave is trapped in openDocument and false returned to user.
- docHandler->OpenFileEmbeddedL(aUrl, temp);
- CleanupStack::PopAndDestroy(docHandler);
+ qt_s60_documenthandler()->documentHandler().OpenFileEmbeddedL(aUrl, temp);
#endif
}
@@ -349,7 +375,7 @@ QString QDesktopServices::storageLocation(StandardLocation type)
case DesktopLocation:
qWarning("No desktop concept in Symbian OS");
// But lets still use some feasible default
- path.Append(writableDataRoot());
+ path.Append(writableDataRoot());
break;
case DocumentsLocation:
path.Append(writableDataRoot());
@@ -380,7 +406,7 @@ QString QDesktopServices::storageLocation(StandardLocation type)
#endif
break;
case TempLocation:
- return QDir::tempPath();
+ return QDir::tempPath();
break;
case HomeLocation:
path.Append(writableDataRoot());
@@ -394,10 +420,10 @@ QString QDesktopServices::storageLocation(StandardLocation type)
CEikonEnv::Static()->FsSession().PrivatePath(path);
path.Insert(0, writableExeDrive().Name());
path.Append(KCacheSubDir);
- break;
+ break;
default:
// Lets use feasible default
- path.Append(writableDataRoot());
+ path.Append(writableDataRoot());
break;
}
diff --git a/src/gui/util/qsystemtrayicon.cpp b/src/gui/util/qsystemtrayicon.cpp
index c6ea00f..6f2b501 100644
--- a/src/gui/util/qsystemtrayicon.cpp
+++ b/src/gui/util/qsystemtrayicon.cpp
@@ -380,6 +380,9 @@ bool QSystemTrayIcon::supportsMessages()
On Windows, the \a millisecondsTimeoutHint is usually ignored by the system
when the application has focus.
+ On Mac OS X, the Growl notification system must be installed for this function to
+ display messages.
+
\sa show() supportsMessages()
*/
void QSystemTrayIcon::showMessage(const QString& title, const QString& msg,
diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm
index b74ca85..93295a7 100644
--- a/src/gui/util/qsystemtrayicon_mac.mm
+++ b/src/gui/util/qsystemtrayicon_mac.mm
@@ -314,8 +314,22 @@ QT_END_NAMESPACE
{
Q_UNUSED(notification);
down = NO;
+
+ if( ![self icon]->icon().isNull() ) {
+#ifndef QT_MAC_USE_COCOA
+ const short scale = GetMBarHeight()-4;
+#else
+ CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
+ const short scale = hgt - 4;
+#endif
+ NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage([self icon]->icon().pixmap(QSize(scale, scale))));
+ [self setImage: nsimage];
+ [nsimage release];
+ }
+
if([self icon]->contextMenu())
[self icon]->contextMenu()->hide();
+
[self setNeedsDisplay:YES];
}
@@ -327,6 +341,20 @@ QT_END_NAMESPACE
[self icon]->contextMenu()->hide();
[self setNeedsDisplay:YES];
+#ifndef QT_MAC_USE_COCOA
+ const short scale = GetMBarHeight()-4;
+#else
+ CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
+ const short scale = hgt - 4;
+#endif
+
+ if( down && ![self icon]->icon().isNull() ) {
+ NSImage *nsaltimage = static_cast<NSImage *>(qt_mac_create_nsimage([self icon]->icon().pixmap(QSize(scale, scale), QIcon::Selected)));
+ [self setImage: nsaltimage];
+ [nsaltimage release];
+ }
+
+
if (down)
[parent triggerSelector:self];
else if ((clickCount%2))
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index a18af4f..c015589 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -1856,8 +1856,10 @@ QValidator::State QSpinBoxValidator::validate(QString &input, int &pos) const
if (dptr->specialValueText.size() > 0 && input == dptr->specialValueText)
return QValidator::Acceptable;
- if (!dptr->prefix.isEmpty() && !input.startsWith(dptr->prefix))
+ if (!dptr->prefix.isEmpty() && !input.startsWith(dptr->prefix)) {
input.prepend(dptr->prefix);
+ pos += dptr->prefix.length();
+ }
if (!dptr->suffix.isEmpty() && !input.endsWith(dptr->suffix))
input.append(dptr->suffix);
diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp
index 0e859f1..f2ef941 100644
--- a/src/gui/widgets/qdialogbuttonbox.cpp
+++ b/src/gui/widgets/qdialogbuttonbox.cpp
@@ -46,6 +46,7 @@
#include <QtGui/qdialog.h>
#include <QtGui/qapplication.h>
#include <QtGui/private/qwidget_p.h>
+#include <QtGui/qaction.h>
#include "qdialogbuttonbox.h"
@@ -259,6 +260,31 @@ static const int layouts[2][5][14] =
}
};
+class QDialogButtonEnabledProxy : public QObject
+{
+public:
+ QDialogButtonEnabledProxy(QObject *parent, QWidget *src, QAction *trg) : QObject(parent), source(src), target(trg)
+ {
+ source->installEventFilter(this);
+ target->setEnabled(source->isEnabled());
+ }
+ ~QDialogButtonEnabledProxy()
+ {
+ source->removeEventFilter(this);
+ }
+ bool eventFilter(QObject *object, QEvent *event)
+ {
+ if (object == source && event->type() == QEvent::EnabledChange) {
+ target->setEnabled(source->isEnabled());
+ }
+ return false;
+ };
+private:
+ QWidget *source;
+ QAction *target;
+};
+
+
class QDialogButtonBoxPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QDialogButtonBox)
@@ -548,7 +574,9 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo
QObject::connect(button, SIGNAL(destroyed()), q, SLOT(_q_handleButtonDestroyed()));
buttonLists[role].append(button);
#ifdef QT_SOFTKEYS_ENABLED
- softKeyActions.insert(button, createSoftKey(button, role));
+ QAction *action = createSoftKey(button, role);
+ softKeyActions.insert(button, action);
+ new QDialogButtonEnabledProxy(action, button, action);
#endif
if (doLayout)
layoutButtons();
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index 0a26a77..cf82da0 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1303,9 +1303,9 @@ QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(const QList<int> &path)
index = -index - 1;
if (index >= item_list.count())
return this;
- if (path.count() == 1 || item_list.at(index).subinfo == 0)
+ if (path.count() == 1 || item_list[index].subinfo == 0)
return this;
- return item_list.at(index).subinfo->info(path.mid(1));
+ return item_list[index].subinfo->info(path.mid(1));
}
QRect QDockAreaLayoutInfo::itemRect(int index) const
diff --git a/src/gui/widgets/qlcdnumber.h b/src/gui/widgets/qlcdnumber.h
index e65637d..b7162cd 100644
--- a/src/gui/widgets/qlcdnumber.h
+++ b/src/gui/widgets/qlcdnumber.h
@@ -82,9 +82,10 @@ public:
};
bool smallDecimalPoint() const;
-
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numDigits() const;
QT_DEPRECATED void setNumDigits(int nDigits);
+#endif
int digitCount() const;
void setDigitCount(int nDigits);
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 2c1acdb..15dcda2 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1445,6 +1445,16 @@ bool QLineEdit::event(QEvent * e)
d->control->processEvent(e);
} else if (e->type() == QEvent::KeyRelease) {
d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime());
+ } else if (e->type() == QEvent::Show) {
+ //In order to get the cursor blinking if QComboBox::setEditable is called when the combobox has focus
+ if (hasFocus()) {
+ d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime());
+ QStyleOptionFrameV2 opt;
+ initStyleOption(&opt);
+ if ((!hasSelectedText() && d->control->preeditAreaText().isEmpty())
+ || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this))
+ d->setCursorVisible(true);
+ }
}
#ifdef QT_KEYPAD_NAVIGATION
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 2e27226..ec9683d 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -65,6 +65,8 @@
#include "qmenubar_p.h"
#include "qwidgetaction.h"
#include "qtoolbutton.h"
+#include "qpushbutton.h"
+#include <private/qpushbutton_p.h>
#include <private/qaction_p.h>
#include <private/qsoftkeymanager_p.h>
#ifdef QT3_SUPPORT
@@ -417,12 +419,7 @@ void QMenuPrivate::hideUpToMenuBar()
hideMenu(m, fadeMenus);
if (!fadeMenus) // Mac doesn't clear the action until after hidden.
m->d_func()->setCurrentAction(0);
- } else {
-#ifndef QT_NO_TOOLBUTTON
- if (qobject_cast<QToolButton*>(caused) == 0)
-#endif
- qWarning("QMenu: Internal error");
- caused = 0;
+ } else { caused = 0;
}
}
#if defined(Q_WS_MAC)
@@ -1825,8 +1822,15 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
ensurePolished(); // Get the right font
emit aboutToShow();
+ const bool actionListChanged = d->itemsDirty;
d->updateActionRects();
- QPoint pos = p;
+ QPoint pos;
+ QPushButton *causedButton = qobject_cast<QPushButton*>(d->causedPopup.widget);
+ if (actionListChanged && causedButton)
+ pos = QPushButtonPrivate::get(causedButton)->adjustedMenuPosition();
+ else
+ pos = p;
+
QSize size = sizeHint();
QRect screen;
#ifndef QT_NO_GRAPHICSVIEW
@@ -2302,22 +2306,9 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e)
if (action->menu())
action->menu()->d_func()->setFirstActionActive();
else {
-#if defined(Q_WS_WIN) && !defined(QT_NO_MENUBAR)
+#if defined(Q_WS_WIN)
//On Windows only context menus can be activated with the right button
- bool isContextMenu = true;
- const QWidget *cause = d->causedPopup.widget;
- while (cause) {
- //if the popup was caused by either QMenuBar or a QToolButton, it is not a context menu
- if (qobject_cast<const QMenuBar *>(cause) || qobject_cast<const QToolButton *>(cause)) {
- isContextMenu = false;
- break;
- } else if (const QMenu *menu = qobject_cast<const QMenu *>(cause)) {
- cause = menu->d_func()->causedPopup.widget;
- } else {
- break;
- }
- }
- if (e->button() == Qt::LeftButton || isContextMenu)
+ if (e->button() == Qt::LeftButton || d->topCausedWidget() == 0)
#endif
d->activateAction(action, QAction::Trigger);
}
diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h
index 5757885..93017f5 100644
--- a/src/gui/widgets/qmenu_p.h
+++ b/src/gui/widgets/qmenu_p.h
@@ -182,6 +182,7 @@ public:
}
void init();
+ static QMenuPrivate *get(QMenu *m) { return m->d_func(); }
int scrollerHeight() const;
//item calculations
diff --git a/src/gui/widgets/qprintpreviewwidget.h b/src/gui/widgets/qprintpreviewwidget.h
index 08e596d..d8504de 100644
--- a/src/gui/widgets/qprintpreviewwidget.h
+++ b/src/gui/widgets/qprintpreviewwidget.h
@@ -82,7 +82,9 @@ public:
ViewMode viewMode() const;
ZoomMode zoomMode() const;
int currentPage() const;
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numPages() const;
+#endif
int pageCount() const;
void setVisible(bool visible);
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp
index eb34336..849bc43 100644
--- a/src/gui/widgets/qpushbutton.cpp
+++ b/src/gui/widgets/qpushbutton.cpp
@@ -63,6 +63,7 @@
#include "qaccessible.h"
#endif
+#include "private/qmenu_p.h"
#include "private/qpushbutton_p.h"
QT_BEGIN_NAMESPACE
@@ -575,12 +576,33 @@ void QPushButtonPrivate::_q_popupPressed()
return;
menu->setNoReplayFor(q);
+
+ QPoint menuPos = adjustedMenuPosition();
+
+ QPointer<QPushButton> guard(q);
+ QMenuPrivate::get(menu)->causedPopup.widget = guard;
+
+ //Because of a delay in menu effects, we must keep track of the
+ //menu visibility to avoid flicker on button release
+ menuOpen = true;
+ menu->exec(menuPos);
+ if (guard) {
+ menuOpen = false;
+ q->setDown(false);
+ }
+}
+
+QPoint QPushButtonPrivate::adjustedMenuPosition()
+{
+ Q_Q(QPushButton);
+
bool horizontal = true;
#if !defined(QT_NO_TOOLBAR)
QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (tb && tb->orientation() == Qt::Vertical)
horizontal = false;
#endif
+
QWidgetItem item(q);
QRect rect = item.geometry();
rect.setRect(rect.x() - q->x(), rect.y() - q->y(), rect.width(), rect.height());
@@ -603,17 +625,10 @@ void QPushButtonPrivate::_q_popupPressed()
else
x -= menuSize.width();
}
- QPointer<QPushButton> guard(q);
- //Because of a delay in menu effects, we must keep track of the
- //menu visibility to avoid flicker on button release
- menuOpen = true;
- menu->exec(QPoint(x, y));
- if (guard) {
- menuOpen = false;
- q->setDown(false);
- }
+ return QPoint(x,y);
}
+
#endif // QT_NO_MENU
void QPushButtonPrivate::resetLayoutItemMargins()
diff --git a/src/gui/widgets/qpushbutton_p.h b/src/gui/widgets/qpushbutton_p.h
index f448027..2510e05 100644
--- a/src/gui/widgets/qpushbutton_p.h
+++ b/src/gui/widgets/qpushbutton_p.h
@@ -68,6 +68,10 @@ public:
defaultButton(false), flat(false), menuOpen(false), lastAutoDefault(false) {}
inline void init() { resetLayoutItemMargins(); }
+ static QPushButtonPrivate* get(QPushButton *b) { return b->d_func(); }
+#ifndef QT_NO_MENU
+ QPoint adjustedMenuPosition();
+#endif
void resetLayoutItemMargins();
void _q_popupPressed();
QDialog *dialogParent() const;
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index 47c4698..4cf1f20 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -396,10 +396,10 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
void QToolBarPrivate::unplug(const QRect &_r)
{
Q_Q(QToolBar);
- layout->setExpanded(false);
QRect r = _r;
r.moveTopLeft(q->mapToGlobal(QPoint(0, 0)));
setWindowState(true, true, r);
+ layout->setExpanded(false);
}
void QToolBarPrivate::plug(const QRect &r)
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index c329305..b83026b 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -598,16 +598,21 @@ int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const
{
switch (dockPos) {
case QInternal::LeftDock:
- return pos.x() - rect.right();
+ if (pos.y() < rect.bottom())
+ return pos.x() - rect.right();
case QInternal::RightDock:
- return rect.left() - pos.x();
+ if (pos.y() < rect.bottom())
+ return rect.left() - pos.x();
case QInternal::TopDock:
- return pos.y() - rect.bottom();
+ if (pos.x() < rect.right())
+ return pos.y() - rect.bottom();
case QInternal::BottomDock:
- return rect.top() - pos.y();
+ if (pos.x() < rect.right())
+ return rect.top() - pos.y();
default:
- return -1;
+ break;
}
+ return -1;
}
/******************************************************************************
diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp
index 0afe5d8..93429e4 100644
--- a/src/gui/widgets/qtoolbarlayout.cpp
+++ b/src/gui/widgets/qtoolbarlayout.cpp
@@ -654,6 +654,7 @@ void QToolBarLayout::setExpanded(bool exp)
if (!tb)
return;
if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) {
+ animating = !tb->isWindow() && win->isAnimated();
QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
if (expanded) {
tb->raise();
@@ -664,7 +665,7 @@ void QToolBarLayout::setExpanded(bool exp)
layoutActions(rect.size());
}
}
- layout->layoutState.toolBarAreaLayout.apply(win->isAnimated());
+ layout->layoutState.toolBarAreaLayout.apply(animating);
}
}
diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri
index c445941..625b871c 100644
--- a/src/multimedia/audio/audio.pri
+++ b/src/multimedia/audio/audio.pri
@@ -17,6 +17,8 @@ SOURCES += $$PWD/qaudio.cpp \
$$PWD/qaudioengine.cpp \
$$PWD/qaudiodevicefactory.cpp
+contains(QT_CONFIG, audio-backend) {
+
mac {
HEADERS += $$PWD/qaudioinput_mac_p.h \
$$PWD/qaudiooutput_mac_p.h \
@@ -51,3 +53,6 @@ mac {
}
}
}
+} else {
+ DEFINES += QT_NO_AUDIO_BACKEND
+}
diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp
index 89e4394..bc1656d 100644
--- a/src/multimedia/audio/qaudiodevicefactory.cpp
+++ b/src/multimedia/audio/qaudiodevicefactory.cpp
@@ -45,6 +45,7 @@
#include <private/qfactoryloader_p.h>
#include "qaudiodevicefactory_p.h"
+#ifndef QT_NO_AUDIO_BACKEND
#if defined(Q_OS_WIN)
#include "qaudiodeviceinfo_win32_p.h"
#include "qaudiooutput_win32_p.h"
@@ -58,6 +59,7 @@
#include "qaudiooutput_alsa_p.h"
#include "qaudioinput_alsa_p.h"
#endif
+#endif
QT_BEGIN_NAMESPACE
@@ -125,10 +127,12 @@ public:
QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode)
{
QList<QAudioDeviceInfo> devices;
+#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode))
devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode);
#endif
+#endif
QFactoryLoader* l = loader();
foreach (QString const& key, l->keys()) {
@@ -153,9 +157,11 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice()
if (list.size() > 0)
return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput);
}
+#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput);
#endif
+#endif
return QAudioDeviceInfo();
}
@@ -168,9 +174,11 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice()
if (list.size() > 0)
return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput);
}
+#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput);
#endif
+#endif
return QAudioDeviceInfo();
}
@@ -178,10 +186,12 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re
{
QAbstractAudioDeviceInfo *rc = 0;
+#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
if (realm == QLatin1String("builtin"))
return new QAudioDeviceInfoInternal(handle, mode);
#endif
+#endif
QAudioEngineFactoryInterface* plugin =
qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(realm));
@@ -205,10 +215,12 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con
{
if (deviceInfo.isNull())
return new QNullInputDevice();
+#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
if (deviceInfo.realm() == QLatin1String("builtin"))
return new QAudioInputPrivate(deviceInfo.handle(), format);
#endif
+#endif
QAudioEngineFactoryInterface* plugin =
qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));
@@ -222,10 +234,12 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c
{
if (deviceInfo.isNull())
return new QNullOutputDevice();
+#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
if (deviceInfo.realm() == QLatin1String("builtin"))
return new QAudioOutputPrivate(deviceInfo.handle(), format);
#endif
+#endif
QAudioEngineFactoryInterface* plugin =
qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));
diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp
index 8b368d5..d81df7a 100644
--- a/src/multimedia/audio/qaudioinput.cpp
+++ b/src/multimedia/audio/qaudioinput.cpp
@@ -77,8 +77,12 @@ QT_BEGIN_NAMESPACE
file, you can:
\code
+ QFile outputFile; // class member.
+ QAudioInput* audio; // class member.
+ \endcode
+
+ \code
{
- QFile outputFile;
outputFile.setFileName("/tmp/test.raw");
outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate );
@@ -91,7 +95,13 @@ QT_BEGIN_NAMESPACE
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::UnSignedInt);
- QAudioInput *audio = new QAudioInput(format, this);
+ if (QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
+ if (!info.isFormatSupported(format)) {
+ qWarning()<<"default format not supported try to use nearest";
+ format = info.nearestFormat(format);
+ }
+
+ audio = new QAudioInput(format, this);
QTimer::singleShot(3000, this, SLOT(stopRecording()));
audio->start(outputFile);
// Records audio for 3000ms
@@ -109,6 +119,7 @@ QT_BEGIN_NAMESPACE
{
audio->stop();
outputFile->close();
+ delete audio;
}
\endcode
diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp
index f8f2fa1..1c7b617 100644
--- a/src/multimedia/audio/qaudiooutput.cpp
+++ b/src/multimedia/audio/qaudiooutput.cpp
@@ -73,7 +73,11 @@ QT_BEGIN_NAMESPACE
simple as:
\code
- QFile inputFile;
+ QFile inputFile; // class member.
+ QAudioOutput* audio; // class member.
+ \endcode
+
+ \code
inputFile.setFileName("/tmp/test.raw");
inputFile.open(QIODevice::ReadOnly);
@@ -86,7 +90,13 @@ QT_BEGIN_NAMESPACE
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::UnSignedInt);
- QAudioOutput *audio = new QAudioOutput(format, this);
+ QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
+ if (!info.isFormatSupported(format)) {
+ qWarning()<<"raw audio format not supported by backend, cannot play audio.";
+ return;
+ }
+
+ audio = new QAudioOutput(format, this);
connect(audio,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State)));
audio->start(inputFile);
@@ -104,6 +114,7 @@ QT_BEGIN_NAMESPACE
if(state == QAudio::IdleState) {
audio->stop();
inputFile.close();
+ delete audio;
}
}
\endcode
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 9a72b00..923f2e3 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -49,7 +49,9 @@
#include "QtCore/qdatetime.h"
#include <ctype.h>
-#include <stdio.h>
+#ifndef QT_NO_DATESTRING
+# include <stdio.h>
+#endif
QT_BEGIN_NAMESPACE
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 3fce384..fb9bcb4 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -589,53 +589,31 @@ void QGL2PaintEngineExPrivate::updateMatrix()
// matrix multiplication as most of the components are trivial.
const QTransform& transform = q->state()->matrix;
- if (mode == TextDrawingMode) {
- // Text drawing mode is only used for non-scaling transforms
- pmvMatrix[0][0] = 2.0 / width;
- pmvMatrix[0][1] = 0.0;
- pmvMatrix[0][2] = 0.0;
- pmvMatrix[0][3] = 0.0;
- pmvMatrix[1][0] = 0.0;
- pmvMatrix[1][1] = -2.0 / height;
- pmvMatrix[1][2] = 0.0;
- pmvMatrix[1][3] = 0.0;
- pmvMatrix[2][0] = 0.0;
- pmvMatrix[2][1] = 0.0;
- pmvMatrix[2][2] = -1.0;
- pmvMatrix[2][3] = 0.0;
- pmvMatrix[3][0] = pmvMatrix[0][0] * qRound(transform.dx()) - 1.0;
- pmvMatrix[3][1] = pmvMatrix[1][1] * qRound(transform.dy()) + 1.0;
- pmvMatrix[3][2] = 0.0;
- pmvMatrix[3][3] = 1.0;
-
- inverseScale = 1;
- } else {
- qreal wfactor = 2.0 / width;
- qreal hfactor = -2.0 / height;
-
- pmvMatrix[0][0] = wfactor * transform.m11() - transform.m13();
- pmvMatrix[0][1] = hfactor * transform.m12() + transform.m13();
- pmvMatrix[0][2] = 0.0;
- pmvMatrix[0][3] = transform.m13();
- pmvMatrix[1][0] = wfactor * transform.m21() - transform.m23();
- pmvMatrix[1][1] = hfactor * transform.m22() + transform.m23();
- pmvMatrix[1][2] = 0.0;
- pmvMatrix[1][3] = transform.m23();
- pmvMatrix[2][0] = 0.0;
- pmvMatrix[2][1] = 0.0;
- pmvMatrix[2][2] = -1.0;
- pmvMatrix[2][3] = 0.0;
- pmvMatrix[3][0] = wfactor * transform.dx() - transform.m33();
- pmvMatrix[3][1] = hfactor * transform.dy() + transform.m33();
- pmvMatrix[3][2] = 0.0;
- pmvMatrix[3][3] = transform.m33();
-
- // 1/10000 == 0.0001, so we have good enough res to cover curves
- // that span the entire widget...
- inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())),
- qMax(qAbs(transform.m12()), qAbs(transform.m21())) ),
- qreal(0.0001));
- }
+ qreal wfactor = 2.0 / width;
+ qreal hfactor = -2.0 / height;
+
+ pmvMatrix[0][0] = wfactor * transform.m11() - transform.m13();
+ pmvMatrix[0][1] = hfactor * transform.m12() + transform.m13();
+ pmvMatrix[0][2] = 0.0;
+ pmvMatrix[0][3] = transform.m13();
+ pmvMatrix[1][0] = wfactor * transform.m21() - transform.m23();
+ pmvMatrix[1][1] = hfactor * transform.m22() + transform.m23();
+ pmvMatrix[1][2] = 0.0;
+ pmvMatrix[1][3] = transform.m23();
+ pmvMatrix[2][0] = 0.0;
+ pmvMatrix[2][1] = 0.0;
+ pmvMatrix[2][2] = -1.0;
+ pmvMatrix[2][3] = 0.0;
+ pmvMatrix[3][0] = wfactor * transform.dx() - transform.m33();
+ pmvMatrix[3][1] = hfactor * transform.dy() + transform.m33();
+ pmvMatrix[3][2] = 0.0;
+ pmvMatrix[3][3] = transform.m33();
+
+ // 1/10000 == 0.0001, so we have good enough res to cover curves
+ // that span the entire widget...
+ inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())),
+ qMax(qAbs(transform.m12()), qAbs(transform.m21())) ),
+ qreal(0.0001));
matrixDirty = false;
@@ -817,17 +795,12 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
lastTexture = GLuint(-1);
}
- if (mode == TextDrawingMode)
- matrixDirty = true;
-
if (newMode == TextDrawingMode) {
glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data());
glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data());
-
- matrixDirty = true;
}
if (newMode == ImageDrawingMode) {
@@ -930,7 +903,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
int floatSizeInBytes = vertexCount * 2 * sizeof(float);
cache->vertexCount = vertexCount;
cache->primitiveType = GL_TRIANGLE_FAN;
- cache->iscale = inverseScale;
+ cache->iscale = inverseScale;
#ifdef QT_OPENGL_CACHE_AS_VBOS
glGenBuffers(1, &cache->vbo);
glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
@@ -1545,21 +1518,21 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
- bool drawCached = true;
+ QTransform::TransformationType txtype = s->matrix.type();
- if (s->matrix.type() > QTransform::TxTranslate)
- drawCached = false;
+ float det = s->matrix.determinant();
+ bool drawCached = txtype < QTransform::TxProject;
- // don't try to cache huge fonts
+ // don't try to cache huge fonts or vastly transformed fonts
const qreal pixelSize = ti.fontEngine->fontDef.pixelSize;
- if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) >= 64 * 64)
+ if (pixelSize * pixelSize * qAbs(det) >= 64 * 64 || det < 0.25f || det > 4.f)
drawCached = false;
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat)
: d->glyphCacheType;
- if (d->inRenderText)
+ if (d->inRenderText || txtype > QTransform::TxTranslate)
glyphType = QFontEngineGlyphCache::Raster_A8;
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask
@@ -1581,7 +1554,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
const QTextItemInt &ti)
{
Q_Q(QGL2PaintEngineEx);
- QOpenGL2PaintEngineState *s = q->state();
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
@@ -1589,10 +1561,10 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, s->matrix);
+ (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType) {
- cache = new QGLTextureGlyphCache(ctx, glyphType, s->matrix);
+ cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
ti.fontEngine->setGlyphCache(ctx, cache);
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index f6f6bb3..b6f8919 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -127,18 +127,6 @@ Q_GLOBAL_STATIC(QGLDefaultOverlayFormat, defaultOverlayFormatInstance)
QGLExtensions::Extensions QGLExtensions::glExtensions = 0;
bool QGLExtensions::nvidiaFboNeedsFinish = false;
-#ifndef APIENTRY
-# define APIENTRY
-#endif
-typedef void (APIENTRY *pfn_glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei,
- GLsizei, GLint, GLsizei, const GLvoid *);
-static pfn_glCompressedTexImage2DARB qt_glCompressedTexImage2DARB = 0;
-
-
-#ifndef APIENTRY
-#define APIENTRY
-#endif
-
Q_GLOBAL_STATIC(QGLSignalProxy, theSignalProxy)
QGLSignalProxy *QGLSignalProxy::instance()
{
@@ -185,12 +173,12 @@ public:
#else
// We can't do this in the constructor for this object because it
// needs to be called *before* the QApplication constructor.
- // Also check for the FragmentProgram extension in conjunction with
+ // Also check for the FragmentShader extension in conjunction with
// the 2.0 version flag, to cover the case where we export the display
// from an old GL 1.1 server to a GL 2.x client. In that case we can't
// use GL 2.0.
if ((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)
- && (QGLExtensions::glExtensions & QGLExtensions::FragmentProgram)
+ && (QGLExtensions::glExtensions & QGLExtensions::FragmentShader)
&& qgetenv("QT_GL_USE_OPENGL1ENGINE").isEmpty())
engineType = QPaintEngine::OpenGL2;
else
@@ -409,8 +397,7 @@ static inline GLint qgluProject(GLdouble objx, GLdouble objy, GLdouble objz,
\i \link setDirectRendering() Direct rendering:\endlink Enabled.
\i \link setOverlay() Overlay:\endlink Disabled.
\i \link setPlane() Plane:\endlink 0 (i.e., normal plane).
- \i \link setSampleBuffers() Multisample buffers:\endlink Enabled on
- OpenGL/ES 2.0, disabled on other platforms.
+ \i \link setSampleBuffers() Multisample buffers:\endlink Disabled.
\endlist
*/
@@ -1887,118 +1874,42 @@ void QGLContextPrivate::cleanup()
{
}
-typedef QHash<QString, GLuint> QGLDDSCache;
-Q_GLOBAL_STATIC(QGLDDSCache, qgl_dds_cache)
-
/*!
\overload
- Reads the DirectDrawSurface (DDS) compressed file \a fileName and
- generates a 2D GL texture from it.
+ Reads the compressed texture file \a fileName and generates a 2D GL
+ texture from it.
- Only the DXT1, DXT3 and DXT5 DDS formats are supported.
+ This function can load DirectDrawSurface (DDS) textures in the
+ DXT1, DXT3 and DXT5 DDS formats if the \c GL_ARB_texture_compression
+ and \c GL_EXT_texture_compression_s3tc extensions are supported.
- Note that this will only work if the implementation supports the
- \c GL_ARB_texture_compression and \c GL_EXT_texture_compression_s3tc
- extensions.
+ Since 4.6.1, textures in the ETC1 format can be loaded if the
+ \c GL_OES_compressed_ETC1_RGB8_texture extension is supported
+ and the ETC1 texture has been encapsulated in the PVR container format.
+ Also, textures in the PVRTC2 and PVRTC4 formats can be loaded
+ if the \c GL_IMG_texture_compression_pvrtc extension is supported.
\sa deleteTexture()
*/
GLuint QGLContext::bindTexture(const QString &fileName)
{
- if (!qt_glCompressedTexImage2DARB) {
- qWarning("QGLContext::bindTexture(): The GL implementation does not support texture"
- "compression extensions.");
- return 0;
- }
-
- QGLDDSCache::const_iterator it = qgl_dds_cache()->constFind(fileName);
- if (it != qgl_dds_cache()->constEnd()) {
+ Q_D(QGLContext);
+ QGLDDSCache *dds_cache = &(d->group->m_dds_cache);
+ QGLDDSCache::const_iterator it = dds_cache->constFind(fileName);
+ if (it != dds_cache->constEnd()) {
glBindTexture(GL_TEXTURE_2D, it.value());
return it.value();
}
- QFile f(fileName);
- f.open(QIODevice::ReadOnly);
-
- char tag[4];
- f.read(&tag[0], 4);
- if (strncmp(tag,"DDS ", 4) != 0) {
- qWarning("QGLContext::bindTexture(): not a DDS image file.");
+ QGLTexture texture(this);
+ QSize size = texture.bindCompressedTexture(fileName);
+ if (!size.isValid())
return 0;
- }
-
- DDSFormat ddsHeader;
- f.read((char *) &ddsHeader, sizeof(DDSFormat));
-
- if (!ddsHeader.dwLinearSize) {
- qWarning("QGLContext::bindTexture() DDS image size is not valid.");
- return 0;
- }
-
- int factor = 4;
- int bufferSize = 0;
- int blockSize = 16;
- GLenum format;
-
- switch(ddsHeader.ddsPixelFormat.dwFourCC) {
- case FOURCC_DXT1:
- format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- factor = 2;
- blockSize = 8;
- break;
- case FOURCC_DXT3:
- format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
- break;
- case FOURCC_DXT5:
- format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
- break;
- default:
- qWarning("QGLContext::bindTexture() DDS image format not supported.");
- return 0;
- }
-
- if (ddsHeader.dwMipMapCount > 1)
- bufferSize = ddsHeader.dwLinearSize * factor;
- else
- bufferSize = ddsHeader.dwLinearSize;
-
- GLubyte *pixels = (GLubyte *) malloc(bufferSize*sizeof(GLubyte));
- f.seek(ddsHeader.dwSize + 4);
- f.read((char *) pixels, bufferSize);
- f.close();
-
- GLuint tx_id;
- glGenTextures(1, &tx_id);
- glBindTexture(GL_TEXTURE_2D, tx_id);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-
- int size;
- int offset = 0;
- int w = ddsHeader.dwWidth;
- int h = ddsHeader.dwHeight;
- // load mip-maps
- for(int i = 0; i < (int) ddsHeader.dwMipMapCount; ++i) {
- if (w == 0) w = 1;
- if (h == 0) h = 1;
-
- size = ((w+3)/4) * ((h+3)/4) * blockSize;
- qt_glCompressedTexImage2DARB(GL_TEXTURE_2D, i, format, w, h, 0,
- size, pixels + offset);
- offset += size;
-
- // half size for each mip-map level
- w = w/2;
- h = h/2;
- }
-
- free(pixels);
-
- qgl_dds_cache()->insert(fileName, tx_id);
- return tx_id;
+ dds_cache->insert(fileName, texture.id);
+ return texture.id;
}
static inline QRgb qt_gl_convertToGLFormatHelper(QRgb src_pixel, GLenum texture_format)
@@ -2322,6 +2233,14 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
}
}
}
+#ifdef QT_OPENGL_ES
+ // OpenGL/ES requires that the internal and external formats be identical.
+ // This is typically used to convert GL_RGBA into GL_BGRA.
+ // Also, we need to use GL_UNSIGNED_BYTE when the format is GL_BGRA.
+ internalFormat = externalFormat;
+ if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV)
+ pixel_type = GL_UNSIGNED_BYTE;
+#endif
#ifdef QGL_BIND_TEXTURE_DEBUG
printf(" - uploading, image.format=%d, externalFormat=0x%x, internalFormat=0x%x, pixel_type=0x%x\n",
img.format(), externalFormat, internalFormat, pixel_type);
@@ -2593,17 +2512,20 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, Q
*/
void QGLContext::deleteTexture(GLuint id)
{
+ Q_D(QGLContext);
+
if (QGLTextureCache::instance()->remove(this, id))
return;
// check the DDS cache if the texture wasn't found in the pixmap/image
// cache
- QList<QString> ddsKeys = qgl_dds_cache()->keys();
+ QGLDDSCache *dds_cache = &(d->group->m_dds_cache);
+ QList<QString> ddsKeys = dds_cache->keys();
for (int i = 0; i < ddsKeys.size(); ++i) {
- GLuint texture = qgl_dds_cache()->value(ddsKeys.at(i));
+ GLuint texture = dds_cache->value(ddsKeys.at(i));
if (id == texture) {
glDeleteTextures(1, &texture);
- qgl_dds_cache()->remove(ddsKeys.at(i));
+ dds_cache->remove(ddsKeys.at(i));
return;
}
}
@@ -4900,63 +4822,67 @@ QGLWidget::QGLWidget(QGLContext *context, QWidget *parent,
void QGLExtensions::init_extensions()
{
- QList<QByteArray> extensions = QByteArray(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS))).split(' ');
- if (extensions.contains("GL_ARB_texture_rectangle"))
+ QGLExtensionMatcher extensions(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
+
+ if (extensions.match("GL_ARB_texture_rectangle"))
glExtensions |= TextureRectangle;
- if (extensions.contains("GL_ARB_multisample"))
+ if (extensions.match("GL_ARB_multisample"))
glExtensions |= SampleBuffers;
- if (extensions.contains("GL_SGIS_generate_mipmap"))
+ if (extensions.match("GL_SGIS_generate_mipmap"))
glExtensions |= GenerateMipmap;
- if (extensions.contains("GL_EXT_texture_compression_s3tc"))
+ if (extensions.match("GL_ARB_texture_compression"))
glExtensions |= TextureCompression;
- if (extensions.contains("GL_ARB_fragment_program"))
+ if (extensions.match("GL_EXT_texture_compression_s3tc"))
+ glExtensions |= DDSTextureCompression;
+ if (extensions.match("GL_OES_compressed_ETC1_RGB8_texture"))
+ glExtensions |= ETC1TextureCompression;
+ if (extensions.match("GL_IMG_texture_compression_pvrtc"))
+ glExtensions |= PVRTCTextureCompression;
+ if (extensions.match("GL_ARB_fragment_program"))
glExtensions |= FragmentProgram;
- if (extensions.contains("GL_ARB_texture_mirrored_repeat"))
+ if (extensions.match("GL_ARB_fragment_shader"))
+ glExtensions |= FragmentShader;
+ if (extensions.match("GL_ARB_texture_mirrored_repeat"))
glExtensions |= MirroredRepeat;
- if (extensions.contains("GL_EXT_framebuffer_object"))
+ if (extensions.match("GL_EXT_framebuffer_object"))
glExtensions |= FramebufferObject;
- if (extensions.contains("GL_EXT_stencil_two_side"))
+ if (extensions.match("GL_EXT_stencil_two_side"))
glExtensions |= StencilTwoSide;
- if (extensions.contains("GL_EXT_stencil_wrap"))
+ if (extensions.match("GL_EXT_stencil_wrap"))
glExtensions |= StencilWrap;
- if (extensions.contains("GL_EXT_packed_depth_stencil"))
+ if (extensions.match("GL_EXT_packed_depth_stencil"))
glExtensions |= PackedDepthStencil;
- if (extensions.contains("GL_NV_float_buffer"))
+ if (extensions.match("GL_NV_float_buffer"))
glExtensions |= NVFloatBuffer;
- if (extensions.contains("GL_ARB_pixel_buffer_object"))
+ if (extensions.match("GL_ARB_pixel_buffer_object"))
glExtensions |= PixelBufferObject;
#if defined(QT_OPENGL_ES_2)
glExtensions |= FramebufferObject;
glExtensions |= GenerateMipmap;
+ glExtensions |= FragmentShader;
#endif
#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL)
- if (extensions.contains("GL_OES_framebuffer_object"))
+ if (extensions.match("GL_OES_framebuffer_object"))
glExtensions |= FramebufferObject;
#endif
#if defined(QT_OPENGL_ES)
- if (extensions.contains("GL_OES_packed_depth_stencil"))
+ if (extensions.match("GL_OES_packed_depth_stencil"))
glExtensions |= PackedDepthStencil;
#endif
- if (extensions.contains("GL_ARB_framebuffer_object")) {
+ if (extensions.match("GL_ARB_framebuffer_object")) {
// ARB_framebuffer_object also includes EXT_framebuffer_blit.
glExtensions |= FramebufferObject;
glExtensions |= FramebufferBlit;
}
- if (extensions.contains("GL_EXT_framebuffer_blit"))
+ if (extensions.match("GL_EXT_framebuffer_blit"))
glExtensions |= FramebufferBlit;
- if (extensions.contains("GL_ARB_texture_non_power_of_two"))
+ if (extensions.match("GL_ARB_texture_non_power_of_two"))
glExtensions |= NPOTTextures;
- if (extensions.contains("GL_EXT_bgra"))
+ if (extensions.match("GL_EXT_bgra"))
glExtensions |= BGRATextureFormat;
-
-
- QGLContext cx(QGLFormat::defaultFormat());
- if (glExtensions & TextureCompression) {
- qt_glCompressedTexImage2DARB = (pfn_glCompressedTexImage2DARB) cx.getProcAddress(QLatin1String("glCompressedTexImage2DARB"));
- }
}
/*
@@ -5112,4 +5038,341 @@ void QGLSharedResourceGuard::setContext(const QGLContext *context)
}
}
+QSize QGLTexture::bindCompressedTexture
+ (const QString& fileName, const char *format)
+{
+ QFile file(fileName);
+ if (!file.open(QIODevice::ReadOnly))
+ return QSize();
+ QByteArray contents = file.readAll();
+ file.close();
+ return bindCompressedTexture
+ (contents.constData(), contents.size(), format);
+}
+
+// PVR header format for container files that store textures compressed
+// with the ETC1, PVRTC2, and PVRTC4 encodings. Format information from the
+// PowerVR SDK at http://www.imgtec.com/powervr/insider/powervr-sdk.asp
+// "PVRTexTool Reference Manual, version 1.11f".
+struct PvrHeader
+{
+ quint32 headerSize;
+ quint32 height;
+ quint32 width;
+ quint32 mipMapCount;
+ quint32 flags;
+ quint32 dataSize;
+ quint32 bitsPerPixel;
+ quint32 redMask;
+ quint32 greenMask;
+ quint32 blueMask;
+ quint32 alphaMask;
+ quint32 magic;
+ quint32 surfaceCount;
+};
+
+#define PVR_MAGIC 0x21525650 // "PVR!" in little-endian
+
+#define PVR_FORMAT_MASK 0x000000FF
+#define PVR_FORMAT_PVRTC2 0x00000018
+#define PVR_FORMAT_PVRTC4 0x00000019
+#define PVR_FORMAT_ETC1 0x00000036
+
+#define PVR_HAS_MIPMAPS 0x00000100
+#define PVR_TWIDDLED 0x00000200
+#define PVR_NORMAL_MAP 0x00000400
+#define PVR_BORDER_ADDED 0x00000800
+#define PVR_CUBE_MAP 0x00001000
+#define PVR_FALSE_COLOR_MIPMAPS 0x00002000
+#define PVR_VOLUME_TEXTURE 0x00004000
+#define PVR_ALPHA_IN_TEXTURE 0x00008000
+#define PVR_VERTICAL_FLIP 0x00010000
+
+#ifndef GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif
+
+#ifndef GL_ETC1_RGB8_OES
+#define GL_ETC1_RGB8_OES 0x8D64
+#endif
+
+bool QGLTexture::canBindCompressedTexture
+ (const char *buf, int len, const char *format, bool *hasAlpha)
+{
+ if (QSysInfo::ByteOrder != QSysInfo::LittleEndian) {
+ // Compressed texture loading only supported on little-endian
+ // systems such as x86 and ARM at the moment.
+ return false;
+ }
+ if (!format) {
+ // Auto-detect the format from the header.
+ if (len >= 4 && !qstrncmp(buf, "DDS ", 4)) {
+ *hasAlpha = true;
+ return true;
+ } else if (len >= 52 && !qstrncmp(buf + 44, "PVR!", 4)) {
+ const PvrHeader *pvrHeader =
+ reinterpret_cast<const PvrHeader *>(buf);
+ *hasAlpha = (pvrHeader->alphaMask != 0);
+ return true;
+ }
+ } else {
+ // Validate the format against the header.
+ if (!qstricmp(format, "DDS")) {
+ if (len >= 4 && !qstrncmp(buf, "DDS ", 4)) {
+ *hasAlpha = true;
+ return true;
+ }
+ } else if (!qstricmp(format, "PVR") || !qstricmp(format, "ETC1")) {
+ if (len >= 52 && !qstrncmp(buf + 44, "PVR!", 4)) {
+ const PvrHeader *pvrHeader =
+ reinterpret_cast<const PvrHeader *>(buf);
+ *hasAlpha = (pvrHeader->alphaMask != 0);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+#define ctx QGLContext::currentContext()
+
+QSize QGLTexture::bindCompressedTexture
+ (const char *buf, int len, const char *format)
+{
+ if (QSysInfo::ByteOrder != QSysInfo::LittleEndian) {
+ // Compressed texture loading only supported on little-endian
+ // systems such as x86 and ARM at the moment.
+ return QSize();
+ }
+#if !defined(QT_OPENGL_ES)
+ if (!glCompressedTexImage2D) {
+ if (!(QGLExtensions::glExtensions & QGLExtensions::TextureCompression)) {
+ qWarning("QGLContext::bindTexture(): The GL implementation does "
+ "not support texture compression extensions.");
+ return QSize();
+ }
+ glCompressedTexImage2D = (_glCompressedTexImage2DARB) ctx->getProcAddress(QLatin1String("glCompressedTexImage2DARB"));
+ if (!glCompressedTexImage2D) {
+ qWarning("QGLContext::bindTexture(): could not resolve "
+ "glCompressedTexImage2DARB.");
+ return QSize();
+ }
+ }
+#endif
+ if (!format) {
+ // Auto-detect the format from the header.
+ if (len >= 4 && !qstrncmp(buf, "DDS ", 4))
+ return bindCompressedTextureDDS(buf, len);
+ else if (len >= 52 && !qstrncmp(buf + 44, "PVR!", 4))
+ return bindCompressedTexturePVR(buf, len);
+ } else {
+ // Validate the format against the header.
+ if (!qstricmp(format, "DDS")) {
+ if (len >= 4 && !qstrncmp(buf, "DDS ", 4))
+ return bindCompressedTextureDDS(buf, len);
+ } else if (!qstricmp(format, "PVR") || !qstricmp(format, "ETC1")) {
+ if (len >= 52 && !qstrncmp(buf + 44, "PVR!", 4))
+ return bindCompressedTexturePVR(buf, len);
+ }
+ }
+ return QSize();
+}
+
+QSize QGLTexture::bindCompressedTextureDDS(const char *buf, int len)
+{
+ // We only support 2D texture loading at present.
+ if (target != GL_TEXTURE_2D)
+ return QSize();
+
+ // Bail out if the necessary extension is not present.
+ if (!(QGLExtensions::glExtensions & QGLExtensions::DDSTextureCompression)) {
+ qWarning("QGLContext::bindTexture(): DDS texture compression is not supported.");
+ return QSize();
+ }
+
+ const DDSFormat *ddsHeader = reinterpret_cast<const DDSFormat *>(buf + 4);
+ if (!ddsHeader->dwLinearSize) {
+ qWarning("QGLContext::bindTexture(): DDS image size is not valid.");
+ return QSize();
+ }
+
+ int blockSize = 16;
+ GLenum format;
+
+ switch(ddsHeader->ddsPixelFormat.dwFourCC) {
+ case FOURCC_DXT1:
+ format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
+ blockSize = 8;
+ break;
+ case FOURCC_DXT3:
+ format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
+ break;
+ case FOURCC_DXT5:
+ format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
+ break;
+ default:
+ qWarning("QGLContext::bindTexture(): DDS image format not supported.");
+ return QSize();
+ }
+
+ const GLubyte *pixels =
+ reinterpret_cast<const GLubyte *>(buf + ddsHeader->dwSize + 4);
+
+ glGenTextures(1, &id);
+ glBindTexture(GL_TEXTURE_2D, id);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+ int size;
+ int offset = 0;
+ int available = len - int(ddsHeader->dwSize + 4);
+ int w = ddsHeader->dwWidth;
+ int h = ddsHeader->dwHeight;
+
+ // load mip-maps
+ for(int i = 0; i < (int) ddsHeader->dwMipMapCount; ++i) {
+ if (w == 0) w = 1;
+ if (h == 0) h = 1;
+
+ size = ((w+3)/4) * ((h+3)/4) * blockSize;
+ if (size > available)
+ break;
+ glCompressedTexImage2D(GL_TEXTURE_2D, i, format, w, h, 0,
+ size, pixels + offset);
+ offset += size;
+ available -= size;
+
+ // half size for each mip-map level
+ w = w/2;
+ h = h/2;
+ }
+
+ // DDS images are not inverted.
+ options &= ~QGLContext::InvertedYBindOption;
+
+ return QSize(ddsHeader->dwWidth, ddsHeader->dwHeight);
+}
+
+QSize QGLTexture::bindCompressedTexturePVR(const char *buf, int len)
+{
+ // We only support 2D texture loading at present. Cube maps later.
+ if (target != GL_TEXTURE_2D)
+ return QSize();
+
+ // Determine which texture format we will be loading.
+ const PvrHeader *pvrHeader = reinterpret_cast<const PvrHeader *>(buf);
+ GLenum textureFormat;
+ quint32 minWidth, minHeight;
+ switch (pvrHeader->flags & PVR_FORMAT_MASK) {
+ case PVR_FORMAT_PVRTC2:
+ if (pvrHeader->alphaMask)
+ textureFormat = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
+ else
+ textureFormat = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
+ minWidth = 16;
+ minHeight = 8;
+ break;
+
+ case PVR_FORMAT_PVRTC4:
+ if (pvrHeader->alphaMask)
+ textureFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
+ else
+ textureFormat = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
+ minWidth = 8;
+ minHeight = 8;
+ break;
+
+ case PVR_FORMAT_ETC1:
+ textureFormat = GL_ETC1_RGB8_OES;
+ minWidth = 4;
+ minHeight = 4;
+ break;
+
+ default:
+ qWarning("QGLContext::bindTexture(): PVR image format 0x%x not supported.", int(pvrHeader->flags & PVR_FORMAT_MASK));
+ return QSize();
+ }
+
+ // Bail out if the necessary extension is not present.
+ if (textureFormat == GL_ETC1_RGB8_OES) {
+ if (!(QGLExtensions::glExtensions &
+ QGLExtensions::ETC1TextureCompression)) {
+ qWarning("QGLContext::bindTexture(): ETC1 texture compression is not supported.");
+ return QSize();
+ }
+ } else {
+ if (!(QGLExtensions::glExtensions &
+ QGLExtensions::PVRTCTextureCompression)) {
+ qWarning("QGLContext::bindTexture(): PVRTC texture compression is not supported.");
+ return QSize();
+ }
+ }
+
+ // Boundary check on the buffer size.
+ quint32 bufferSize = pvrHeader->headerSize + pvrHeader->dataSize;
+ if (bufferSize > quint32(len)) {
+ qWarning("QGLContext::bindTexture(): PVR image size is not valid.");
+ return QSize();
+ }
+
+ // Create the texture.
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glGenTextures(1, &id);
+ glBindTexture(GL_TEXTURE_2D, id);
+ if (pvrHeader->mipMapCount) {
+ if ((options & QGLContext::LinearFilteringBindOption) != 0) {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ } else {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
+ }
+ } else if ((options & QGLContext::LinearFilteringBindOption) != 0) {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ } else {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ }
+
+ // Load the compressed mipmap levels.
+ const GLubyte *buffer =
+ reinterpret_cast<const GLubyte *>(buf + pvrHeader->headerSize);
+ bufferSize = pvrHeader->dataSize;
+ quint32 level = 0;
+ quint32 width = pvrHeader->width;
+ quint32 height = pvrHeader->height;
+ while (bufferSize > 0 && level < pvrHeader->mipMapCount) {
+ quint32 size =
+ (qMax(width, minWidth) * qMax(height, minHeight) *
+ pvrHeader->bitsPerPixel) / 8;
+ if (size > bufferSize)
+ break;
+ glCompressedTexImage2D(GL_TEXTURE_2D, GLint(level), textureFormat,
+ GLsizei(width), GLsizei(height), 0,
+ GLsizei(size), buffer);
+ width /= 2;
+ height /= 2;
+ buffer += size;
+ ++level;
+ }
+
+ // Restore the default pixel alignment for later texture uploads.
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+
+ // Set the invert flag for the texture. The "vertical flip"
+ // flag in PVR is the opposite sense to our sense of inversion.
+ if ((pvrHeader->flags & PVR_VERTICAL_FLIP) != 0)
+ options &= ~QGLContext::InvertedYBindOption;
+ else
+ options |= QGLContext::InvertedYBindOption;
+
+ return QSize(pvrHeader->width, pvrHeader->height);
+}
+
+#undef ctx
+
QT_END_NAMESPACE
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index ab72c9c..11770d3 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -133,9 +133,6 @@ public:
: ref(1)
{
opts = QGL::DoubleBuffer | QGL::DepthBuffer | QGL::Rgba | QGL::DirectRendering | QGL::StencilBuffer;
-#if defined(QT_OPENGL_ES_2)
- opts |= QGL::SampleBuffers;
-#endif
pln = 0;
depthSize = accumSize = stencilSize = redSize = greenSize = blueSize = alphaSize = -1;
numSamples = -1;
@@ -222,6 +219,8 @@ public:
class QGLContextResource;
class QGLSharedResourceGuard;
+typedef QHash<QString, GLuint> QGLDDSCache;
+
// QGLContextPrivate has the responsibility of creating context groups.
// QGLContextPrivate and QGLShareRegister will both maintain the reference counter and destroy
// context groups when needed.
@@ -246,6 +245,7 @@ private:
QHash<QGLContextResource *, void *> m_resources;
QGLSharedResourceGuard *m_guards; // double-linked list of active guards.
QAtomicInt m_refs;
+ QGLDDSCache m_dds_cache;
void cleanupResources(const QGLContext *ctx);
@@ -377,7 +377,11 @@ public:
PixelBufferObject = 0x00000800,
FramebufferBlit = 0x00001000,
NPOTTextures = 0x00002000,
- BGRATextureFormat = 0x00004000
+ BGRATextureFormat = 0x00004000,
+ DDSTextureCompression = 0x00008000,
+ ETC1TextureCompression = 0x00010000,
+ PVRTCTextureCompression = 0x00020000,
+ FragmentShader = 0x00040000
};
Q_DECLARE_FLAGS(Extensions, Extension)
@@ -390,7 +394,7 @@ public:
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions)
-class Q_AUTOTEST_EXPORT QGLShareRegister
+class Q_OPENGL_EXPORT QGLShareRegister
{
public:
QGLShareRegister() {}
@@ -482,6 +486,14 @@ public:
QPixmapData* boundPixmap;
#endif
+ bool canBindCompressedTexture
+ (const char *buf, int len, const char *format, bool *hasAlpha);
+ QSize bindCompressedTexture
+ (const QString& fileName, const char *format = 0);
+ QSize bindCompressedTexture
+ (const char *buf, int len, const char *format = 0);
+ QSize bindCompressedTextureDDS(const char *buf, int len);
+ QSize bindCompressedTexturePVR(const char *buf, int len);
};
class QGLTextureCache {
@@ -518,7 +530,8 @@ bool qt_gl_preferGL2Engine();
inline GLenum qt_gl_preferredTextureFormat()
{
- return QSysInfo::ByteOrder == QSysInfo::BigEndian ? GL_RGBA : GL_BGRA;
+ return (QGLExtensions::glExtensions & QGLExtensions::BGRATextureFormat) && QSysInfo::ByteOrder == QSysInfo::LittleEndian
+ ? GL_BGRA : GL_RGBA;
}
inline GLenum qt_gl_preferredTextureTarget()
@@ -597,6 +610,49 @@ private:
friend class QGLContextGroup;
};
+
+// This class can be used to match GL extensions with doing any mallocs. The
+// class assumes that the GL extension string ends with a space character,
+// which it should do on all conformant platforms. Create the object and pass
+// in a pointer to the extension string, then call match() on each extension
+// that should be matched. The match() function takes the extension name
+// *without* the terminating space character as input.
+
+class QGLExtensionMatcher
+{
+public:
+ QGLExtensionMatcher(const char *str)
+ : gl_extensions(str), gl_extensions_length(qstrlen(str))
+ {}
+
+ bool match(const char *str) {
+ int str_length = qstrlen(str);
+ const char *extensions = gl_extensions;
+ int extensions_length = gl_extensions_length;
+
+ while (1) {
+ // the total length that needs to be matched is the str_length +
+ // the space character that terminates the extension name
+ if (extensions_length < str_length + 1)
+ return false;
+ if (qstrncmp(extensions, str, str_length) == 0 && extensions[str_length] == ' ')
+ return true;
+
+ int split_pos = 0;
+ while (split_pos < extensions_length && extensions[split_pos] != ' ')
+ ++split_pos;
+ ++split_pos; // added for the terminating space character
+ extensions += split_pos;
+ extensions_length -= split_pos;
+ }
+ return false;
+ }
+
+private:
+ const char *gl_extensions;
+ int gl_extensions_length;
+};
+
QT_END_NAMESPACE
#endif // QGL_P_H
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index a037282..9c3fc79 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -343,8 +343,8 @@ void* qglx_getProcAddress(const char* procName)
static bool triedResolvingGlxGetProcAddress = false;
if (!triedResolvingGlxGetProcAddress) {
triedResolvingGlxGetProcAddress = true;
- QList<QByteArray> glxExt = QByteArray(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)).split(' ');
- if (glxExt.contains("GLX_ARB_get_proc_address")) {
+ QGLExtensionMatcher extensions(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS));
+ if (extensions.match("GLX_ARB_get_proc_address")) {
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
void *handle = dlopen(NULL, RTLD_LAZY);
if (handle) {
@@ -523,8 +523,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
if (!d->gpm)
return false;
}
- QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' ');
- if (glxExt.contains("GLX_SGI_video_sync")) {
+ QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
+ if (extensions.match("GLX_SGI_video_sync")) {
if (d->glFormat.swapInterval() == -1)
d->glFormat.setSwapInterval(0);
} else {
@@ -630,8 +630,8 @@ void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth)
static bool useTranspExt = false;
static bool useTranspExtChecked = false;
if (f.plane() && !useTranspExtChecked && d->paintDevice) {
- QByteArray estr(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
- useTranspExt = estr.contains("GLX_EXT_visual_info");
+ QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
+ useTranspExt = extensions.match("GLX_EXT_visual_info");
//# (A bit simplistic; that could theoretically be a substring)
if (useTranspExt) {
QByteArray cstr(glXGetClientString(xinfo->display(), GLX_VENDOR));
@@ -875,8 +875,8 @@ void QGLContext::swapBuffers() const
static bool resolved = false;
if (!resolved) {
const QX11Info *xinfo = qt_x11Info(d->paintDevice);
- QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' ');
- if (glxExt.contains("GLX_SGI_video_sync")) {
+ QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
+ if (extensions.match("GLX_SGI_video_sync")) {
glXGetVideoSyncSGI = (qt_glXGetVideoSyncSGI)qglx_getProcAddress("glXGetVideoSyncSGI");
glXWaitVideoSyncSGI = (qt_glXWaitVideoSyncSGI)qglx_getProcAddress("glXWaitVideoSyncSGI");
}
@@ -1107,8 +1107,8 @@ void *QGLContext::getProcAddress(const QString &proc) const
if (resolved && !glXGetProcAddressARB)
return 0;
if (!glXGetProcAddressARB) {
- QList<QByteArray> glxExt = QByteArray(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)).split(' ');
- if (glxExt.contains("GLX_ARB_get_proc_address")) {
+ QGLExtensionMatcher extensions(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS));
+ if (extensions.match("GLX_ARB_get_proc_address")) {
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
void *handle = dlopen(NULL, RTLD_LAZY);
if (handle) {
@@ -1609,8 +1609,8 @@ static bool qt_resolveTextureFromPixmap(QPaintDevice *paintDevice)
return false; // Can't use TFP without NPOT
}
const QX11Info *xinfo = qt_x11Info(paintDevice);
- QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' ');
- if (glxExt.contains("GLX_EXT_texture_from_pixmap")) {
+ QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
+ if (extensions.match("GLX_EXT_texture_from_pixmap")) {
glXBindTexImageEXT = (qt_glXBindTexImageEXT) qglx_getProcAddress("glXBindTexImageEXT");
glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) qglx_getProcAddress("glXReleaseTexImageEXT");
}
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index b51c239..a868e83 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -63,6 +63,7 @@ void qt_egl_add_platform_config(QEglProperties& props, QPaintDevice *device)
props.setPixelFormat(static_cast<QImage *>(device)->format());
}
+// Chooses the EGL config and creates the EGL context
bool QGLContext::chooseContext(const QGLContext* shareContext)
{
Q_D(QGLContext);
@@ -73,56 +74,74 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
int devType = device()->devType();
// Get the display and initialize it.
- d->eglContext = new QEglContext();
- d->eglContext->setApi(QEgl::OpenGL);
- if (!d->eglContext->openDisplay(device())) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
+ if (d->eglContext == 0) {
+ d->eglContext = new QEglContext();
+ d->eglContext->setApi(QEgl::OpenGL);
+ if (!d->eglContext->openDisplay(device())) {
+ delete d->eglContext;
+ d->eglContext = 0;
+ return false;
+ }
- // Construct the configuration we need for this surface.
- QEglProperties configProps;
- qt_egl_set_format(configProps, devType, d->glFormat);
- qt_egl_add_platform_config(configProps, device());
- configProps.setRenderableType(QEgl::OpenGL);
-
- QEgl::PixelFormatMatch matchType = QEgl::BestPixelFormat;
- if (device()->depth() == 16) {
- configProps.setValue(EGL_RED_SIZE, 5);
- configProps.setValue(EGL_GREEN_SIZE, 6);
- configProps.setValue(EGL_BLUE_SIZE, 5);
- configProps.setValue(EGL_ALPHA_SIZE, 0);
- matchType = QEgl::ExactPixelFormat;
- }
- configProps.setRenderableType(QEgl::OpenGL);
+ // Construct the configuration we need for this surface.
+ QEglProperties configProps;
+ qt_egl_set_format(configProps, devType, d->glFormat);
+ qt_egl_add_platform_config(configProps, device());
+ configProps.setRenderableType(QEgl::OpenGL);
+
+#if We_have_an_EGL_library_which_bothers_to_check_EGL_BUFFER_SIZE
+ if (device()->depth() == 16 && configProps.value(EGL_ALPHA_SIZE) <= 0) {
+ qDebug("Setting EGL_BUFFER_SIZE to 16");
+ configProps.setValue(EGL_BUFFER_SIZE, 16);
+ configProps.setValue(EGL_ALPHA_SIZE, 0);
+ }
- // Search for a matching configuration, reducing the complexity
- // each time until we get something that matches.
- if (!d->eglContext->chooseConfig(configProps, matchType)) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
+ if (!d->eglContext->chooseConfig(configProps, QEgl::BestPixelFormat)) {
+ delete d->eglContext;
+ d->eglContext = 0;
+ return false;
+ }
+#else
+ QEgl::PixelFormatMatch matchType = QEgl::BestPixelFormat;
+ if ((device()->depth() == 16) && configProps.value(EGL_ALPHA_SIZE) == 0) {
+ configProps.setValue(EGL_RED_SIZE, 5);
+ configProps.setValue(EGL_GREEN_SIZE, 6);
+ configProps.setValue(EGL_BLUE_SIZE, 5);
+ configProps.setValue(EGL_ALPHA_SIZE, 0);
+ matchType = QEgl::ExactPixelFormat;
+ }
- // Inform the higher layers about the actual format properties.
- qt_egl_update_format(*(d->eglContext), d->glFormat);
+ // Search for a matching configuration, reducing the complexity
+ // each time until we get something that matches.
+ if (!d->eglContext->chooseConfig(configProps, matchType)) {
+ delete d->eglContext;
+ d->eglContext = 0;
+ return false;
+ }
+#endif
- // Create a new context for the configuration.
- if (!d->eglContext->createContext
- (shareContext ? shareContext->d_func()->eglContext : 0)) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
- d->sharing = d->eglContext->isSharing();
- if (d->sharing && shareContext)
- const_cast<QGLContext *>(shareContext)->d_func()->sharing = true;
+// qDebug("QGLContext::chooseContext() - using EGL config %d:", d->eglContext->config());
+// qDebug() << QEglProperties(d->eglContext->config()).toString();
+
+ // Create a new context for the configuration.
+ if (!d->eglContext->createContext
+ (shareContext ? shareContext->d_func()->eglContext : 0)) {
+ delete d->eglContext;
+ d->eglContext = 0;
+ return false;
+ }
+ d->sharing = d->eglContext->isSharing();
+ if (d->sharing && shareContext)
+ const_cast<QGLContext *>(shareContext)->d_func()->sharing = true;
#if defined(EGL_VERSION_1_1)
- if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget)
- eglSwapInterval(d->eglContext->display(), d->glFormat.swapInterval());
+ if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget)
+ eglSwapInterval(d->eglContext->display(), d->glFormat.swapInterval());
#endif
+ }
+
+ // Inform the higher layers about the actual format properties.
+ qt_egl_update_format(*(d->eglContext), d->glFormat);
return true;
}
@@ -160,6 +179,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
memset(&vi, 0, sizeof(XVisualInfo));
+ EGLint eglConfigColorSize;
+ eglGetConfigAttrib(display, config, EGL_BUFFER_SIZE, &eglConfigColorSize);
+
// Check to see if EGL is suggesting an appropriate visual id:
EGLint nativeVisualId;
eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &nativeVisualId);
@@ -189,8 +211,12 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
} else
#endif
{
-// qDebug("Using opaque X Visual ID (%d) provided by EGL", (int)vi.visualid);
- vi = *chosenVisualInfo;
+ if (eglConfigColorSize == chosenVisualInfo->depth) {
+// qDebug("Using opaque X Visual ID (%d) provided by EGL", (int)vi.visualid);
+ 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!",
+ nativeVisualId, chosenVisualInfo->depth, (int)config, eglConfigColorSize);
}
XFree(chosenVisualInfo);
}
@@ -300,6 +326,8 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext,
bool createFailed = false;
if (!d->glcx->isValid()) {
+ // Create the QGLContext here, which in turn chooses the EGL config
+ // and creates the EGL context:
if (!d->glcx->create(shareContext ? shareContext : oldcx))
createFailed = true;
}
diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h
index 3510765..62e216c 100644
--- a/src/opengl/qglextensions_p.h
+++ b/src/opengl/qglextensions_p.h
@@ -184,6 +184,10 @@ typedef void (APIENTRY *_glBlitFramebufferEXT) (int srcX0, int srcY0, int srcX1,
typedef void (APIENTRY *_glRenderbufferStorageMultisampleEXT) (GLenum target, GLsizei samples,
GLenum internalformat, GLsizei width, GLsizei height);
+// ARB_texture_compression
+typedef void (APIENTRY *_glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei,
+ GLsizei, GLint, GLsizei, const GLvoid *);
+
QT_BEGIN_NAMESPACE
struct QGLExtensionFuncs
@@ -289,6 +293,11 @@ struct QGLExtensionFuncs
#endif
qt_glMapBufferARB = 0;
qt_glUnmapBufferARB = 0;
+
+#if !defined(QT_OPENGL_ES)
+ // Texture compression
+ qt_glCompressedTexImage2DARB = 0;
+#endif
}
@@ -397,6 +406,10 @@ struct QGLExtensionFuncs
_glMapBufferARB qt_glMapBufferARB;
_glUnmapBufferARB qt_glUnmapBufferARB;
+#if !defined(QT_OPENGL_ES)
+ // Texture compression
+ _glCompressedTexImage2DARB qt_glCompressedTexImage2DARB;
+#endif
};
@@ -732,6 +745,10 @@ struct QGLExtensionFuncs
#define glClearDepth glClearDepthf
#endif
+#if !defined(QT_OPENGL_ES)
+#define glCompressedTexImage2D QGLContextPrivate::extensionFuncs(ctx).qt_glCompressedTexImage2DARB
+#endif
+
extern bool qt_resolve_framebufferobject_extensions(QGLContext *ctx);
bool qt_resolve_buffer_extensions(QGLContext *ctx);
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index fb55097..4e1d50d 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -53,6 +53,8 @@
#include <private/qpaintengineex_opengl2_p.h>
#include <qdesktopwidget.h>
+#include <qfile.h>
+#include <qimagereader.h>
QT_BEGIN_NAMESPACE
@@ -321,25 +323,47 @@ void QGLPixmapData::ensureCreated() const
QGLShareContextScope ctx(qt_gl_share_widget()->context());
m_ctx = ctx;
- const GLenum format = qt_gl_preferredTextureFormat();
+ const GLenum internal_format = m_hasAlpha ? GL_RGBA : GL_RGB;
+#ifdef QT_OPENGL_ES_2
+ const GLenum external_format = internal_format;
+#else
+ const GLenum external_format = qt_gl_preferredTextureFormat();
+#endif
const GLenum target = GL_TEXTURE_2D;
if (!m_texture.id) {
glGenTextures(1, &m_texture.id);
glBindTexture(target, m_texture.id);
- GLenum format = m_hasAlpha ? GL_RGBA : GL_RGB;
- glTexImage2D(target, 0, format, w, h, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ glTexImage2D(target, 0, internal_format, w, h, 0, external_format, GL_UNSIGNED_BYTE, 0);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
if (!m_source.isNull()) {
- const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, format);
+ if (external_format == GL_RGB) {
+ QImage tx = m_source.convertToFormat(QImage::Format_RGB32);
+
+ QVector<uchar> pixelData(w * h * 3);
+ uchar *p = &pixelData[0];
+ QRgb *src = (QRgb *)tx.bits();
+
+ for (int i = 0; i < w * h; ++i) {
+ *p++ = qRed(*src);
+ *p++ = qGreen(*src);
+ *p++ = qBlue(*src);
+ ++src;
+ }
- glBindTexture(target, m_texture.id);
- glTexSubImage2D(target, 0, 0, 0, w, h, format,
- GL_UNSIGNED_BYTE, tx.bits());
+ glBindTexture(target, m_texture.id);
+ glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
+ GL_UNSIGNED_BYTE, &pixelData[0]);
+ } else {
+ const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format);
+
+ glBindTexture(target, m_texture.id);
+ glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
+ GL_UNSIGNED_BYTE, tx.bits());
+ }
if (useFramebufferObjects())
m_source = QImage();
@@ -385,6 +409,63 @@ void QGLPixmapData::fromImage(const QImage &image,
}
}
+bool QGLPixmapData::fromFile(const QString &filename, const char *format,
+ Qt::ImageConversionFlags flags)
+{
+ if (pixelType() == QPixmapData::BitmapType)
+ return QPixmapData::fromFile(filename, format, flags);
+ QFile file(filename);
+ if (!file.open(QIODevice::ReadOnly))
+ return false;
+ QByteArray data = file.peek(64);
+ bool alpha;
+ if (m_texture.canBindCompressedTexture
+ (data.constData(), data.size(), format, &alpha)) {
+ resize(0, 0);
+ data = file.readAll();
+ file.close();
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QSize size = m_texture.bindCompressedTexture
+ (data.constData(), data.size(), format);
+ if (!size.isEmpty()) {
+ w = size.width();
+ h = size.height();
+ is_null = false;
+ d = 32;
+ m_hasAlpha = alpha;
+ m_source = QImage();
+ m_dirty = isValid();
+ return true;
+ }
+ return false;
+ }
+ fromImage(QImageReader(&file, format).read(), flags);
+ return !isNull();
+}
+
+bool QGLPixmapData::fromData(const uchar *buffer, uint len, const char *format,
+ Qt::ImageConversionFlags flags)
+{
+ bool alpha;
+ const char *buf = reinterpret_cast<const char *>(buffer);
+ if (m_texture.canBindCompressedTexture(buf, int(len), format, &alpha)) {
+ resize(0, 0);
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QSize size = m_texture.bindCompressedTexture(buf, int(len), format);
+ if (!size.isEmpty()) {
+ w = size.width();
+ h = size.height();
+ is_null = false;
+ d = 32;
+ m_hasAlpha = alpha;
+ m_source = QImage();
+ m_dirty = isValid();
+ return true;
+ }
+ }
+ return QPixmapData::fromData(buffer, len, format, flags);
+}
+
bool QGLPixmapData::scroll(int dx, int dy, const QRect &rect)
{
Q_UNUSED(dx);
diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h
index 8a13e03..007c52a 100644
--- a/src/opengl/qpixmapdata_gl_p.h
+++ b/src/opengl/qpixmapdata_gl_p.h
@@ -106,6 +106,10 @@ public:
// Re-implemented from QPixmapData:
void resize(int width, int height);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
+ bool fromFile(const QString &filename, const char *format,
+ Qt::ImageConversionFlags flags);
+ bool fromData(const uchar *buffer, uint len, const char *format,
+ Qt::ImageConversionFlags flags);
void copy(const QPixmapData *data, const QRect &rect);
bool scroll(int dx, int dy, const QRect &rect);
void fill(const QColor &color);
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index e353f5d..7194f9d 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -493,7 +493,6 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
}
#endif
d_ptr->paintedRegion = QRegion();
-
context()->swapBuffers();
} else {
glFlush();
@@ -688,11 +687,13 @@ void QGLWindowSurface::updateGeometry() {
d_ptr->size = rect.size();
if (d_ptr->ctx) {
+#ifndef QT_OPENGL_ES_2
if (d_ptr->destructive_swap_buffers) {
glBindTexture(target, d_ptr->tex_id);
glTexImage2D(target, 0, GL_RGBA, rect.width(), rect.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindTexture(target, 0);
}
+#endif
return;
}
@@ -756,11 +757,7 @@ void QGLWindowSurface::updateGeometry() {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
-#ifndef QT_OPENGL_ES
glOrtho(0, d_ptr->pb->width(), d_ptr->pb->height(), 0, -999999, 999999);
-#else
- glOrthof(0, d_ptr->pb->width(), d_ptr->pb->height(), 0, -999999, 999999);
-#endif
d_ptr->pb->d_ptr->qctx->d_func()->internal_context = true;
return;
@@ -774,6 +771,7 @@ void QGLWindowSurface::updateGeometry() {
ctx->makeCurrent();
+#ifndef QT_OPENGL_ES_2
if (d_ptr->destructive_swap_buffers) {
glGenTextures(1, &d_ptr->tex_id);
glBindTexture(target, d_ptr->tex_id);
@@ -783,6 +781,7 @@ void QGLWindowSurface::updateGeometry() {
glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glBindTexture(target, 0);
}
+#endif
qDebug() << "QGLWindowSurface: Using plain widget as window surface" << this;;
d_ptr->ctx = ctx;
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 19c90ed..af6f0f0 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -65,12 +65,21 @@ QVGPixmapData::QVGPixmapData(PixelType type)
recreate = true;
#if !defined(QT_NO_EGL)
context = 0;
+ qt_vg_register_pixmap(this);
#endif
setSerialNumber(++qt_vg_pixmap_serial);
}
QVGPixmapData::~QVGPixmapData()
{
+ destroyImageAndContext();
+#if !defined(QT_NO_EGL)
+ qt_vg_unregister_pixmap(this);
+#endif
+}
+
+void QVGPixmapData::destroyImageAndContext()
+{
if (vgImage != VG_INVALID_HANDLE) {
// We need to have a context current to destroy the image.
#if !defined(QT_NO_EGL)
@@ -93,11 +102,16 @@ QVGPixmapData::~QVGPixmapData()
if (vgImageOpacity != VG_INVALID_HANDLE)
vgDestroyImage(vgImageOpacity);
#endif
+ vgImage = VG_INVALID_HANDLE;
+ vgImageOpacity = VG_INVALID_HANDLE;
}
#if !defined(QT_NO_EGL)
- if (context)
- qt_vg_destroy_context(context);
+ if (context) {
+ qt_vg_destroy_context(context, QInternal::Pixmap);
+ context = 0;
+ }
#endif
+ recreate = true;
}
QPixmapData *QVGPixmapData::createCompatiblePixmapData() const
@@ -217,7 +231,7 @@ VGImage QVGPixmapData::toVGImage()
#if !defined(QT_NO_EGL)
// Increase the reference count on the shared context.
if (!context)
- context = qt_vg_create_context(0);
+ context = qt_vg_create_context(0, QInternal::Pixmap);
#endif
if (recreate && prevSize != QSize(w, h)) {
@@ -236,6 +250,10 @@ VGImage QVGPixmapData::toVGImage()
if (vgImage == VG_INVALID_HANDLE) {
vgImage = 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 (vgImage == VG_INVALID_HANDLE)
+ return VG_INVALID_HANDLE;
}
if (!source.isNull() && recreate) {
@@ -266,6 +284,10 @@ VGImage QVGPixmapData::toVGImage(qreal opacity)
if (vgImageOpacity == VG_INVALID_HANDLE) {
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)
+ return VG_INVALID_HANDLE;
}
VGfloat matrix[20] = {
1.0f, 0.0f, 0.0f, 0.0f,
@@ -286,6 +308,17 @@ VGImage QVGPixmapData::toVGImage(qreal opacity)
#endif
}
+void QVGPixmapData::hibernate()
+{
+ // If the image was imported (e.g, from an SgImage under Symbian),
+ // then we cannot copy it back to main memory for storage.
+ if (vgImage != VG_INVALID_HANDLE && source.isNull())
+ return;
+
+ forceToImage();
+ destroyImageAndContext();
+}
+
extern int qt_defaultDpiX();
extern int qt_defaultDpiY();
@@ -376,7 +409,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
// when "0" used as argument then
// default display, context are used
if (!context)
- context = qt_vg_create_context(0);
+ context = qt_vg_create_context(0, QInternal::Pixmap);
if (vgImage != VG_INVALID_HANDLE) {
vgDestroyImage(vgImage);
diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h
index fe19f35..c0bb098 100644
--- a/src/openvg/qpixmapdata_vg_p.h
+++ b/src/openvg/qpixmapdata_vg_p.h
@@ -55,8 +55,6 @@
#include <QtGui/private/qpixmap_raster_p.h>
#include <private/qvg_p.h>
-#if !defined(QT_NO_EGL)
-#endif
#if defined(Q_OS_SYMBIAN)
class RSGImage;
@@ -66,6 +64,15 @@ QT_BEGIN_NAMESPACE
class QEglContext;
+#if !defined(QT_NO_EGL)
+class QVGPixmapData;
+class QVGSharedContext;
+
+void qt_vg_register_pixmap(QVGPixmapData *pd);
+void qt_vg_unregister_pixmap(QVGPixmapData *pd);
+void qt_vg_hibernate_pixmaps(QVGSharedContext *context);
+#endif
+
class Q_OPENVG_EXPORT QVGPixmapData : public QPixmapData
{
public:
@@ -94,6 +101,14 @@ public:
// Return the VGImage form for a specific opacity setting.
virtual VGImage toVGImage(qreal opacity);
+ // 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
+ // toVGImage() is called. Does nothing if the pixmap cannot be
+ // hibernated for some reason (e.g. VGImage is shared with another
+ // process via a SgImage).
+ virtual void hibernate();
+
QSize size() const { return QSize(w, h); }
#if defined(Q_OS_SYMBIAN)
@@ -108,6 +123,16 @@ protected:
void cleanup();
#endif
+#if !defined(QT_NO_EGL)
+private:
+ QVGPixmapData *next;
+ QVGPixmapData *prev;
+
+ friend void qt_vg_register_pixmap(QVGPixmapData *pd);
+ friend void qt_vg_unregister_pixmap(QVGPixmapData *pd);
+ friend void qt_vg_hibernate_pixmaps(QVGSharedContext *context);
+#endif
+
protected:
QSize prevSize;
VGImage vgImage;
@@ -121,6 +146,8 @@ protected:
void forceToImage();
QImage::Format sourceFormat() const;
+
+ void destroyImageAndContext();
};
QT_END_NAMESPACE
diff --git a/src/openvg/qvg_p.h b/src/openvg/qvg_p.h
index 04e2bab..3577013 100644
--- a/src/openvg/qvg_p.h
+++ b/src/openvg/qvg_p.h
@@ -71,11 +71,17 @@ class QEglContext;
// Create an EGL context, but don't bind it to a surface. If single-context
// mode is enabled, this will return the previously-created context.
-Q_OPENVG_EXPORT QEglContext *qt_vg_create_context(QPaintDevice *device);
+// "devType" indicates the type of device using the context, usually
+// QInternal::Widget or QInternal::Pixmap.
+Q_OPENVG_EXPORT QEglContext *qt_vg_create_context
+ (QPaintDevice *device, int devType);
// Destroy an EGL context that was created by qt_vg_create_context().
// If single-context mode is enabled, this will decrease the reference count.
-Q_OPENVG_EXPORT void qt_vg_destroy_context(QEglContext *context);
+// "devType" indicates the type of device destroying the context, usually
+// QInternal::Widget or QInternal::Pixmap.
+Q_OPENVG_EXPORT void qt_vg_destroy_context
+ (QEglContext *context, int devType);
// Return the shared pbuffer surface that can be made current to
// destroy VGImage objects when there is no other surface available.
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index 62871cf..1571083 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -111,15 +111,19 @@ public:
QEglContext *context;
int refCount;
+ int widgetRefCount;
QVGPaintEngine *engine;
EGLSurface surface;
+ QVGPixmapData *firstPixmap;
};
QVGSharedContext::QVGSharedContext()
: context(0)
, refCount(0)
+ , widgetRefCount(0)
, engine(0)
, surface(EGL_NO_SURFACE)
+ , firstPixmap(0)
{
}
@@ -154,6 +158,28 @@ void qt_vg_destroy_paint_engine(QVGPaintEngine *engine)
Q_UNUSED(engine);
}
+void qt_vg_register_pixmap(QVGPixmapData *pd)
+{
+ QVGSharedContext *shared = sharedContext();
+ pd->next = shared->firstPixmap;
+ pd->prev = 0;
+ if (shared->firstPixmap)
+ shared->firstPixmap->prev = pd;
+ shared->firstPixmap = pd;
+}
+
+void qt_vg_unregister_pixmap(QVGPixmapData *pd)
+{
+ if (pd->next)
+ pd->next->prev = pd->prev;
+ if (pd->prev) {
+ pd->prev->next = pd->next;
+ } else {
+ QVGSharedContext *shared = sharedContext();
+ shared->firstPixmap = pd->next;
+ }
+}
+
#else
QVGPaintEngine *qt_vg_create_paint_engine(void)
@@ -166,6 +192,16 @@ void qt_vg_destroy_paint_engine(QVGPaintEngine *engine)
delete engine;
}
+void qt_vg_register_pixmap(QVGPixmapData *pd)
+{
+ Q_UNUSED(pd);
+}
+
+void qt_vg_unregister_pixmap(QVGPixmapData *pd)
+{
+ Q_UNUSED(pd);
+}
+
#endif
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
@@ -278,9 +314,11 @@ static QEglContext *createContext(QPaintDevice *device)
#if !defined(QVG_NO_SINGLE_CONTEXT)
-QEglContext *qt_vg_create_context(QPaintDevice *device)
+QEglContext *qt_vg_create_context(QPaintDevice *device, int devType)
{
QVGSharedContext *shared = sharedContext();
+ if (devType == QInternal::Widget)
+ ++(shared->widgetRefCount);
if (shared->context) {
++(shared->refCount);
return shared->context;
@@ -291,23 +329,65 @@ QEglContext *qt_vg_create_context(QPaintDevice *device)
}
}
-void qt_vg_destroy_context(QEglContext *context)
+static void qt_vg_destroy_shared_context(QVGSharedContext *shared)
+{
+ shared->context->makeCurrent(qt_vg_shared_surface());
+ delete shared->engine;
+ shared->engine = 0;
+ shared->context->doneCurrent();
+ if (shared->surface != EGL_NO_SURFACE) {
+ eglDestroySurface(shared->context->display(), shared->surface);
+ shared->surface = EGL_NO_SURFACE;
+ }
+ delete shared->context;
+ shared->context = 0;
+}
+
+void qt_vg_hibernate_pixmaps(QVGSharedContext *shared)
+{
+ // Artificially increase the reference count to prevent the
+ // context from being destroyed until after we have finished
+ // the hibernation process.
+ ++(shared->refCount);
+
+ // We need a context current to hibernate the VGImage objects.
+ shared->context->makeCurrent(qt_vg_shared_surface());
+
+ // Scan all QVGPixmapData objects in the system and hibernate them.
+ QVGPixmapData *pd = shared->firstPixmap;
+ while (pd != 0) {
+ pd->hibernate();
+ pd = pd->next;
+ }
+
+ // Don't need the current context any more.
+ shared->context->lazyDoneCurrent();
+
+ // Decrease the reference count and destroy the context if necessary.
+ if (--(shared->refCount) <= 0)
+ qt_vg_destroy_shared_context(shared);
+}
+
+void qt_vg_destroy_context(QEglContext *context, int devType)
{
QVGSharedContext *shared = sharedContext();
if (shared->context != context) {
// This is not the shared context. Shouldn't happen!
delete context;
- } else if (--(shared->refCount) <= 0) {
- shared->context->makeCurrent(qt_vg_shared_surface());
- delete shared->engine;
- shared->engine = 0;
- shared->context->doneCurrent();
- if (shared->surface != EGL_NO_SURFACE) {
- eglDestroySurface(shared->context->display(), shared->surface);
- shared->surface = EGL_NO_SURFACE;
- }
- delete shared->context;
- shared->context = 0;
+ return;
+ }
+ if (devType == QInternal::Widget)
+ --(shared->widgetRefCount);
+ if (--(shared->refCount) <= 0) {
+ qt_vg_destroy_shared_context(shared);
+ } else if (shared->widgetRefCount <= 0 && devType == QInternal::Widget) {
+ // All of the widget window surfaces have been destroyed
+ // but we still have VG pixmaps active. Ask them to hibernate
+ // to free up GPU resources until a widget is shown again.
+ // This may eventually cause the EGLContext to be destroyed
+ // because nothing in the system needs a context, which will
+ // free up even more GPU resources.
+ qt_vg_hibernate_pixmaps(shared);
}
}
@@ -338,13 +418,15 @@ EGLSurface qt_vg_shared_surface(void)
#else
-QEglContext *qt_vg_create_context(QPaintDevice *device)
+QEglContext *qt_vg_create_context(QPaintDevice *device, int devType)
{
+ Q_UNUSED(devType);
return createContext(device);
}
-void qt_vg_destroy_context(QEglContext *context)
+void qt_vg_destroy_context(QEglContext *context, int devType)
{
+ Q_UNUSED(devType);
delete context;
}
@@ -434,7 +516,7 @@ QVGEGLWindowSurfaceVGImage::~QVGEGLWindowSurfaceVGImage()
}
if (windowSurface != EGL_NO_SURFACE)
context->destroySurface(windowSurface);
- qt_vg_destroy_context(context);
+ qt_vg_destroy_context(context, QInternal::Widget);
}
}
@@ -453,7 +535,7 @@ QEglContext *QVGEGLWindowSurfaceVGImage::ensureContext(QWidget *widget)
if (!context) {
// Create a new EGL context. We create the surface in beginPaint().
size = newSize;
- context = qt_vg_create_context(widget);
+ context = qt_vg_create_context(widget, QInternal::Widget);
if (!context)
return 0;
isPaintingActive = false;
@@ -548,7 +630,7 @@ QVGEGLWindowSurfaceDirect::~QVGEGLWindowSurfaceDirect()
if (context) {
if (windowSurface != EGL_NO_SURFACE)
context->destroySurface(windowSurface);
- qt_vg_destroy_context(context);
+ qt_vg_destroy_context(context, QInternal::Widget);
}
}
@@ -587,7 +669,7 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget)
qt_vg_destroy_paint_engine(engine);
engine = 0;
context->destroySurface(windowSurface);
- qt_vg_destroy_context(context);
+ qt_vg_destroy_context(context, QInternal::Widget);
context = 0;
windowSurface = EGL_NO_SURFACE;
}
@@ -596,7 +678,7 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget)
if (!context) {
// Create a new EGL context and bind it to the widget surface.
size = newSize;
- context = qt_vg_create_context(widget);
+ context = qt_vg_create_context(widget, QInternal::Widget);
if (!context)
return 0;
// We want a direct to window rendering surface if possible.
@@ -613,7 +695,7 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget)
#endif
EGLSurface surface = context->createSurface(widget, &surfaceProps);
if (surface == EGL_NO_SURFACE) {
- qt_vg_destroy_context(context);
+ qt_vg_destroy_context(context, QInternal::Widget);
context = 0;
return 0;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 4cb0184..4744eb6 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -958,47 +958,47 @@ struct FlagDescription {
};
static const FlagDescription accelerationDescriptions[] = {
- { " DFXL_NONE ", DFXL_NONE },
- { " DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE },
- { " DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE },
- { " DFXL_DRAWLINE", DFXL_DRAWLINE },
- { " DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE },
- { " DFXL_BLIT", DFXL_BLIT },
- { " DFXL_STRETCHBLIT", DFXL_STRETCHBLIT },
- { " DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES },
- { " DFXL_DRAWSTRING", DFXL_DRAWSTRING },
+ { "DFXL_NONE", DFXL_NONE },
+ { "DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE },
+ { "DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE },
+ { "DFXL_DRAWLINE", DFXL_DRAWLINE },
+ { "DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE },
+ { "DFXL_BLIT", DFXL_BLIT },
+ { "DFXL_STRETCHBLIT", DFXL_STRETCHBLIT },
+ { "DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES },
+ { "DFXL_DRAWSTRING", DFXL_DRAWSTRING },
{ 0, 0 }
};
static const FlagDescription blitDescriptions[] = {
- { " DSBLIT_NOFX", DSBLIT_NOFX },
- { " DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL },
- { " DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA },
- { " DSBLIT_COLORIZE", DSBLIT_COLORIZE },
- { " DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY },
- { " DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY },
- { " DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY },
- { " DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY },
- { " DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY },
- { " DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE },
+ { "DSBLIT_NOFX", DSBLIT_NOFX },
+ { "DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL },
+ { "DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA },
+ { "DSBLIT_COLORIZE", DSBLIT_COLORIZE },
+ { "DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY },
+ { "DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY },
+ { "DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY },
+ { "DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY },
+ { "DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY },
+ { "DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE },
#if (Q_DIRECTFB_VERSION >= 0x000923)
- { " DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR },
- { " DSBLIT_XOR", DSBLIT_XOR },
+ { "DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR },
+ { "DSBLIT_XOR", DSBLIT_XOR },
#endif
#if (Q_DIRECTFB_VERSION >= 0x010000)
- { " DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION },
+ { "DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION },
#endif
{ 0, 0 }
};
static const FlagDescription drawDescriptions[] = {
- { " DSDRAW_NOFX", DSDRAW_NOFX },
- { " DSDRAW_BLEND", DSDRAW_BLEND },
- { " DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY },
- { " DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY },
- { " DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY },
- { " DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY },
- { " DSDRAW_XOR", DSDRAW_XOR },
+ { "DSDRAW_NOFX", DSDRAW_NOFX },
+ { "DSDRAW_BLEND", DSDRAW_BLEND },
+ { "DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY },
+ { "DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY },
+ { "DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY },
+ { "DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY },
+ { "DSDRAW_XOR", DSDRAW_XOR },
{ 0, 0 }
};
#endif
@@ -1259,11 +1259,14 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
setIntOption(displayArgs, QLatin1String("height"), &h);
#ifndef QT_NO_DIRECTFB_LAYER
- result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, DLID_PRIMARY,
+ int layerId = DLID_PRIMARY;
+ setIntOption(displayArgs, QLatin1String("layerid"), &layerId);
+
+ result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, static_cast<DFBDisplayLayerID>(layerId),
&d_ptr->dfbLayer);
if (result != DFB_OK) {
DirectFBError("QDirectFBScreen::connect: "
- "Unable to get primary display layer!", result);
+ "Unable to get display layer!", result);
return false;
}
result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 021d52e..b79418a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -128,7 +128,6 @@ IDirectFBWindow *QDirectFBWindowSurface::directFBWindow() const
return (dfbWindow ? dfbWindow : (sibling ? sibling->dfbWindow : 0));
}
-
void QDirectFBWindowSurface::createWindow(const QRect &rect)
{
IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
@@ -169,6 +168,9 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect)
DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result);
if (window()) {
+ if (window()->windowFlags() & Qt::WindowStaysOnTopHint) {
+ dfbWindow->SetStackingClass(dfbWindow, DWSC_UPPER);
+ }
DFBWindowID winid;
result = dfbWindow->GetID(dfbWindow, &winid);
if (result != DFB_OK) {
diff --git a/src/plugins/sqldrivers/sqldrivers.pro b/src/plugins/sqldrivers/sqldrivers.pro
index 2bd5f2c..83d71e4 100644
--- a/src/plugins/sqldrivers/sqldrivers.pro
+++ b/src/plugins/sqldrivers/sqldrivers.pro
@@ -10,6 +10,4 @@ contains(sql-plugins, sqlite) : SUBDIRS += sqlite
contains(sql-plugins, sqlite2) : SUBDIRS += sqlite2
contains(sql-plugins, ibase) : SUBDIRS += ibase
-contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
- symbian:contains(CONFIG, system-sqlite): SUBDIRS += sqlite_symbian
- }
+symbian:contains(CONFIG, system-sqlite): SUBDIRS += sqlite_symbian
diff --git a/src/qt_install.pri b/src/qt_install.pri
index ebeac8d..5b29942 100644
--- a/src/qt_install.pri
+++ b/src/qt_install.pri
@@ -30,6 +30,12 @@ qt_install_headers {
targ_headers.files = $$INSTALL_HEADERS
targ_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET
INSTALLS += targ_headers
+
+ contains(QT_CONFIG,private_tests) {
+ private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES
+ private_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET/private
+ INSTALLS += private_headers
+ }
}
embedded:equals(TARGET, QtGui) {
diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def
index 49c4361..fe752c8 100644
--- a/src/s60installs/bwins/QtCoreu.def
+++ b/src/s60installs/bwins/QtCoreu.def
@@ -2264,7 +2264,7 @@ EXPORTS
?isSequential@QIODevice@@UBE_NXZ @ 2263 NONAME ; bool QIODevice::isSequential(void) const
?isSequential@QIODevicePrivate@@QBE_NXZ @ 2264 NONAME ; bool QIODevicePrivate::isSequential(void) const
?isSequential@QProcess@@UBE_NXZ @ 2265 NONAME ; bool QProcess::isSequential(void) const
- ?isSignalConnected@QObjectPrivate@@QBE_NH@Z @ 2266 NONAME ; bool QObjectPrivate::isSignalConnected(int) const
+ ?isSignalConnected@QObjectPrivate@@QBE_NI@Z @ 2266 NONAME ; bool QObjectPrivate::isSignalConnected(unsigned int) const
?isSimpleText@QString@@QBE_NXZ @ 2267 NONAME ; bool QString::isSimpleText(void) const
?isSingleShot@QTimer@@QBE_NXZ @ 2268 NONAME ; bool QTimer::isSingleShot(void) const
?isSpace@QChar@@QBE_NXZ @ 2269 NONAME ; bool QChar::isSpace(void) const
diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
index 60df1f5..3371fe0 100644
--- a/src/s60installs/bwins/QtGuiu.def
+++ b/src/s60installs/bwins/QtGuiu.def
@@ -12522,4 +12522,3 @@ EXPORTS
?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)
-
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index 429ca79..b6862e5 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -698,13 +698,13 @@ EXPORTS
_ZN11QFontDialogD2Ev @ 697 NONAME
_ZN11QFontEngine11boundingBoxEjRK10QTransform @ 698 NONAME
_ZN11QFontEngine11grayPaletteEv @ 699 NONAME
- _ZN11QFontEngine13setGlyphCacheEN21QFontEngineGlyphCache4TypeEPS0_ @ 700 NONAME
+ _ZN11QFontEngine13setGlyphCacheEN21QFontEngineGlyphCache4TypeEPS0_ @ 700 NONAME ABSENT
_ZN11QFontEngine13setGlyphCacheEPvP21QFontEngineGlyphCache @ 701 NONAME
_ZN11QFontEngine15addGlyphsToPathEPjP11QFixedPointiP12QPainterPath6QFlagsIN9QTextItem10RenderFlagEE @ 702 NONAME
_ZN11QFontEngine16addOutlineToPathEffRK12QGlyphLayoutP12QPainterPath6QFlagsIN9QTextItem10RenderFlagEE @ 703 NONAME
_ZN11QFontEngine16alphaMapForGlyphEj @ 704 NONAME
_ZN11QFontEngine16alphaMapForGlyphEjRK10QTransform @ 705 NONAME
- _ZN11QFontEngine16expireGlyphCacheEv @ 706 NONAME
+ _ZN11QFontEngine16expireGlyphCacheEv @ 706 NONAME ABSENT
_ZN11QFontEngine16getUnscaledGlyphEjP12QPainterPathP15glyph_metrics_t @ 707 NONAME
_ZN11QFontEngine16loadKerningPairsE6QFixed @ 708 NONAME
_ZN11QFontEngine16tightBoundingBoxERK12QGlyphLayout @ 709 NONAME
@@ -7615,8 +7615,8 @@ EXPORTS
_ZNK11QFontDialog11currentFontEv @ 7614 NONAME
_ZNK11QFontDialog12selectedFontEv @ 7615 NONAME
_ZNK11QFontDialog7optionsEv @ 7616 NONAME
- _ZNK11QFontEngine10glyphCacheEN21QFontEngineGlyphCache4TypeERK10QTransform @ 7617 NONAME
- _ZNK11QFontEngine10glyphCacheEPvRK10QTransform @ 7618 NONAME
+ _ZNK11QFontEngine10glyphCacheEN21QFontEngineGlyphCache4TypeERK10QTransform @ 7617 NONAME ABSENT
+ _ZNK11QFontEngine10glyphCacheEPvRK10QTransform @ 7618 NONAME ABSENT
_ZNK11QFontEngine10glyphCountEv @ 7619 NONAME
_ZNK11QFontEngine10propertiesEv @ 7620 NONAME
_ZNK11QFontEngine12getSfntTableEj @ 7621 NONAME
@@ -11741,4 +11741,47 @@ EXPORTS
_ZN11QVectorPathD2Ev @ 11740 NONAME
_ZNK11QVectorPath12addCacheDataEP14QPaintEngineExPvPFvS1_S2_E @ 11741 NONAME
_ZNK20QGraphicsItemPrivate20discardUpdateRequestEbbb @ 11742 NONAME
+ _ZN11QEglContext10extensionsEv @ 11743 NONAME ABSENT
+ _ZN11QEglContext10getDisplayEP12QPaintDevice @ 11744 NONAME ABSENT
+ _ZN11QEglContext10waitClientEv @ 11745 NONAME ABSENT
+ _ZN11QEglContext10waitNativeEv @ 11746 NONAME ABSENT
+ _ZN11QEglContext11doneCurrentEv @ 11747 NONAME ABSENT
+ _ZN11QEglContext11errorStringEi @ 11748 NONAME ABSENT
+ _ZN11QEglContext11makeCurrentEi @ 11749 NONAME ABSENT
+ _ZN11QEglContext11openDisplayEP12QPaintDevice @ 11750 NONAME ABSENT
+ _ZN11QEglContext11swapBuffersEi @ 11751 NONAME ABSENT
+ _ZN11QEglContext12chooseConfigERK14QEglPropertiesN4QEgl16PixelFormatMatchE @ 11752 NONAME ABSENT
+ _ZN11QEglContext12hasExtensionEPKc @ 11753 NONAME ABSENT
+ _ZN11QEglContext13createContextEPS_PK14QEglProperties @ 11754 NONAME ABSENT
+ _ZN11QEglContext13createSurfaceEP12QPaintDevicePK14QEglProperties @ 11755 NONAME ABSENT
+ _ZN11QEglContext14currentContextEN4QEgl3APIE @ 11756 NONAME ABSENT
+ _ZN11QEglContext14defaultDisplayEP12QPaintDevice @ 11757 NONAME ABSENT
+ _ZN11QEglContext14destroySurfaceEi @ 11758 NONAME ABSENT
+ _ZN11QEglContext14dumpAllConfigsEv @ 11759 NONAME ABSENT
+ _ZN11QEglContext15lazyDoneCurrentEv @ 11760 NONAME ABSENT
+ _ZN11QEglContext17setCurrentContextEN4QEgl3APIEPS_ @ 11761 NONAME ABSENT
+ _ZN11QEglContext7destroyEv @ 11762 NONAME ABSENT
+ _ZN11QEglContextC1Ev @ 11763 NONAME ABSENT
+ _ZN11QEglContextC2Ev @ 11764 NONAME ABSENT
+ _ZN11QEglContextD1Ev @ 11765 NONAME ABSENT
+ _ZN11QEglContextD2Ev @ 11766 NONAME ABSENT
+ _ZN14QEglProperties11removeValueEi @ 11767 NONAME ABSENT
+ _ZN14QEglProperties14dumpAllConfigsEv @ 11768 NONAME ABSENT
+ _ZN14QEglProperties14setPixelFormatEN6QImage6FormatE @ 11769 NONAME ABSENT
+ _ZN14QEglProperties17setRenderableTypeEN4QEgl3APIE @ 11770 NONAME ABSENT
+ _ZN14QEglProperties19reduceConfigurationEv @ 11771 NONAME ABSENT
+ _ZN14QEglProperties20setPaintDeviceFormatEP12QPaintDevice @ 11772 NONAME ABSENT
+ _ZN14QEglProperties8setValueEii @ 11773 NONAME ABSENT
+ _ZN14QEglPropertiesC1Ei @ 11774 NONAME ABSENT
+ _ZN14QEglPropertiesC1Ev @ 11775 NONAME ABSENT
+ _ZN14QEglPropertiesC2Ei @ 11776 NONAME ABSENT
+ _ZN14QEglPropertiesC2Ev @ 11777 NONAME ABSENT
+ _ZNK11QEglContext12configAttribEiPi @ 11778 NONAME ABSENT
+ _ZNK11QEglContext16configPropertiesEi @ 11779 NONAME ABSENT
+ _ZNK11QEglContext7isValidEv @ 11780 NONAME ABSENT
+ _ZNK11QEglContext9isCurrentEv @ 11781 NONAME ABSENT
+ _ZNK14QEglProperties5valueEi @ 11782 NONAME ABSENT
+ _ZNK14QEglProperties8toStringEv @ 11783 NONAME ABSENT
+ _ZNK11QFontEngine10glyphCacheEPvN21QFontEngineGlyphCache4TypeERK10QTransform @ 11784 NONAME
+ _ZNK20QGraphicsItemPrivate21effectiveBoundingRectERK6QRectF @ 11785 NONAME
diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def
index 8458983..7526632 100644
--- a/src/s60installs/eabi/QtOpenVGu.def
+++ b/src/s60installs/eabi/QtOpenVGu.def
@@ -1,8 +1,8 @@
EXPORTS
_Z16qPixmapToVGImageRK7QPixmap @ 1 NONAME
- _Z20qt_vg_create_contextP12QPaintDevice @ 2 NONAME
+ _Z20qt_vg_create_contextP12QPaintDevice @ 2 NONAME ABSENT
_Z20qt_vg_shared_surfacev @ 3 NONAME
- _Z21qt_vg_destroy_contextP11QEglContext @ 4 NONAME
+ _Z21qt_vg_destroy_contextP11QEglContext @ 4 NONAME ABSENT
_Z24qt_vg_image_to_vg_formatN6QImage6FormatE @ 5 NONAME
_Z25qt_vg_config_to_vg_formatP11QEglContext @ 6 NONAME
_Z25qt_vg_create_paint_enginev @ 7 NONAME
@@ -169,4 +169,8 @@ EXPORTS
_ZThn8_NK16QVGWindowSurface6metricEN12QPaintDevice17PaintDeviceMetricE @ 168 NONAME
_ZN14QVGPaintEngine10fillRegionERK7QRegionRK6QColorRK5QSize @ 169 NONAME
_ZN20QVGCompositionHelper10blitWindowEmRK5QSizeRK5QRectRK6QPointi @ 170 NONAME
+ _Z20qt_vg_create_contextP12QPaintDevicei @ 171 NONAME
+ _Z21qt_vg_destroy_contextP11QEglContexti @ 172 NONAME
+ _ZN13QVGPixmapData22destroyImageAndContextEv @ 173 NONAME
+ _ZN13QVGPixmapData9hibernateEv @ 174 NONAME
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index b6aa872..1879367 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -33,6 +33,7 @@
#include "qscriptvalue_p.h"
#include "qscriptvalueiterator.h"
#include "qscriptclass.h"
+#include "qscriptcontextinfo.h"
#include "qscriptprogram.h"
#include "qscriptprogram_p.h"
#include "qdebug.h"
@@ -698,9 +699,9 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS
return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number");
#ifndef QT_NO_QOBJECT
QString context;
-// ### implement context resolution
-// if (ctx->parentContext())
-// context = QFileInfo(ctx->parentContext()->fileName()).baseName();
+ QScriptContext *ctx = QScriptEnginePrivate::contextForFrame(exec);
+ if (ctx && ctx->parentContext())
+ context = QFileInfo(QScriptContextInfo(ctx->parentContext()).fileName()).baseName();
#endif
QString text(args.at(0).toString(exec));
#ifndef QT_NO_QOBJECT
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index 8355de2..c62f15c 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -122,14 +122,14 @@ public:
sqlite3_stmt *stmt;
- uint skippedStatus: 1; // the status of the fetchNext() that's skipped
- uint skipRow: 1; // skip the next fetchNext()?
- uint utf8: 1;
+ bool skippedStatus; // the status of the fetchNext() that's skipped
+ bool skipRow; // skip the next fetchNext()?
QSqlRecord rInf;
+ QVector<QVariant> firstRow;
};
QSQLiteResultPrivate::QSQLiteResultPrivate(QSQLiteResult* res) : q(res), access(0),
- stmt(0), skippedStatus(false), skipRow(false), utf8(false)
+ stmt(0), skippedStatus(false), skipRow(false)
{
}
@@ -189,10 +189,17 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int i
// already fetched
Q_ASSERT(!initialFetch);
skipRow = false;
+ for(int i=0;i<firstRow.count();i++)
+ values[i]=firstRow[i];
return skippedStatus;
}
skipRow = initialFetch;
+ if(initialFetch) {
+ firstRow.clear();
+ firstRow.resize(sqlite3_column_count(stmt));
+ }
+
if (!stmt) {
q->setLastError(QSqlError(QCoreApplication::translate("QSQLiteResult", "Unable to fetch row"),
QCoreApplication::translate("QSQLiteResult", "No query"), QSqlError::ConnectionError));
@@ -399,7 +406,7 @@ bool QSQLiteResult::exec()
"Parameter count mismatch"), QString(), QSqlError::StatementError));
return false;
}
- d->skippedStatus = d->fetchNext(cache(), 0, true);
+ d->skippedStatus = d->fetchNext(d->firstRow, 0, true);
if (lastError().isValid()) {
setSelect(false);
setActive(false);
diff --git a/src/sql/kernel/qsqlcachedresult.cpp b/src/sql/kernel/qsqlcachedresult.cpp
index b4a9241..2e4d19e 100644
--- a/src/sql/kernel/qsqlcachedresult.cpp
+++ b/src/sql/kernel/qsqlcachedresult.cpp
@@ -278,6 +278,11 @@ bool QSqlCachedResult::cacheNext()
if (d->atEnd)
return false;
+ if(isForwardOnly()) {
+ d->cache.clear();
+ d->cache.resize(d->colCount);
+ }
+
if (!gotoNext(d->cache, d->nextIndex())) {
d->revertLast();
d->atEnd = true;
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 92d29ae..4215e97 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -256,6 +256,7 @@ SUBDIRS += \
qprinter \
qprinterinfo \
qprocess \
+ qprocessenvironment \
qprogressbar \
qprogressdialog \
qpropertyanimation \
@@ -442,7 +443,6 @@ SUBDIRS += \
qsharedmemory \
qsidebar \
qsizegrip \
- qsoftkeymanager \
qsqldriver \
qsystemsemaphore \
qtconcurrentfilter \
@@ -477,6 +477,10 @@ embedded:!wince* {
SUBDIRS += qtextpiecetable
}
+symbian {
+ SUBDIRS += qsoftkeymanager
+}
+
# Enable the tests specific to QtXmlPatterns. If you add a test, remember to
# update runQtXmlPatternsTests.sh too. Remember that this file, auto.pro, is
# not respected by some test system, they just have a script which loop over
diff --git a/tests/auto/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/qdesktopservices/tst_qdesktopservices.cpp
index 2d9e5dc..c105a97 100644
--- a/tests/auto/qdesktopservices/tst_qdesktopservices.cpp
+++ b/tests/auto/qdesktopservices/tst_qdesktopservices.cpp
@@ -70,6 +70,7 @@ private slots:
void openMailtoUrl();
void openFileUrl_data();
void openFileUrl();
+ void openMultipleFileUrls();
#endif
void handlers();
void storageLocation_data();
@@ -197,6 +198,7 @@ void tst_qdesktopservices::openMailtoUrl()
QFETCH(QUrl, url);
QFETCH(bool, result);
QCOMPARE(QDesktopServices::openUrl(url), result);
+ QTest::qWait(5000);
}
void tst_qdesktopservices::openFileUrl_data()
@@ -239,7 +241,19 @@ void tst_qdesktopservices::openFileUrl()
QFETCH(QUrl, url);
QFETCH(bool, result);
QCOMPARE(QDesktopServices::openUrl(url), result);
- QTest::qWait(15000);
+ QTest::qWait(5000);
+}
+
+void tst_qdesktopservices::openMultipleFileUrls()
+{
+#ifndef RUN_MANUAL_TESTS
+ QSKIP("Test disabled -- only for manual purposes", SkipAll);
+#endif
+
+ QCOMPARE(QDesktopServices::openUrl(QUrl("file:///c:/data/images/image.bmp")), true);
+ QCOMPARE(QDesktopServices::openUrl(QUrl("file:///c:/data/images/image.png")), true);
+ QCOMPARE(QDesktopServices::openUrl(QUrl("file:///c:/data/others/noendofline.txt")), true);
+ QCOMPARE(QDesktopServices::openUrl(QUrl("file:///c:/data/installs/ErrRd.sisx")), true);
}
#endif
diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
index 7f03153..a3f0915 100644
--- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -148,6 +148,7 @@ private slots:
void task255471_decimalsValidation();
void taskQTBUG_5008_textFromValueAndValidate();
+ void taskQTBUG_6670_selectAllWithPrefix();
public slots:
void valueChangedHelper(const QString &);
@@ -1084,5 +1085,16 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate()
QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value()));
}
+void tst_QDoubleSpinBox::taskQTBUG_6670_selectAllWithPrefix()
+{
+ DoubleSpinBox spin;
+ spin.setPrefix("$ ");
+ spin.lineEdit()->selectAll();
+ QTest::keyClick(spin.lineEdit(), Qt::Key_1);
+ QCOMPARE(spin.value(), 1.);
+ QTest::keyClick(spin.lineEdit(), Qt::Key_2);
+ QCOMPARE(spin.value(), 12.);
+}
+
QTEST_MAIN(tst_QDoubleSpinBox)
#include "tst_qdoublespinbox.moc"
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index b49395f..77172fe 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -513,9 +513,11 @@ void tst_QFileInfo::canonicalFilePath()
QFileInfo info("/tmp/../../../../../../../../../../../../../../../../../");
info.canonicalFilePath();
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
// This used to crash on Mac
QFileInfo dontCrash(QLatin1String("/"));
QCOMPARE(dontCrash.canonicalFilePath(), QLatin1String("/"));
+#endif
#ifndef Q_OS_WIN
// test symlinks
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index aa67ac5..1cb9f0d 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -89,6 +89,8 @@ private slots:
void snakeParallelWithLayout();
void parallelToHalfLayout();
void globalSpacing();
+ void graphicsAnchorHandling();
+ void invalidHierarchyCheck();
};
class RectWidget : public QGraphicsWidget
@@ -1196,7 +1198,7 @@ void tst_QGraphicsAnchorLayout::styleDefaults()
QSizeF pref(20, 20);
QSizeF max (50, 50);
- /*
+ /*
create this layout, where a,b have controlType QSizePolicy::RadioButton
c,d have controlType QSizePolicy::PushButton:
+-------+
@@ -1243,9 +1245,9 @@ void tst_QGraphicsAnchorLayout::styleDefaults()
scene.addItem(window);
window->show();
- QGraphicsView *view = new QGraphicsView(&scene);
- view->resize(200, 200);
- view->show();
+ QGraphicsView view(&scene);
+ view.resize(200, 200);
+ view.show();
window->adjustSize();
QCOMPARE(a->geometry(), QRectF(0, 3, 20, 20)); //radio
@@ -1264,10 +1266,13 @@ void tst_QGraphicsAnchorLayout::styleDefaults()
window->setStyle(style);
window->adjustSize();
QCOMPARE(a->geometry(), QRectF(0, 3, 20, 20));
- QCOMPARE(b->geometry(), QRectF(21, 25, 20, 20));
+ QCOMPARE(b->geometry(), QRectF(21, 25, 20, 20));
QCOMPARE(c->geometry(), QRectF(42, 47, 20, 20));
QCOMPARE(d->geometry(), QRectF(63, 69, 20, 20));
QCOMPARE(l->geometry(), QRectF(0, 0, 89, 98));
+
+ window->setStyle(0);
+ delete style;
}
@@ -1776,7 +1781,8 @@ void tst_QGraphicsAnchorLayout::simplificationVsOrder()
QGraphicsWidget *b = createItem(min, pref, max, "B");
QGraphicsWidget *c = createItem(min, pref, max, "C");
- QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
+ QGraphicsWidget frame;
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame);
// Bulk anchors
l->addAnchor(l, Qt::AnchorLeft, a, Qt::AnchorLeft);
@@ -1801,7 +1807,6 @@ void tst_QGraphicsAnchorLayout::simplificationVsOrder()
l->effectiveSizeHint(Qt::MinimumSize);
if (hasSimplification) {
- QEXPECT_FAIL("", "Sequential anchors cannot handle children of opposite directions", Continue);
QCOMPARE(usedSimplex(l, Qt::Horizontal), false);
QCOMPARE(usedSimplex(l, Qt::Vertical), false);
}
@@ -1846,7 +1851,8 @@ void tst_QGraphicsAnchorLayout::simplificationVsRedundance()
QGraphicsWidget *b = createItem(min, pref, max, "B");
QGraphicsWidget *c = createItem(min, pref, max, "C");
- QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
+ QGraphicsWidget frame;
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame);
l->addCornerAnchors(a, Qt::TopLeftCorner, l, Qt::TopLeftCorner);
l->addCornerAnchors(a, Qt::BottomLeftCorner, l, Qt::BottomLeftCorner);
@@ -2016,6 +2022,61 @@ void tst_QGraphicsAnchorLayout::globalSpacing()
QCOMPARE(newHSpacing, hSpacing);
}
+void tst_QGraphicsAnchorLayout::graphicsAnchorHandling()
+{
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout();
+ QGraphicsWidget *a = createItem();
+
+ l->addAnchors(l, a);
+
+ QGraphicsAnchor *layoutAnchor = l->anchor(l, Qt::AnchorTop, l, Qt::AnchorBottom);
+ QGraphicsAnchor *itemAnchor = l->anchor(a, Qt::AnchorTop, a, Qt::AnchorBottom);
+ QGraphicsAnchor *invalidAnchor = l->anchor(a, Qt::AnchorTop, l, Qt::AnchorBottom);
+
+ // Ensure none of these anchors are accessible.
+ QVERIFY(layoutAnchor == 0);
+ QVERIFY(itemAnchor == 0);
+ QVERIFY(invalidAnchor == 0);
+
+ // Hook the anchors to a QObject
+ QObject object;
+ QGraphicsAnchor *userAnchor = l->anchor(l, Qt::AnchorTop, a, Qt::AnchorTop);
+ userAnchor->setParent(&object);
+ userAnchor = l->anchor(l, Qt::AnchorBottom, a, Qt::AnchorBottom);
+ userAnchor->setParent(&object);
+ userAnchor = l->anchor(l, Qt::AnchorRight, a, Qt::AnchorRight);
+ userAnchor->setParent(&object);
+ userAnchor = l->anchor(l, Qt::AnchorLeft, a, Qt::AnchorLeft);
+ userAnchor->setParent(&object);
+
+ QCOMPARE(object.children().size(), 4);
+
+ // Delete layout, this will cause all anchors to be deleted internally.
+ // We expect the public QGraphicsAnchor instances to be deleted too.
+ delete l;
+ QCOMPARE(object.children().size(), 0);
+
+ delete a;
+}
+
+void tst_QGraphicsAnchorLayout::invalidHierarchyCheck()
+{
+ QGraphicsWidget window(0, Qt::Window);
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
+ window.setLayout(l);
+
+ QCOMPARE(l->count(), 0);
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ QVERIFY(!l->addAnchor(l, Qt::AnchorLeft, &window, Qt::AnchorLeft));
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ l->addAnchors(l, &window);
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ l->addCornerAnchors(l, Qt::TopLeftCorner, &window, Qt::TopLeftCorner);
+ QCOMPARE(l->count(), 0);
+}
QTEST_MAIN(tst_QGraphicsAnchorLayout)
#include "tst_qgraphicsanchorlayout.moc"
diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
index baa1ba1..57dc90d 100644
--- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
@@ -356,6 +356,8 @@ void tst_QGraphicsAnchorLayout1::testItemAt()
QVERIFY( layout->itemAt(0) == widget2 );
+ delete widget1;
+
widget->setLayout(layout);
delete widget;
}
@@ -460,6 +462,12 @@ void tst_QGraphicsAnchorLayout1::testAddAndRemoveAnchor()
QCOMPARE( layout->count(), 0 );
+ delete widget1;
+ delete widget2;
+ delete widget3;
+ delete widget4;
+ delete widget5;
+
widget->setLayout(layout);
delete widget;
}
@@ -1740,9 +1748,9 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
QRectF actual = truncate(widgets[item.index]->geometry());
QCOMPARE(actual, expected);
- delete widgets[item.index];
}
+ qDeleteAll(widgets);
delete widget;
}
@@ -2231,8 +2239,9 @@ void tst_QGraphicsAnchorLayout1::testRemoveCenterAnchor()
const BasicLayoutTestResult item = result[i];
QCOMPARE(widgets[item.index]->geometry(), item.rect);
- delete widgets[item.index];
}
+
+ qDeleteAll(widgets);
delete widget;
}
@@ -2360,7 +2369,7 @@ void tst_QGraphicsAnchorLayout1::testSingleSizePolicy()
QFETCH(bool, valid);
// create objects
- QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsWidget widget;
TheAnchorLayout *layout = new TheAnchorLayout;
TestWidget *childWidget = new TestWidget;
@@ -2370,11 +2379,11 @@ void tst_QGraphicsAnchorLayout1::testSingleSizePolicy()
layout->setAnchor( layout, Qt::AnchorTop, childWidget, Qt::AnchorTop, 10 );
layout->setAnchor( childWidget, Qt::AnchorBottom, layout, Qt::AnchorBottom, 10 );
- widget->setLayout( layout );
+ widget.setLayout( layout );
// set test case specific: policy and size
childWidget->setSizePolicy( policy );
- widget->setGeometry( QRectF( QPoint(0,0), size ) );
+ widget.setGeometry( QRectF( QPoint(0,0), size ) );
QCOMPARE( layout->isValid() , valid );
@@ -2516,7 +2525,7 @@ void tst_QGraphicsAnchorLayout1::testDoubleSizePolicy()
QFETCH(qreal, width2);
// create objects
- QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsWidget widget;
TheAnchorLayout *layout = new TheAnchorLayout;
TestWidget *childWidget1 = new TestWidget;
TestWidget *childWidget2 = new TestWidget;
@@ -2526,13 +2535,13 @@ void tst_QGraphicsAnchorLayout1::testDoubleSizePolicy()
layout->setAnchor( childWidget1, Qt::AnchorRight, childWidget2, Qt::AnchorLeft, 10 );
layout->setAnchor( childWidget2, Qt::AnchorRight, layout, Qt::AnchorRight, 10 );
- widget->setLayout( layout );
+ widget.setLayout( layout );
// set test case specific: policy
childWidget1->setSizePolicy( policy1 );
childWidget2->setSizePolicy( policy2 );
- widget->setGeometry( QRectF( QPoint(0,0), QSize( 100,100 ) ) );
+ widget.setGeometry( QRectF( QPoint(0,0), QSize( 100,100 ) ) );
// check results:
if ( width1 == -1.0f ) {
@@ -2649,7 +2658,7 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution()
QFETCH(qreal, width2);
// create objects
- QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsWidget widget;
TheAnchorLayout *layout = new TheAnchorLayout;
TestWidget *childWidget1 = new TestWidget;
TestWidget *childWidget2 = new TestWidget;
@@ -2659,7 +2668,7 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution()
layout->setAnchor( childWidget1, Qt::AnchorRight, childWidget2, Qt::AnchorLeft, 10 );
layout->setAnchor( childWidget2, Qt::AnchorRight, layout, Qt::AnchorRight, 10 );
- widget->setLayout( layout );
+ widget.setLayout( layout );
// set test case specific: size hints
childWidget1->setMinimumWidth( sizeHints1.value( Qt::MinimumSize ) );
@@ -2670,7 +2679,7 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution()
childWidget2->setPreferredWidth( sizeHints2.value( Qt::PreferredSize ) );
childWidget2->setMaximumWidth( sizeHints2.value( Qt::MaximumSize ) );
- widget->setGeometry( QRectF( QPoint(0,0), QSize( 100,100 ) ) );
+ widget.setGeometry( QRectF( QPoint(0,0), QSize( 100,100 ) ) );
// check results:
if ( width1 == -1.0f ) {
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index d216924..259df4d 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -196,8 +196,8 @@ void tst_QGraphicsEffect::source()
// Uninstall effect on QGraphicsItem.
effect->reset();
item->setGraphicsEffect(0);
- QVERIFY(!effect->source());
- QVERIFY(effect->m_sourceChangedFlags & QGraphicsEffect::SourceDetached);
+ QVERIFY(!effect);
+ effect = new CustomEffect;
// The item takes ownership and should delete the effect when destroyed.
item->setGraphicsEffect(effect);
@@ -249,10 +249,10 @@ void tst_QGraphicsEffect::boundingRect()
QCOMPARE(effect->boundingRect(), effect->boundingRectFor(itemRect));
// Uninstall effect on QGraphicsItem.
+ QPointer<CustomEffect> ptr = effect;
item->setGraphicsEffect(0);
- QCOMPARE(effect->boundingRect(), QRectF());
+ QVERIFY(!ptr);
- delete effect;
delete item;
}
@@ -343,11 +343,11 @@ void tst_QGraphicsEffect::draw()
QCOMPARE(item->numRepaints, 0);
// Make sure uninstalling an effect triggers a repaint.
+ QPointer<CustomEffect> ptr = effect;
item->setGraphicsEffect(0);
+ QVERIFY(!ptr);
QTest::qWait(50);
- QCOMPARE(effect->numRepaints, 0);
QCOMPARE(item->numRepaints, 1);
- delete effect;
}
void tst_QGraphicsEffect::opacity()
diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index 9991ab4..7a0d40a 100644
--- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -352,7 +352,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data()
QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates)
<< int(QGraphicsEffect::PadToEffectiveBoundingRect)
- << QSize(30, 30) << QPoint(-10, -10)
+ << QSize(20, 20) << QPoint(-5, -5)
<< 0x00000000u;
QTest::newRow("dev,nopad") << int(Qt::DeviceCoordinates)
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 565a3e7..03a587a 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -233,6 +233,7 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
hints = painter->renderHints();
+ painter->setBrush(brush);
painter->drawRect(boundingRect());
++repaints;
}
@@ -247,6 +248,7 @@ public:
QPainter::RenderHints hints;
int repaints;
QRectF br;
+ QBrush brush;
};
class tst_QGraphicsItem : public QObject
@@ -316,6 +318,7 @@ private slots:
void childrenBoundingRect3();
void group();
void setGroup();
+ void setGroup2();
void nestedGroups();
void warpChildrenIntoGroup();
void removeFromGroup();
@@ -1351,6 +1354,7 @@ void tst_QGraphicsItem::selected()
view.setFixedSize(250, 250);
view.show();
+ QTest::qWaitForWindowShown(&view);
qApp->processEvents();
qApp->processEvents();
@@ -3343,6 +3347,35 @@ void tst_QGraphicsItem::setGroup()
QCOMPARE(rect->parentItem(), (QGraphicsItem *)0);
}
+void tst_QGraphicsItem::setGroup2()
+{
+ QGraphicsScene scene;
+ QGraphicsItemGroup group;
+ scene.addItem(&group);
+
+ QGraphicsRectItem *rect = scene.addRect(50,50,50,50,Qt::NoPen,Qt::black);
+ rect->setTransformOriginPoint(50,50);
+ rect->setRotation(45);
+ rect->setScale(1.5);
+ rect->translate(20,20);
+ group.translate(-30,-40);
+ group.setRotation(180);
+ group.setScale(0.5);
+
+ QTransform oldSceneTransform = rect->sceneTransform();
+ rect->setGroup(&group);
+ QCOMPARE(rect->sceneTransform(), oldSceneTransform);
+
+ group.setRotation(20);
+ group.setScale(2);
+ rect->setRotation(90);
+ rect->setScale(0.8);
+
+ oldSceneTransform = rect->sceneTransform();
+ rect->setGroup(0);
+ QCOMPARE(rect->sceneTransform(), oldSceneTransform);
+}
+
void tst_QGraphicsItem::nestedGroups()
{
QGraphicsItemGroup *group1 = new QGraphicsItemGroup;
@@ -7646,17 +7679,20 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
EventTester *item1 = new EventTester;
item1->br = itemBoundingRect;
item1->setPos(-200, -200);
+ item1->brush = Qt::red;
EventTester *item2 = new EventTester;
item2->br = itemBoundingRect;
item2->setFlag(QGraphicsItem::ItemIgnoresTransformations);
item2->setParentItem(item1);
item2->setPos(200, 200);
+ item2->brush = Qt::green;
EventTester *item3 = new EventTester;
item3->br = itemBoundingRect;
item3->setParentItem(item2);
item3->setPos(80, 80);
+ item3->brush = Qt::blue;
scene.addItem(item1);
QTest::qWait(100);
@@ -7671,8 +7707,8 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
item1->setGraphicsEffect(shadow);
QTest::qWait(50);
- // Make sure all items are repainted.
- QCOMPARE(item1->repaints, 1);
+ // Make sure all visible items are repainted.
+ QCOMPARE(item1->repaints, 0);
QCOMPARE(item2->repaints, 1);
QCOMPARE(item3->repaints, 1);
@@ -7962,6 +7998,22 @@ void tst_QGraphicsItem::setGraphicsEffect()
delete item;
QVERIFY(!blurEffect);
delete anotherItem;
+
+ // Ensure the effect is uninstalled when deleting it
+ item = new QGraphicsRectItem(0, 0, 10, 10);
+ blurEffect = new QGraphicsBlurEffect;
+ item->setGraphicsEffect(blurEffect);
+ delete blurEffect;
+ QVERIFY(!item->graphicsEffect());
+
+ // Ensure the existing effect is uninstalled and deleted when setting a null effect
+ blurEffect = new QGraphicsBlurEffect;
+ item->setGraphicsEffect(blurEffect);
+ item->setGraphicsEffect(0);
+ QVERIFY(!item->graphicsEffect());
+ QVERIFY(!blurEffect);
+
+ delete item;
}
void tst_QGraphicsItem::panel()
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index d3087dc..ab110e6 100644
--- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -146,7 +146,7 @@ void tst_QGraphicsLinearLayout::initTestCase()
{
// since the style will influence the results, we have to ensure
// that the tests are run using the same style on all platforms
-#ifdef Q_WS_S60
+#if defined( Q_WS_S60 )|| defined (Q_WS_WINCE)
QApplication::setStyle(new QWindowsStyle);
#else
QApplication::setStyle(new QPlastiqueStyle);
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 38abc3d..c5e57f7 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -280,6 +280,7 @@ private slots:
void task160653_selectionChanged();
void task250680_childClip();
void taskQTBUG_5904_crashWithDeviceCoordinateCache();
+ void taskQT657_paintIntoCacheWithTransparentParts();
};
void tst_QGraphicsScene::initTestCase()
@@ -1462,6 +1463,7 @@ void tst_QGraphicsScene::focusItemLostFocus()
class ClearTestItem : public QGraphicsRectItem
{
public:
+ ClearTestItem(QGraphicsItem *parent = 0) : QGraphicsRectItem(parent) {}
~ClearTestItem() { qDeleteAll(items); }
QList<QGraphicsItem *> items;
};
@@ -1486,6 +1488,11 @@ void tst_QGraphicsScene::clear()
scene.addItem(secondItem);
QCOMPARE(scene.items().at(0), firstItem);
QCOMPARE(scene.items().at(1), secondItem);
+
+ ClearTestItem *thirdItem = new ClearTestItem(firstItem);
+ QGraphicsItem *forthItem = new QGraphicsRectItem(firstItem);
+ thirdItem->items += forthItem;
+
// must not crash even if firstItem deletes secondItem
scene.clear();
QVERIFY(scene.items().isEmpty());
@@ -4264,5 +4271,43 @@ void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache()
// No crash, then it passed!
}
+void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts()
+{
+ QWidget *w = new QWidget();
+ w->setPalette(Qt::blue);
+ w->setGeometry(0, 0, 50, 50);
+
+ QGraphicsScene *scene = new QGraphicsScene();
+ QGraphicsView *view = new QGraphicsView(scene);
+
+ QGraphicsProxyWidget *proxy = scene->addWidget(w);
+ proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+ proxy->rotate(15);
+
+ view->show();
+ QTest::qWaitForWindowShown(view);
+ w->update(10,10,10,10);
+ QTest::qWait(50);
+
+ QPixmap pix;
+ QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(proxy);
+ QPixmapCache::Key key = itemp->extraItemCache()->deviceData.value(view->viewport()).key;
+ QVERIFY(QPixmapCache::find(key, &pix));
+
+ QTransform t = proxy->sceneTransform();
+ // Map from scene coordinates to pixmap coordinates.
+ // X origin in the pixmap is the most-left point
+ // of the item's boundingRect in the scene.
+ qreal adjust = t.mapRect(proxy->boundingRect().toRect()).left();
+ QRect rect = t.mapRect(QRect(10, 10, 10, 10)).adjusted(-adjust, 0, -adjust + 1, 1);
+ QPixmap subpix = pix.copy(rect);
+
+ QImage im = subpix.toImage();
+ for(int i = 0; i < im.width(); i++) {
+ for(int j = 0; j < im.height(); j++)
+ QCOMPARE(qAlpha(im.pixel(i, j)), 255);
+ }
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 47e21b8..d940a1b 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -169,6 +169,7 @@ private slots:
void task236127_bspTreeIndexFails();
void task243004_setStyleCrash();
void task250119_shortcutContext();
+ void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems();
};
@@ -2882,6 +2883,37 @@ void tst_QGraphicsWidget::autoFillBackground()
QCOMPARE(image.pixel(0, 0), color.rgb());
}
+void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems()
+{
+ QGraphicsScene scene;
+ QGraphicsWidget* parent1 = new QGraphicsWidget;
+ QGraphicsWidget* child1_0 = new QGraphicsWidget;
+ QGraphicsWidget* child1_1 = new QGraphicsWidget;
+
+ QGraphicsWidget* parent2 = new QGraphicsWidget;
+
+ // Add the parent and child to the scene.
+ scene.addItem(parent1);
+ child1_0->setParentItem(parent1);
+ child1_1->setParentItem(parent1);
+
+ // Hide and show the child.
+ child1_0->setParentItem(NULL);
+ scene.removeItem(child1_0);
+
+ // Remove parent from the scene.
+ scene.removeItem(parent1);
+
+ delete child1_0;
+ delete child1_1;
+ delete parent1;
+
+ // Add an item into the scene.
+ scene.addItem(parent2);
+
+ //This should not crash
+}
+
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"
diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp
index cb8f1e9..e165190 100644
--- a/tests/auto/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp
@@ -862,11 +862,18 @@ void tst_QListWidget::moveItemsPriv_data()
QTest::newRow("Empty") << 0 << 0 << 0 << false;
QTest::newRow("Overflow src") << 5 << 5 << 2 << false;
QTest::newRow("Underflow src") << 5 << -1 << 2 << false;
- QTest::newRow("Overflow dst") << 5 << 2 << 5 << false;
+ QTest::newRow("Overflow dst") << 5 << 2 << 6 << false;
QTest::newRow("Underflow dst") << 5 << 2 << -1 << false;
QTest::newRow("Same place") << 5 << 2 << 2 << false;
QTest::newRow("Up") << 5 << 4 << 2 << true;
QTest::newRow("Down") << 5 << 2 << 4 << true;
+ QTest::newRow("QTBUG-6532 assert") << 5 << 0 << 1 << false;
+ QTest::newRow("QTBUG-6565 to the end") << 5 << 3 << 5 << true;
+ QTest::newRow("Same place 2") << 2 << 0 << 1 << false;
+ QTest::newRow("swap") << 2 << 0 << 2 << true;
+ QTest::newRow("swap2") << 4 << 1 << 3 << true;
+ QTest::newRow("swap3") << 4 << 3 << 2 << true;
+ QTest::newRow("swap4") << 2 << 1 << 0 << true;
}
void tst_QListWidget::moveItemsPriv()
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index 7cdfe46..af10ad1 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -82,7 +82,7 @@ private slots:
void keyboardNavigation_data();
void keyboardNavigation();
void focus();
- void overrideMenuAction();
+ void overrideMenuAction();
void statusTip();
void widgetActionFocus();
void mouseActivation();
@@ -103,12 +103,14 @@ private slots:
void task258920_mouseBorder();
void setFixedWidth();
void deleteActionInTriggered();
+ void pushButtonPopulateOnAboutToShow();
protected slots:
void onActivated(QAction*);
void onHighlighted(QAction*);
void onStatusMessageChanged(const QString &);
void onStatusTipTimer();
void deleteAction(QAction *a) { delete a; }
+ void populateMenu();
private:
void createActions();
QMenu *menus[2], *lastMenu;
@@ -258,6 +260,15 @@ void tst_QMenu::onStatusMessageChanged(const QString &s)
statustip=s;
}
+void tst_QMenu::populateMenu(){
+ //just adds 3 dummy actions and a separator.
+ lastMenu->addAction("Foo");
+ lastMenu->addAction("Bar");
+ lastMenu->addAction("FooBar");
+ lastMenu->addSeparator();
+
+}
+
//actual tests
void
@@ -896,7 +907,29 @@ void tst_QMenu::deleteActionInTriggered()
QVERIFY(!a);
}
+void tst_QMenu::pushButtonPopulateOnAboutToShow()
+{
+ QPushButton b("Test PushButton");
+ b.setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
+ lastMenu = new QMenu;
+ b.setMenu(lastMenu);
+ const int scrNumber = QApplication::desktop()->screenNumber(&b);
+ connect(lastMenu, SIGNAL(aboutToShow()), this, SLOT(populateMenu()));
+ b.show();
+ const QRect screen = QApplication::desktop()->screenGeometry(scrNumber);
+ b.move(10, screen.bottom()-b.height()-5);
+ QTest::qWaitForWindowShown(&b);
+ QTimer::singleShot(300,lastMenu, SLOT(hide()));
+ QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center());
+ QVERIFY(!lastMenu->geometry().intersects(b.geometry()));
+
+ b.move(10, screen.bottom()-lastMenu->height()-5);
+ QTimer::singleShot(300,lastMenu, SLOT(hide()));
+ QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center());
+ QVERIFY(!lastMenu->geometry().intersects(b.geometry()));
+
+}
QTEST_MAIN(tst_QMenu)
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index d2073d2..c534cce 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -3230,10 +3230,8 @@ void tst_QObject::isSignalConnected()
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig05()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig15()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig29()")));
- if (sizeof(void *) >= 8) { //on 32bit isSignalConnected only works with the first 32 signals
- QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()")));
- QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()")));
- }
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()")));
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()")));
#endif
QObject::connect(&o, SIGNAL(sig00()), &o, SIGNAL(sig69()));
@@ -3287,6 +3285,8 @@ void tst_QObject::isSignalConnected()
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig04()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig21()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig25()")));
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig55()")));
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()")));
#endif
emit o.sig00();
diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
index 9775d36..c89a182 100644
--- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
@@ -70,6 +70,7 @@ private slots:
void remove();
void clear();
void pixmapKey();
+ void noLeak();
};
static QPixmapCache::KeyData* getPrivate(QPixmapCache::Key &key)
@@ -482,5 +483,23 @@ void tst_QPixmapCache::pixmapKey()
QVERIFY(!getPrivate(key8));
}
+extern int q_QPixmapCache_keyHashSize();
+
+void tst_QPixmapCache::noLeak()
+{
+ QPixmapCache::Key key;
+
+ int oldSize = q_QPixmapCache_keyHashSize();
+ for (int i = 0; i < 100; ++i) {
+ QPixmap pm(128, 128);
+ pm.fill(Qt::transparent);
+ key = QPixmapCache::insert(pm);
+ QPixmapCache::remove(key);
+ }
+ int newSize = q_QPixmapCache_keyHashSize();
+
+ QCOMPARE(oldSize, newSize);
+}
+
QTEST_MAIN(tst_QPixmapCache)
#include "tst_qpixmapcache.moc"
diff --git a/tests/auto/qprocessenvironment/qprocessenvironment.pro b/tests/auto/qprocessenvironment/qprocessenvironment.pro
new file mode 100644
index 0000000..398facc
--- /dev/null
+++ b/tests/auto/qprocessenvironment/qprocessenvironment.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+
+QT = core
+
+SOURCES += tst_qprocessenvironment.cpp
diff --git a/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp
new file mode 100644
index 0000000..1cde33c
--- /dev/null
+++ b/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp
@@ -0,0 +1,265 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest>
+#include <QObject>
+#include <QProcessEnvironment>
+
+// Note:
+// in cross-platform tests, ALWAYS use UPPERCASE variable names
+// That's because on Windows, the variables are uppercased
+
+class tst_QProcessEnvironment: public QObject
+{
+ Q_OBJECT
+private slots:
+ void operator_eq();
+ void clearAndIsEmpty();
+ void insert();
+ void emptyNull();
+ void toStringList();
+
+ void caseSensitivity();
+ void systemEnvironment();
+ void putenv();
+};
+
+void tst_QProcessEnvironment::operator_eq()
+{
+ QProcessEnvironment e1;
+ QVERIFY(e1 == e1);
+ e1.clear();
+ QVERIFY(e1 == e1);
+
+ e1 = QProcessEnvironment();
+ QProcessEnvironment e2;
+ QVERIFY(e1 == e2);
+
+ e1.clear();
+ QVERIFY(e1 != e2);
+
+ e2.clear();
+
+ QVERIFY(e1 == e2);
+}
+
+void tst_QProcessEnvironment::clearAndIsEmpty()
+{
+ QProcessEnvironment e;
+ e.insert("FOO", "bar");
+ QVERIFY(!e.isEmpty());
+ e.clear();
+ QVERIFY(e.isEmpty());
+}
+
+void tst_QProcessEnvironment::insert()
+{
+ QProcessEnvironment e;
+ e.insert("FOO", "bar");
+ QVERIFY(!e.isEmpty());
+ QVERIFY(e.contains("FOO"));
+ QCOMPARE(e.value("FOO"), QString("bar"));
+
+ e.remove("FOO");
+ QVERIFY(!e.contains("FOO"));
+ QVERIFY(e.value("FOO").isNull());
+
+ e.clear();
+ QVERIFY(!e.contains("FOO"));
+}
+
+void tst_QProcessEnvironment::emptyNull()
+{
+ QProcessEnvironment e;
+
+ e.insert("FOO", "");
+ QVERIFY(e.contains("FOO"));
+ QVERIFY(e.value("FOO").isEmpty());
+ QVERIFY(!e.value("FOO").isNull());
+
+ e.insert("FOO", QString());
+ QVERIFY(e.contains("FOO"));
+ QVERIFY(e.value("FOO").isEmpty());
+ // don't test if it's NULL, since we shall not make a guarantee
+
+ e.remove("FOO");
+ QVERIFY(!e.contains("FOO"));
+}
+
+void tst_QProcessEnvironment::toStringList()
+{
+ QProcessEnvironment e;
+ QVERIFY(e.isEmpty());
+ QVERIFY(e.toStringList().isEmpty());
+
+ e.insert("FOO", "bar");
+ QStringList result = e.toStringList();
+ QVERIFY(!result.isEmpty());
+ QCOMPARE(result.length(), 1);
+ QCOMPARE(result.at(0), QString("FOO=bar"));
+
+ e.clear();
+ e.insert("BAZ", "");
+ result = e.toStringList();
+ QCOMPARE(result.at(0), QString("BAZ="));
+
+ e.insert("FOO", "bar");
+ e.insert("A", "bc");
+ e.insert("HELLO", "World");
+ result = e.toStringList();
+ QCOMPARE(result.length(), 4);
+
+ // order is not specified, so use contains()
+ QVERIFY(result.contains("FOO=bar"));
+ QVERIFY(result.contains("BAZ="));
+ QVERIFY(result.contains("A=bc"));
+ QVERIFY(result.contains("HELLO=World"));
+}
+
+void tst_QProcessEnvironment::caseSensitivity()
+{
+ QProcessEnvironment e;
+ e.insert("foo", "bar");
+
+#ifdef Q_OS_WIN
+ // on Windows, it's uppercased
+ QVERIFY(e.contains("foo"));
+ QVERIFY(e.contains("FOO"));
+ QVERIFY(e.contains("FoO"));
+
+ QCOMPARE(e.value("foo"), QString("bar"));
+ QCOMPARE(e.value("FOO"), QString("bar"));
+ QCOMPARE(e.value("FoO"), QString("bar"));
+
+ QStringList list = e.toStringList();
+ QCOMPARE(list.at(0), QString("FOO=bar"));
+#else
+ // otherwise, it's case sensitive
+ QVERIFY(e.contains("foo"));
+ QVERIFY(!e.contains("FOO"));
+
+ e.insert("FOO", "baz");
+ QVERIFY(e.contains("FOO"));
+ QCOMPARE(e.value("FOO"), QString("baz"));
+ QCOMPARE(e.value("foo"), QString("bar"));
+
+ QStringList list = e.toStringList();
+ QVERIFY(list.contains("foo=bar"));
+ QVERIFY(list.contains("FOO=baz"));
+#endif
+}
+
+void tst_QProcessEnvironment::systemEnvironment()
+{
+ static const char envname[] = "THIS_ENVIRONMENT_VARIABLE_HOPEFULLY_DOESNT_EXIST";
+ QByteArray path = qgetenv("PATH");
+ QByteArray nonexistant = qgetenv(envname);
+ QProcessEnvironment system = QProcessEnvironment::systemEnvironment();
+
+ QVERIFY(nonexistant.isNull());
+
+#ifdef Q_WS_WINCE
+ // Windows CE has no environment
+ QVERIFY(path.isEmpty());
+ QVERIFY(!system.contains("PATH"));
+ QVERIFY(system.isEmpty());
+#else
+ // all other system have environments
+ if (path.isEmpty())
+ QFAIL("Could not find the PATH environment variable -- please correct the test environment");
+
+ QVERIFY(system.contains("PATH"));
+ QCOMPARE(system.value("PATH"), QString::fromLocal8Bit(path));
+
+ QVERIFY(!system.contains(envname));
+
+# ifdef Q_OS_WIN
+ // check case-insensitive too
+ QVERIFY(system.contains("path"));
+ QCOMPARE(system.value("path"), QString::fromLocal8Bit(path));
+
+ QVERIFY(!system.contains(QString(envname).toLower()));
+# endif
+#endif
+}
+
+void tst_QProcessEnvironment::putenv()
+{
+#ifdef Q_WS_WINCE
+ QSKIP("Windows CE has no environment", SkipAll);
+#else
+ static const char envname[] = "WE_RE_SETTING_THIS_ENVIRONMENT_VARIABLE";
+ static bool testRan = false;
+
+ if (testRan)
+ QFAIL("You cannot run this test more than once, since we modify the environment");
+ testRan = true;
+
+ QByteArray valBefore = qgetenv(envname);
+ if (!valBefore.isNull())
+ QFAIL("The environment variable we set in the environment is already set! -- please correct the test environment");
+ QProcessEnvironment eBefore = QProcessEnvironment::systemEnvironment();
+
+ qputenv(envname, "Hello, World");
+ QByteArray valAfter = qgetenv(envname);
+ if (valAfter != "Hello, World")
+ QSKIP("Could not test: qputenv did not do its job", SkipAll);
+
+ QProcessEnvironment eAfter = QProcessEnvironment::systemEnvironment();
+
+ QVERIFY(!eBefore.contains(envname));
+ QVERIFY(eAfter.contains(envname));
+ QCOMPARE(eAfter.value(envname), QString("Hello, World"));
+
+# ifdef Q_OS_WIN
+ // check case-insensitive too
+ QString lower = envname;
+ lower = lower.toLower();
+ QVERIFY(!eBefore.contains(lower));
+ QVERIFY(eAfter.contains(lower));
+ QCOMPARE(eAfter.value(lower), QString("Hello, World"));
+# endif
+#endif
+}
+
+QTEST_MAIN(tst_QProcessEnvironment)
+
+#include "tst_qprocessenvironment.moc"
diff --git a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
index f72b6f7..4148594 100644
--- a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
@@ -756,12 +756,12 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
++failedProcesses;
}
- producer.waitForFinished(5000);
+ QVERIFY(producer.waitForFinished(5000));
bool consumerFailed = false;
while (!consumers.isEmpty()) {
- consumers.first()->waitForFinished(2000);
+ QVERIFY(consumers.first()->waitForFinished(3000));
if (consumers.first()->state() == QProcess::Running ||
consumers.first()->exitStatus() != QProcess::NormalExit ||
consumers.first()->exitCode() != 0) {
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index ed9206c..0cb08f9 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -73,6 +73,7 @@ private slots:
void forwardDeclaration2();
void memoryManagement();
void downCast();
+ void functionCallDownCast();
void upCast();
void qobjectWeakManagement();
void noSharedPointerFromWeakQObject();
@@ -503,6 +504,15 @@ void tst_QSharedPointer::downCast()
QCOMPARE(DerivedData::derivedDestructorCounter, destructorCount + 1);
}
+void functionDataByValue(QSharedPointer<Data> p) { Q_UNUSED(p); };
+void functionDataByRef(const QSharedPointer<Data> &p) { Q_UNUSED(p); };
+void tst_QSharedPointer::functionCallDownCast()
+{
+ QSharedPointer<DerivedData> p(new DerivedData());
+ functionDataByValue(p);
+ functionDataByRef(p);
+}
+
void tst_QSharedPointer::upCast()
{
QSharedPointer<Data> baseptr = QSharedPointer<Data>(new DerivedData);
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index f840ca6..cb4e103 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -2493,7 +2493,6 @@ void tst_QSqlDatabase::oci_tables()
QString systemTableName("system."+qTableName("mypassword"));
QVERIFY_SQL(q, exec("CREATE TABLE "+systemTableName+"(name VARCHAR(20))"));
QVERIFY(!db.tables().contains(systemTableName.toUpper()));
- qDebug() << db.tables(QSql::SystemTables);
QVERIFY(db.tables(QSql::SystemTables).contains(systemTableName.toUpper()));
}
diff --git a/tests/auto/qtouchevent/tst_qtouchevent.cpp b/tests/auto/qtouchevent/tst_qtouchevent.cpp
index f95a5c6..da8721c 100644
--- a/tests/auto/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/qtouchevent/tst_qtouchevent.cpp
@@ -48,6 +48,7 @@ public:
QList<QTouchEvent::TouchPoint> touchBeginPoints, touchUpdatePoints, touchEndPoints;
bool seenTouchBegin, seenTouchUpdate, seenTouchEnd;
bool acceptTouchBegin, acceptTouchUpdate, acceptTouchEnd;
+ bool deleteInTouchBegin, deleteInTouchUpdate, deleteInTouchEnd;
tst_QTouchEventWidget()
: QWidget()
@@ -62,6 +63,7 @@ public:
touchEndPoints.clear();
seenTouchBegin = seenTouchUpdate = seenTouchEnd = false;
acceptTouchBegin = acceptTouchUpdate = acceptTouchEnd = true;
+ deleteInTouchBegin = deleteInTouchUpdate = deleteInTouchEnd = false;
}
bool event(QEvent *event)
@@ -74,6 +76,8 @@ public:
seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd;
touchBeginPoints = static_cast<QTouchEvent *>(event)->touchPoints();
event->setAccepted(acceptTouchBegin);
+ if (deleteInTouchBegin)
+ delete this;
break;
case QEvent::TouchUpdate:
if (!seenTouchBegin) qWarning("TouchUpdate: have not seen TouchBegin");
@@ -81,6 +85,8 @@ public:
seenTouchUpdate = seenTouchBegin && !seenTouchEnd;
touchUpdatePoints = static_cast<QTouchEvent *>(event)->touchPoints();
event->setAccepted(acceptTouchUpdate);
+ if (deleteInTouchUpdate)
+ delete this;
break;
case QEvent::TouchEnd:
if (!seenTouchBegin) qWarning("TouchEnd: have not seen TouchBegin");
@@ -88,6 +94,8 @@ public:
seenTouchEnd = seenTouchBegin && !seenTouchEnd;
touchEndPoints = static_cast<QTouchEvent *>(event)->touchPoints();
event->setAccepted(acceptTouchEnd);
+ if (deleteInTouchEnd)
+ delete this;
break;
default:
return QWidget::event(event);
@@ -102,13 +110,21 @@ public:
QList<QTouchEvent::TouchPoint> touchBeginPoints, touchUpdatePoints, touchEndPoints;
bool seenTouchBegin, seenTouchUpdate, seenTouchEnd;
bool acceptTouchBegin, acceptTouchUpdate, acceptTouchEnd;
+ bool deleteInTouchBegin, deleteInTouchUpdate, deleteInTouchEnd;
+ tst_QTouchEventGraphicsItem **weakpointer;
tst_QTouchEventGraphicsItem()
- : QGraphicsItem()
+ : QGraphicsItem(), weakpointer(0)
{
reset();
}
+ ~tst_QTouchEventGraphicsItem()
+ {
+ if (weakpointer)
+ *weakpointer = 0;
+ }
+
void reset()
{
touchBeginPoints.clear();
@@ -116,6 +132,7 @@ public:
touchEndPoints.clear();
seenTouchBegin = seenTouchUpdate = seenTouchEnd = false;
acceptTouchBegin = acceptTouchUpdate = acceptTouchEnd = true;
+ deleteInTouchBegin = deleteInTouchUpdate = deleteInTouchEnd = false;
}
QRectF boundingRect() const { return QRectF(0, 0, 10, 10); }
@@ -131,6 +148,8 @@ public:
seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd;
touchBeginPoints = static_cast<QTouchEvent *>(event)->touchPoints();
event->setAccepted(acceptTouchBegin);
+ if (deleteInTouchBegin)
+ delete this;
break;
case QEvent::TouchUpdate:
if (!seenTouchBegin) qWarning("TouchUpdate: have not seen TouchBegin");
@@ -138,6 +157,8 @@ public:
seenTouchUpdate = seenTouchBegin && !seenTouchEnd;
touchUpdatePoints = static_cast<QTouchEvent *>(event)->touchPoints();
event->setAccepted(acceptTouchUpdate);
+ if (deleteInTouchUpdate)
+ delete this;
break;
case QEvent::TouchEnd:
if (!seenTouchBegin) qWarning("TouchEnd: have not seen TouchBegin");
@@ -145,6 +166,8 @@ public:
seenTouchEnd = seenTouchBegin && !seenTouchEnd;
touchEndPoints = static_cast<QTouchEvent *>(event)->touchPoints();
event->setAccepted(acceptTouchEnd);
+ if (deleteInTouchEnd)
+ delete this;
break;
default:
return QGraphicsItem::sceneEvent(event);
@@ -168,6 +191,8 @@ private slots:
void basicRawEventTranslation();
void multiPointRawEventTranslationOnTouchScreen();
void multiPointRawEventTranslationOnTouchPad();
+ void deleteInEventHandler();
+ void deleteInRawEventTranslation();
};
void tst_QTouchEvent::touchDisabledByDefault()
@@ -496,7 +521,7 @@ void tst_QTouchEvent::touchUpdateAndEndNeverPropagate()
res = QApplication::sendEvent(view.viewport(), &touchUpdateEvent);
QVERIFY(res);
// the scene accepts the event, since it found an item to send the event to
- QVERIFY(touchUpdateEvent.isAccepted());
+ QVERIFY(!touchUpdateEvent.isAccepted());
QVERIFY(child.seenTouchUpdate);
QVERIFY(!root.seenTouchUpdate);
@@ -510,7 +535,7 @@ void tst_QTouchEvent::touchUpdateAndEndNeverPropagate()
res = QApplication::sendEvent(view.viewport(), &touchEndEvent);
QVERIFY(res);
// the scene accepts the event, since it found an item to send the event to
- QVERIFY(touchEndEvent.isAccepted());
+ QVERIFY(!touchEndEvent.isAccepted());
QVERIFY(child.seenTouchEnd);
QVERIFY(!root.seenTouchEnd);
}
@@ -1059,6 +1084,225 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
}
}
+void tst_QTouchEvent::deleteInEventHandler()
+{
+ // QWidget
+ {
+ QWidget window;
+ tst_QTouchEventWidget *child1, *child2, *child3;
+ child1 = new tst_QTouchEventWidget;
+ child2 = new tst_QTouchEventWidget;
+ child3 = new tst_QTouchEventWidget;
+ child1->setParent(&window);
+ child2->setParent(&window);
+ child3->setParent(&window);
+ child1->setAttribute(Qt::WA_AcceptTouchEvents);
+ child2->setAttribute(Qt::WA_AcceptTouchEvents);
+ child3->setAttribute(Qt::WA_AcceptTouchEvents);
+ child1->deleteInTouchBegin = true;
+ child2->deleteInTouchUpdate = true;
+ child3->deleteInTouchEnd = true;
+
+ QList<QTouchEvent::TouchPoint> touchPoints;
+ touchPoints.append(QTouchEvent::TouchPoint(0));
+ QTouchEvent touchBeginEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ touchPoints);
+ QTouchEvent touchUpdateEvent(QEvent::TouchUpdate,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointStationary,
+ touchPoints);
+ QTouchEvent touchEndEvent(QEvent::TouchEnd,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointReleased,
+ touchPoints);
+ QWeakPointer<QWidget> p;
+ bool res;
+
+ touchBeginEvent.ignore();
+ p = child1;
+ res = QApplication::sendEvent(child1, &touchBeginEvent);
+ // event is handled, but widget should be deleted
+ QVERIFY(res && touchBeginEvent.isAccepted() && p.isNull());
+
+ touchBeginEvent.ignore();
+ p = child2;
+ res = QApplication::sendEvent(child2, &touchBeginEvent);
+ QVERIFY(res && touchBeginEvent.isAccepted() && !p.isNull());
+ touchUpdateEvent.ignore();
+ res = QApplication::sendEvent(child2, &touchUpdateEvent);
+ QVERIFY(res && touchUpdateEvent.isAccepted() && p.isNull());
+
+ touchBeginEvent.ignore();
+ p = child3;
+ res = QApplication::sendEvent(child3, &touchBeginEvent);
+ QVERIFY(res && touchBeginEvent.isAccepted() && !p.isNull());
+ touchUpdateEvent.ignore();
+ res = QApplication::sendEvent(child3, &touchUpdateEvent);
+ QVERIFY(res && touchUpdateEvent.isAccepted() && !p.isNull());
+ touchEndEvent.ignore();
+ res = QApplication::sendEvent(child3, &touchEndEvent);
+ QVERIFY(res && touchEndEvent.isAccepted() && p.isNull());
+ }
+
+ // QGraphicsView
+ {
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ tst_QTouchEventGraphicsItem *root, *child1, *child2, *child3;
+ root = new tst_QTouchEventGraphicsItem;
+ child1 = new tst_QTouchEventGraphicsItem;
+ child2 = new tst_QTouchEventGraphicsItem;
+ child3 = new tst_QTouchEventGraphicsItem;
+ child1->setParentItem(root);
+ child2->setParentItem(root);
+ child3->setParentItem(root);
+ child1->setZValue(1.);
+ child2->setZValue(0.);
+ child3->setZValue(-1.);
+ child1->setAcceptTouchEvents(true);
+ child2->setAcceptTouchEvents(true);
+ child3->setAcceptTouchEvents(true);
+ child1->deleteInTouchBegin = true;
+ child2->deleteInTouchUpdate = true;
+ child3->deleteInTouchEnd = true;
+
+ scene.addItem(root);
+ view.resize(200, 200);
+ view.fitInView(scene.sceneRect());
+
+ QTouchEvent::TouchPoint touchPoint(0);
+ touchPoint.setState(Qt::TouchPointPressed);
+ touchPoint.setPos(view.mapFromScene(child1->mapToScene(child1->boundingRect().center())));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ QList<QTouchEvent::TouchPoint> touchPoints;
+ touchPoints.append(touchPoint);
+ QTouchEvent touchBeginEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ touchPoints);
+ touchPoints[0].setState(Qt::TouchPointMoved);
+ QTouchEvent touchUpdateEvent(QEvent::TouchUpdate,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointMoved,
+ touchPoints);
+ touchPoints[0].setState(Qt::TouchPointReleased);
+ QTouchEvent touchEndEvent(QEvent::TouchEnd,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointReleased,
+ touchPoints);
+ bool res;
+
+ child1->weakpointer = &child1;
+ touchBeginEvent.ignore();
+ res = QApplication::sendEvent(view.viewport(), &touchBeginEvent);
+ QVERIFY(res && touchBeginEvent.isAccepted() && !child1);
+ touchUpdateEvent.ignore();
+ res = QApplication::sendEvent(view.viewport(), &touchUpdateEvent);
+ QVERIFY(res && touchUpdateEvent.isAccepted() && !child1);
+ touchEndEvent.ignore();
+ res = QApplication::sendEvent(view.viewport(), &touchEndEvent);
+ QVERIFY(res && touchUpdateEvent.isAccepted() && !child1);
+
+ child2->weakpointer = &child2;
+ touchBeginEvent.ignore();
+ res = QApplication::sendEvent(view.viewport(), &touchBeginEvent);
+ QVERIFY(res && touchBeginEvent.isAccepted() && child2);
+ touchUpdateEvent.ignore();
+ res = QApplication::sendEvent(view.viewport(), &touchUpdateEvent);
+ QVERIFY(res && !touchUpdateEvent.isAccepted() && !child2);
+ touchEndEvent.ignore();
+ res = QApplication::sendEvent(view.viewport(), &touchEndEvent);
+ QVERIFY(res && !touchUpdateEvent.isAccepted() && !child2);
+
+ child3->weakpointer = &child3;
+ res = QApplication::sendEvent(view.viewport(), &touchBeginEvent);
+ QVERIFY(res && touchBeginEvent.isAccepted() && child3);
+ res = QApplication::sendEvent(view.viewport(), &touchUpdateEvent);
+ QVERIFY(res && !touchUpdateEvent.isAccepted() && child3);
+ res = QApplication::sendEvent(view.viewport(), &touchEndEvent);
+ QVERIFY(res && !touchEndEvent.isAccepted() && !child3);
+
+ delete root;
+ }
+}
+
+void tst_QTouchEvent::deleteInRawEventTranslation()
+{
+ tst_QTouchEventWidget touchWidget;
+ touchWidget.setAttribute(Qt::WA_AcceptTouchEvents);
+ touchWidget.setGeometry(100, 100, 300, 300);
+
+ tst_QTouchEventWidget *leftWidget = new tst_QTouchEventWidget;
+ leftWidget->setParent(&touchWidget);
+ leftWidget->setAttribute(Qt::WA_AcceptTouchEvents);
+ leftWidget->setGeometry(0, 100, 100, 100);
+ leftWidget->deleteInTouchBegin = true;
+ leftWidget->show();
+
+ tst_QTouchEventWidget *centerWidget = new tst_QTouchEventWidget;
+ centerWidget->setParent(&touchWidget);
+ centerWidget->setAttribute(Qt::WA_AcceptTouchEvents);
+ centerWidget->setGeometry(100, 100, 100, 100);
+ centerWidget->deleteInTouchUpdate = true;
+ centerWidget->show();
+
+ tst_QTouchEventWidget *rightWidget = new tst_QTouchEventWidget;
+ rightWidget->setParent(&touchWidget);
+ rightWidget->setAttribute(Qt::WA_AcceptTouchEvents);
+ rightWidget->setGeometry(200, 100, 100, 100);
+ rightWidget->deleteInTouchEnd = true;
+ rightWidget->show();
+
+ QPointF leftPos = leftWidget->rect().center();
+ QPointF centerPos = centerWidget->rect().center();
+ QPointF rightPos = rightWidget->rect().center();
+ QPointF leftScreenPos = leftWidget->mapToGlobal(leftPos.toPoint());
+ QPointF centerScreenPos = centerWidget->mapToGlobal(centerPos.toPoint());
+ QPointF rightScreenPos = rightWidget->mapToGlobal(rightPos.toPoint());
+ QRectF screenGeometry = qApp->desktop()->screenGeometry(&touchWidget);
+
+ QWeakPointer<QWidget> pl = leftWidget, pc = centerWidget, pr = rightWidget;
+
+ QList<QTouchEvent::TouchPoint> rawTouchPoints;
+ rawTouchPoints.append(QTouchEvent::TouchPoint(0));
+ rawTouchPoints.append(QTouchEvent::TouchPoint(1));
+ rawTouchPoints.append(QTouchEvent::TouchPoint(2));
+ rawTouchPoints[0].setState(Qt::TouchPointPressed);
+ rawTouchPoints[0].setScreenPos(leftScreenPos);
+ rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
+ rawTouchPoints[1].setState(Qt::TouchPointPressed);
+ rawTouchPoints[1].setScreenPos(centerScreenPos);
+ rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
+ rawTouchPoints[2].setState(Qt::TouchPointPressed);
+ rawTouchPoints[2].setScreenPos(rightScreenPos);
+ rawTouchPoints[2].setNormalizedPos(normalized(rawTouchPoints[2].pos(), screenGeometry));
+
+ // generate begin events on all widgets, the left widget should die
+ qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints);
+ QVERIFY(pl.isNull() && !pc.isNull() && !pr.isNull());
+
+ // generate update events on all widget, the center widget should die
+ rawTouchPoints[0].setState(Qt::TouchPointMoved);
+ rawTouchPoints[1].setState(Qt::TouchPointMoved);
+ rawTouchPoints[2].setState(Qt::TouchPointMoved);
+ qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints);
+
+ // generate end events on all widget, the right widget should die
+ rawTouchPoints[0].setState(Qt::TouchPointReleased);
+ rawTouchPoints[1].setState(Qt::TouchPointReleased);
+ rawTouchPoints[2].setState(Qt::TouchPointReleased);
+ qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints);
+}
+
QTEST_MAIN(tst_QTouchEvent)
#include "tst_qtouchevent.moc"
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index 3d68a73..ae0131c 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -272,6 +272,8 @@ private slots:
void numericalConvert();
void moreCustomTypes();
void variantInVariant();
+
+ void colorInteger();
};
Q_DECLARE_METATYPE(QDate)
@@ -3388,5 +3390,20 @@ void tst_QVariant::variantInVariant()
QCOMPARE(qvariant_cast<QVariant>(var9), var1);
}
+void tst_QVariant::colorInteger()
+{
+ QVariant v = QColor(Qt::red);
+ QCOMPARE(v.type(), QVariant::Color);
+ QCOMPARE(v.value<QColor>(), QColor(Qt::red));
+
+ v.setValue(1000);
+ QCOMPARE(v.type(), QVariant::Int);
+ QCOMPARE(v.toInt(), 1000);
+
+ v.setValue(QColor(Qt::yellow));
+ QCOMPARE(v.type(), QVariant::Color);
+ QCOMPARE(v.value<QColor>(), QColor(Qt::yellow));
+}
+
QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc"
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 9960f47..3e14b56 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -9549,6 +9549,22 @@ void tst_QWidget::setGraphicsEffect()
delete widget;
QVERIFY(!blurEffect);
delete anotherWidget;
+
+ // Ensure the effect is uninstalled when deleting it
+ widget = new QWidget;
+ blurEffect = new QGraphicsBlurEffect;
+ widget->setGraphicsEffect(blurEffect);
+ delete blurEffect;
+ QVERIFY(!widget->graphicsEffect());
+
+ // Ensure the existing effect is uninstalled and deleted when setting a null effect
+ blurEffect = new QGraphicsBlurEffect;
+ widget->setGraphicsEffect(blurEffect);
+ widget->setGraphicsEffect(0);
+ QVERIFY(!widget->graphicsEffect());
+ QVERIFY(!blurEffect);
+
+ delete widget;
}
void tst_QWidget::activateWindow()
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index 9170039..bffa009 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -20,6 +20,24 @@ SUBDIRS = containers-associative \
qregion \
qvariant \
qwidget \
- qtwidgets
+ qtwidgets \
+ qapplication \
+ qdir \
+ qdiriterator \
+ qgraphicsanchorlayout \
+ qgraphicsitem \
+ qgraphicswidget \
+ qmetaobject \
+ qpixmapcache \
+ qquaternion \
+ qscriptclass \
+ qscriptengine \
+ qscriptvalue \
+ qstringbuilder \
+ qstylesheetstyle \
+ qsvgrenderer \
+ qtableview
+
+
contains(QT_CONFIG, opengl): SUBDIRS += opengl
diff --git a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
index 8d5f6e6..1c787e9 100644
--- a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
@@ -72,6 +72,8 @@ private slots:
void toStringHandle();
void castValueToQreal();
void nativeCall();
+ void translation_data();
+ void translation();
};
tst_QScriptEngine::tst_QScriptEngine()
@@ -259,5 +261,24 @@ void tst_QScriptEngine::nativeCall()
}
}
+void tst_QScriptEngine::translation_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::newRow("no translation") << "\"hello world\"";
+ QTest::newRow("qsTr") << "qsTr(\"hello world\")";
+ QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")";
+}
+
+void tst_QScriptEngine::translation()
+{
+ QFETCH(QString, text);
+ QScriptEngine engine;
+ engine.installTranslatorFunctions();
+
+ QBENCHMARK {
+ (void)engine.evaluate(text);
+ }
+}
+
QTEST_MAIN(tst_QScriptEngine)
#include "tst_qscriptengine.moc"
diff --git a/tests/manual/qgraphicsitemgroup/customitem.cpp b/tests/manual/qgraphicsitemgroup/customitem.cpp
new file mode 100644
index 0000000..16da0c5
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/customitem.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "customitem.h"
+
+#include <QPainter>
+#include <QStyle>
+#include <QStyleOption>
+
+QList<CustomGroup*> CustomScene::selectedCustomGroups() const
+{
+ QList<QGraphicsItem*> all = selectedItems();
+ QList<CustomGroup*> groups;
+
+ foreach (QGraphicsItem *item, all) {
+ CustomGroup* group = dynamic_cast<CustomGroup*>(item);
+ if (group)
+ groups.append(group);
+ }
+
+ return groups;
+}
+
+QList<CustomItem*> CustomScene::selectedCustomItems() const
+{
+ QList<QGraphicsItem*> all = selectedItems();
+ QList<CustomItem*> items;
+
+ foreach (QGraphicsItem *item, all) {
+ CustomItem* citem = dynamic_cast<CustomItem*>(item);
+ if (citem)
+ items.append(citem);
+ }
+
+ return items;
+}
+
+CustomGroup::CustomGroup() :
+ QGraphicsItemGroup()
+{
+ setFlag(QGraphicsItem::ItemIsMovable);
+ setFlag(QGraphicsItem::ItemIsSelectable);
+}
+
+void CustomGroup::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ if (option->state & QStyle::State_Selected)
+ painter->setOpacity(1.);
+ else
+ painter->setOpacity(0.2);
+
+ painter->setPen(QPen(QColor(100, 100, 100), 2, Qt::DashLine));
+ painter->drawRect(boundingRect().adjusted(-2, -2, 2, 2));
+}
+
+QRectF CustomGroup::boundingRect() const
+{
+ return QGraphicsItemGroup::boundingRect().adjusted(-4, -4, 4 ,4);
+}
+
+CustomItem::CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush &brush) :
+ QGraphicsRectItem(x, y, width, height)
+{
+ setFlag(QGraphicsItem::ItemIsMovable);
+ setFlag(QGraphicsItem::ItemIsSelectable);
+ setBrush(brush);
+ setPen(Qt::NoPen);
+ setTransformOriginPoint(boundingRect().center());
+}
diff --git a/tests/manual/qgraphicsitemgroup/customitem.h b/tests/manual/qgraphicsitemgroup/customitem.h
new file mode 100644
index 0000000..387c8ce
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/customitem.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CUSTOMITEM_H
+#define CUSTOMITEM_H
+
+#include <QGraphicsItem>
+#include <QBrush>
+#include <QGraphicsScene>
+
+class CustomGroup : public QGraphicsItemGroup
+{
+public:
+ CustomGroup();
+ virtual ~CustomGroup() { }
+
+protected:
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ virtual QRectF boundingRect() const;
+};
+
+class CustomItem : public QGraphicsRectItem
+{
+public:
+ CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush & brush = QBrush());
+ virtual ~CustomItem() { }
+};
+
+class CustomScene : public QGraphicsScene
+{
+ Q_OBJECT
+public:
+ CustomScene() : QGraphicsScene() { }
+
+ QList<CustomItem*> selectedCustomItems() const;
+ QList<CustomGroup*> selectedCustomGroups() const;
+};
+
+#endif // CUSTOMITEM_H
diff --git a/tests/manual/qgraphicsitemgroup/main.cpp b/tests/manual/qgraphicsitemgroup/main.cpp
new file mode 100644
index 0000000..e7a6e11
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include "widget.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ Widget w;
+ w.show();
+ return a.exec();
+}
diff --git a/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro b/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro
new file mode 100644
index 0000000..6676a2e
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro
@@ -0,0 +1,8 @@
+TARGET = qgraphicsitemgroup
+TEMPLATE = app
+SOURCES += main.cpp \
+ widget.cpp \
+ customitem.cpp
+HEADERS += widget.h \
+ customitem.h
+FORMS += widget.ui
diff --git a/tests/manual/qgraphicsitemgroup/widget.cpp b/tests/manual/qgraphicsitemgroup/widget.cpp
new file mode 100644
index 0000000..23bee3f
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/widget.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "widget.h"
+#include "ui_widget.h"
+#include <QGraphicsOpacityEffect>
+#include <QPropertyAnimation>
+
+Widget::Widget(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::Widget),
+ previousSelectionCount(0)
+{
+ ui->setupUi(this);
+
+ effect = new QGraphicsOpacityEffect;
+ effect->setOpacity(0.3);
+ ui->groupBox->setGraphicsEffect(effect);
+
+ fadeIn = new QPropertyAnimation(effect, "opacity");
+ fadeIn->setDuration(200);
+ fadeIn->setStartValue(0.3);
+ fadeIn->setEndValue(1.);
+
+ fadeOut = new QPropertyAnimation(effect, "opacity");
+ fadeOut->setDuration(200);
+ fadeOut->setStartValue(1.);
+ fadeOut->setEndValue(0.3);
+
+ scene = new CustomScene;
+ scene->setSceneRect(-250,-250,500,500);
+ ui->view->setScene(scene);
+ scene->setBackgroundBrush(Qt::white);
+ ui->view->setInteractive(true);
+ ui->view->setDragMode(QGraphicsView::RubberBandDrag);
+ ui->view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+ ui->view->setRenderHints( QPainter::SmoothPixmapTransform |
+ QPainter::TextAntialiasing |
+ QPainter::Antialiasing );
+
+ rectBlue = new CustomItem(-100, -100, 50, 50, QColor(80, 80, 200));
+ scene->addItem(rectBlue);
+ rectGreen = new CustomItem(100, -100, 50, 50, QColor(80, 200, 80));
+ scene->addItem(rectGreen);
+ rectRed = new CustomItem(-100, 100, 50, 50, QColor(200, 80, 80));
+ scene->addItem(rectRed);
+ rectYellow = new CustomItem(100, 100, 50, 50, QColor(200, 200, 20));
+ scene->addItem(rectYellow);
+
+ connect(scene, SIGNAL(selectionChanged()), this, SLOT(onSceneSelectionChanged()));
+}
+
+Widget::~Widget()
+{
+ delete ui;
+ delete fadeIn;
+ delete fadeOut;
+}
+
+void Widget::on_rotate_valueChanged(int value)
+{
+ if (scene->selectedItems().count() != 1)
+ return;
+
+ QGraphicsItem *item = scene->selectedItems().at(0);
+ item->setRotation(value);
+ ui->rotateItem->setValue(checkedItem()->rotation());
+}
+
+void Widget::on_scale_valueChanged(int value)
+{
+ if (scene->selectedItems().count() != 1)
+ return;
+
+ QGraphicsItem *item = scene->selectedItems().at(0);
+ item->setScale(value / 10.);
+ ui->scaleItem->setValue(checkedItem()->scale() * 10);
+}
+
+void Widget::on_rotateItem_valueChanged(int value)
+{
+ if (!scene->selectedItems().empty() && scene->selectedItems().at(0) == checkedItem())
+ ui->rotate->setValue(value);
+ else
+ checkedItem()->setRotation(value);
+}
+
+void Widget::on_scaleItem_valueChanged(int value)
+{
+ if (!scene->selectedItems().empty() && scene->selectedItems().at(0) == checkedItem())
+ ui->scale->setValue(value);
+ else
+ checkedItem()->setScale(value / 10.);
+}
+
+void Widget::on_group_clicked()
+{
+ QList<QGraphicsItem*> all = scene->selectedItems();
+ if (all.size() < 2)
+ return;
+
+ QList<CustomItem*> items = scene->selectedCustomItems();
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+
+ if (groups.size() == 1) {
+ foreach (CustomItem *item, items) {
+ item->setSelected(false);
+ groups[0]->addToGroup(item);
+ }
+
+ return;
+ }
+
+ CustomGroup* group = new CustomGroup;
+ scene->addItem(group);
+ foreach (QGraphicsItem *item, all) {
+ item->setSelected(false);
+ group->addToGroup(item);
+ }
+ group->setSelected(true);
+
+ updateUngroupButton();
+}
+
+void Widget::on_dismantle_clicked()
+{
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+
+ foreach (CustomGroup *group, groups) {
+ foreach (QGraphicsItem *item, group->childItems())
+ group->removeFromGroup(item);
+
+ delete group;
+ }
+
+ updateUngroupButton();
+}
+
+void Widget::on_merge_clicked()
+{
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+ if (groups.size() < 2)
+ return;
+
+ CustomGroup *newBigGroup = groups.takeFirst();
+ foreach (CustomGroup *group, groups) {
+ foreach (QGraphicsItem *item, group->childItems())
+ item->setGroup(newBigGroup);
+
+ delete group;
+ }
+}
+
+void Widget::onSceneSelectionChanged()
+{
+ QList<QGraphicsItem*> all = scene->selectedItems();
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+
+ if (all.empty() && all.count() != previousSelectionCount) {
+ fadeOut->start();
+ } else if (previousSelectionCount == 0) {
+ fadeIn->start();
+ }
+
+ if (all.count() == 1) {
+ QGraphicsItem *item = all.at(0);
+ ui->rotate->setValue(item->rotation());
+ ui->scale->setValue(item->scale() * 10);
+ } else {
+ ui->rotate->setValue(ui->rotate->minimum());
+ ui->scale->setValue(ui->scale->minimum());
+ }
+
+ ui->rotate->setEnabled(all.size() == 1);
+ ui->scale->setEnabled(all.size() == 1);
+ ui->group->setEnabled(all.size() > 1);
+ ui->dismantle->setEnabled(!groups.empty());
+ ui->merge->setEnabled(groups.size() > 1);
+
+ previousSelectionCount = all.size();
+
+ updateUngroupButton();
+}
+
+void Widget::on_ungroup_clicked()
+{
+ QGraphicsItemGroup *oldGroup = checkedItem()->group();
+ checkedItem()->setGroup(0);
+ if (oldGroup && oldGroup->childItems().empty())
+ delete oldGroup;
+
+ updateUngroupButton();
+}
+
+void Widget::updateUngroupButton()
+{
+ ui->ungroup->setEnabled(checkedItem()->group() != 0);
+}
+
+CustomItem * Widget::checkedItem() const
+{
+ CustomItem *item;
+
+ if (ui->blue->isChecked())
+ item = rectBlue;
+ else if (ui->red->isChecked())
+ item = rectRed;
+ else if (ui->green->isChecked())
+ item = rectGreen;
+ else if (ui->yellow->isChecked())
+ item = rectYellow;
+
+ return item;
+}
+
+void Widget::on_buttonGroup_buttonClicked()
+{
+ ui->rotateItem->setValue(checkedItem()->rotation());
+ ui->scaleItem->setValue(checkedItem()->scale() * 10);
+
+ updateUngroupButton();
+}
diff --git a/tests/manual/qgraphicsitemgroup/widget.h b/tests/manual/qgraphicsitemgroup/widget.h
new file mode 100644
index 0000000..affc436
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/widget.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include "customitem.h"
+
+#include <QWidget>
+#include <QGraphicsItemGroup>
+#include <QPainter>
+
+namespace Ui {
+ class Widget;
+}
+
+class QGraphicsOpacityEffect;
+class QPropertyAnimation;
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+public:
+ Widget(QWidget *parent = 0);
+ ~Widget();
+
+protected Q_SLOTS:
+ void on_rotate_valueChanged(int value);
+ void on_scale_valueChanged(int value);
+ void on_rotateItem_valueChanged(int value);
+ void on_scaleItem_valueChanged(int value);
+ void on_group_clicked();
+ void on_dismantle_clicked();
+ void on_merge_clicked();
+ void onSceneSelectionChanged();
+ void on_ungroup_clicked();
+ void on_buttonGroup_buttonClicked();
+
+private:
+ void updateUngroupButton();
+ CustomItem * checkedItem() const;
+
+ Ui::Widget *ui;
+ CustomScene *scene;
+ CustomItem *rectBlue;
+ CustomItem *rectRed;
+ CustomItem *rectGreen;
+ CustomItem *rectYellow;
+ QGraphicsOpacityEffect* effect;
+ QPropertyAnimation *fadeIn;
+ QPropertyAnimation *fadeOut;
+ int previousSelectionCount;
+};
+
+#endif // WIDGET_H
diff --git a/tests/manual/qgraphicsitemgroup/widget.ui b/tests/manual/qgraphicsitemgroup/widget.ui
new file mode 100644
index 0000000..7e3a4df
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/widget.ui
@@ -0,0 +1,319 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Widget</class>
+ <widget class="QWidget" name="Widget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>782</width>
+ <height>695</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Widget</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Items</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QRadioButton" name="blue">
+ <property name="text">
+ <string>Blue</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="red">
+ <property name="text">
+ <string>Red</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="green">
+ <property name="text">
+ <string>Green</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="yellow">
+ <property name="text">
+ <string>Yellow</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Rotate</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="rotateItem">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>360</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Scale</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="scaleItem">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QPushButton" name="ungroup">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Ungroup</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>164</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>300</width>
+ <height>164</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Selection</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Rotate</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="rotate">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>360</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Scale</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="scale">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QPushButton" name="group">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Group</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="merge">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Merge Groups</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="dismantle">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Dismantle Group</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QGraphicsView" name="view"/>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+ <buttongroups>
+ <buttongroup name="buttonGroup"/>
+ </buttongroups>
+</ui>
diff --git a/tests/manual/qwidget_zorder/main.cpp b/tests/manual/qwidget_zorder/main.cpp
new file mode 100644
index 0000000..fe8e0a2
--- /dev/null
+++ b/tests/manual/qwidget_zorder/main.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite 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 <QtGui>
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+public:
+ Widget()
+ {
+ QWidget *stackWidget = new QWidget;
+ stackWidget->setFixedSize(400, 300);
+ button = new QPushButton("pushbutton", stackWidget);
+ plainTextEdit = new QPlainTextEdit(stackWidget);
+ plainTextEdit->setWordWrapMode(QTextOption::NoWrap);
+ QString s = "foo bar bar foo foo bar bar foo";
+ for (int i = 0; i < 10; ++i) {
+ plainTextEdit->appendPlainText(s);
+ s.remove(1, 2);
+ }
+ calendar = new QCalendarWidget(stackWidget);
+ button->move(10, 10);
+ button->resize(100, 100);
+ plainTextEdit->move(30, 70);
+ plainTextEdit->resize(100, 100);
+ calendar->move(80, 40);
+
+ QWidget *buttonOps = new QWidget;
+ QVBoxLayout *l = new QVBoxLayout(buttonOps);
+ QPushButton *lower = new QPushButton("button: lower");
+ connect(lower, SIGNAL(clicked()), button, SLOT(lower()));
+ l->addWidget(lower);
+ QPushButton *raise = new QPushButton("button: raise");
+ connect(raise, SIGNAL(clicked()), button, SLOT(raise()));
+ l->addWidget(raise);
+
+ lower = new QPushButton("calendar: lower");
+ connect(lower, SIGNAL(clicked()), calendar, SLOT(lower()));
+ l->addWidget(lower);
+ raise = new QPushButton("calendar: raise");
+ connect(raise, SIGNAL(clicked()), calendar, SLOT(raise()));
+ l->addWidget(raise);
+ QPushButton *stackUnder = new QPushButton("calendar: stack under textedit");
+ connect(stackUnder, SIGNAL(clicked()), this, SLOT(stackCalendarUnderTextEdit()));
+ l->addWidget(stackUnder);
+
+ lower = new QPushButton("lower textedit");
+ connect(lower, SIGNAL(clicked()), plainTextEdit, SLOT(lower()));
+ l->addWidget(lower);
+ raise = new QPushButton("raise textedit");
+ connect(raise, SIGNAL(clicked()), plainTextEdit, SLOT(raise()));
+ l->addWidget(raise);
+
+ QHBoxLayout *mainLayout = new QHBoxLayout(this);
+ mainLayout->addWidget(buttonOps);
+ mainLayout->addWidget(stackWidget);
+ }
+
+private Q_SLOTS:
+ void stackCalendarUnderTextEdit()
+ {
+ calendar->stackUnder(plainTextEdit);
+ }
+
+private:
+ QPushButton *button;
+ QPlainTextEdit *plainTextEdit;
+ QCalendarWidget *calendar;
+};
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ Widget w;
+ w.show();
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/tests/manual/qwidget_zorder/qwidget_zorder.pro b/tests/manual/qwidget_zorder/qwidget_zorder.pro
new file mode 100644
index 0000000..5526f91
--- /dev/null
+++ b/tests/manual/qwidget_zorder/qwidget_zorder.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp
diff --git a/tools/assistant/lib/qhelpsearchengine.h b/tools/assistant/lib/qhelpsearchengine.h
index 21f04c5..632ac0b 100644
--- a/tools/assistant/lib/qhelpsearchengine.h
+++ b/tools/assistant/lib/qhelpsearchengine.h
@@ -86,7 +86,9 @@ public:
QHelpSearchQueryWidget* queryWidget();
QHelpSearchResultWidget* resultWidget();
+#ifdef QT_DEPRECATED
QT_DEPRECATED int hitsCount() const;
+#endif
int hitCount() const;
typedef QPair<QString, QString> SearchHit;
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 4daa15a..8aa1a67 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -247,6 +247,7 @@ Configure::Configure( int& argc, char** argv )
dictionary[ "PHONON" ] = "auto";
dictionary[ "PHONON_BACKEND" ] = "yes";
dictionary[ "MULTIMEDIA" ] = "yes";
+ dictionary[ "AUDIO_BACKEND" ] = "yes";
dictionary[ "DIRECTSHOW" ] = "no";
dictionary[ "WEBKIT" ] = "auto";
dictionary[ "DECLARATIVE" ] = "auto";
@@ -897,6 +898,10 @@ void Configure::parseCmdLine()
dictionary[ "MULTIMEDIA" ] = "no";
} else if( configCmdLine.at(i) == "-multimedia" ) {
dictionary[ "MULTIMEDIA" ] = "yes";
+ } else if( configCmdLine.at(i) == "-audio-backend" ) {
+ dictionary[ "AUDIO_BACKEND" ] = "yes";
+ } else if( configCmdLine.at(i) == "-no-audio-backend" ) {
+ dictionary[ "AUDIO_BACKEND" ] = "no";
} else if( configCmdLine.at(i) == "-no-phonon" ) {
dictionary[ "PHONON" ] = "no";
} else if( configCmdLine.at(i) == "-phonon" ) {
@@ -1567,9 +1572,9 @@ bool Configure::displayHelp()
"[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform <spec>]\n"
"[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-no-phonon]\n"
"[-phonon] [-no-phonon-backend] [-phonon-backend]\n"
- "[-no-multimedia] [-multimedia] [-no-webkit] [-webkit]\n"
+ "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n"
"[-no-script] [-script] [-no-scripttools] [-scripttools]\n"
- "[-graphicssystem raster|opengl|openvg]\n\n", 0, 7);
+ "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7);
desc("Installation options:\n\n");
@@ -1749,6 +1754,8 @@ bool Configure::displayHelp()
desc("PHONON_BACKEND","yes","-phonon-backend", "Compile in the platform-specific Phonon backend-plugin");
desc("MULTIMEDIA", "no", "-no-multimedia", "Do not compile the multimedia module");
desc("MULTIMEDIA", "yes","-multimedia", "Compile in multimedia module");
+ desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into QtMultimedia");
+ desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into QtMultimedia");
desc("WEBKIT", "no", "-no-webkit", "Do not compile in the WebKit module");
desc("WEBKIT", "yes", "-webkit", "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)");
desc("SCRIPT", "no", "-no-script", "Do not build the QtScript module.");
diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro
index b13c03e..6beafa3 100644
--- a/tools/linguist/lrelease/lrelease.pro
+++ b/tools/linguist/lrelease/lrelease.pro
@@ -16,7 +16,7 @@ include(../../../src/tools/bootstrap/bootstrap.pri)
include(../shared/formats.pri)
include(../shared/proparser.pri)
-win32-msvc*:LIBS += advapi32.lib # for qsettings_win.cpp
+win32:LIBS += -ladvapi32 # for qsettings_win.cpp
target.path=$$[QT_INSTALL_BINS]
INSTALLS += target
diff --git a/util/s60pixelmetrics/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp
index 9507c67..9ba6c8b 100644
--- a/util/s60pixelmetrics/pixel_metrics.cpp
+++ b/util/s60pixelmetrics/pixel_metrics.cpp
@@ -812,13 +812,12 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric)
value = PixelMetricMenuValue(metric, mainPaneRect);
break;
case QStyle::PM_ButtonIconSize:
+ {
//lets use voice recorder icons as a base
//Unfortunately S60 graphics don't separate button bevel graphics from the actual icon.
//Se we have no means to query the margin from bevel border to "central icon" border.
//So, we need to make a estimate...
- const TInt varietyForButtons = !landscape ? 0 : 1;
-
TAknLayoutRect vRMainRect;
vRMainRect.LayoutRect( mainPaneRect, AknLayoutScalable_Apps::main_vorec_pane() );
@@ -833,7 +832,7 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric)
// 0.32 is the estimate how much the icon occupies of the button bevel area
value = vRButtonCellGraphicsRect.Rect().Width() * 0.32;
-
+ }
break;
case QStyle::PM_SmallIconSize:
{