From 2a293f91a6b550cd72851d08616b4a8199faabdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 20:33:25 +0200 Subject: Introducing QT_MMAP In platforms with Large File Support, we use mmap64, to be able to handle offsets (and therefore files) larger than 2Gb. Reviewed-by: Thiago Macieira --- mkspecs/aix-g++-64/qplatformdefs.h | 2 ++ mkspecs/aix-g++/qplatformdefs.h | 2 ++ mkspecs/aix-xlc-64/qplatformdefs.h | 2 ++ mkspecs/aix-xlc/qplatformdefs.h | 2 ++ mkspecs/common/symbian/qplatformdefs.h | 2 ++ mkspecs/common/wince/qplatformdefs.h | 1 + mkspecs/cygwin-g++/qplatformdefs.h | 1 + mkspecs/darwin-g++/qplatformdefs.h | 1 + mkspecs/freebsd-g++/qplatformdefs.h | 1 + mkspecs/hpux-acc-64/qplatformdefs.h | 2 ++ mkspecs/hpux-acc-o64/qplatformdefs.h | 2 ++ mkspecs/hpux-acc/qplatformdefs.h | 2 ++ mkspecs/hpux-g++-64/qplatformdefs.h | 2 ++ mkspecs/hpux-g++/qplatformdefs.h | 2 ++ mkspecs/hpuxi-acc-32/qplatformdefs.h | 2 ++ mkspecs/hpuxi-acc-64/qplatformdefs.h | 2 ++ mkspecs/hpuxi-g++-64/qplatformdefs.h | 2 ++ mkspecs/hurd-g++/qplatformdefs.h | 1 + mkspecs/irix-cc-64/qplatformdefs.h | 2 ++ mkspecs/irix-cc/qplatformdefs.h | 2 ++ mkspecs/irix-g++/qplatformdefs.h | 2 ++ mkspecs/linux-cxx/qplatformdefs.h | 2 ++ mkspecs/linux-ecc-64/qplatformdefs.h | 2 ++ mkspecs/linux-g++-gles2-experimental/qplatformdefs.h | 2 ++ mkspecs/linux-g++/qplatformdefs.h | 2 ++ mkspecs/linux-kcc/qplatformdefs.h | 2 ++ mkspecs/linux-llvm/qplatformdefs.h | 2 ++ mkspecs/linux-lsb-g++/qplatformdefs.h | 2 ++ mkspecs/linux-pgcc/qplatformdefs.h | 2 ++ mkspecs/lynxos-g++/qplatformdefs.h | 1 + mkspecs/macx-g++/qplatformdefs.h | 1 + mkspecs/macx-g++40/qplatformdefs.h | 1 + mkspecs/macx-g++42/qplatformdefs.h | 1 + mkspecs/macx-llvm/qplatformdefs.h | 1 + mkspecs/macx-pbuilder/qplatformdefs.h | 1 + mkspecs/macx-xcode/qplatformdefs.h | 1 + mkspecs/macx-xlc/qplatformdefs.h | 1 + mkspecs/netbsd-g++/qplatformdefs.h | 1 + mkspecs/openbsd-g++/qplatformdefs.h | 1 + mkspecs/sco-cc/qplatformdefs.h | 1 + mkspecs/sco-g++/qplatformdefs.h | 1 + mkspecs/solaris-cc-64/qplatformdefs.h | 2 ++ mkspecs/solaris-cc/qplatformdefs.h | 2 ++ mkspecs/solaris-g++-64/qplatformdefs.h | 2 ++ mkspecs/solaris-g++/qplatformdefs.h | 2 ++ mkspecs/tru64-cxx/qplatformdefs.h | 1 + mkspecs/tru64-g++/qplatformdefs.h | 1 + mkspecs/unixware-cc/qplatformdefs.h | 1 + mkspecs/unixware-g++/qplatformdefs.h | 1 + mkspecs/unsupported/qnx-g++/qplatformdefs.h | 2 ++ mkspecs/unsupported/vxworks-simpentium-g++/qplatformdefs.h | 2 ++ 51 files changed, 81 insertions(+) diff --git a/mkspecs/aix-g++-64/qplatformdefs.h b/mkspecs/aix-g++-64/qplatformdefs.h index 5a1cda8..25c86a2 100644 --- a/mkspecs/aix-g++-64/qplatformdefs.h +++ b/mkspecs/aix-g++-64/qplatformdefs.h @@ -109,6 +109,7 @@ #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 @@ -117,6 +118,7 @@ #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 diff --git a/mkspecs/aix-g++/qplatformdefs.h b/mkspecs/aix-g++/qplatformdefs.h index 5a1cda8..25c86a2 100644 --- a/mkspecs/aix-g++/qplatformdefs.h +++ b/mkspecs/aix-g++/qplatformdefs.h @@ -109,6 +109,7 @@ #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 @@ -117,6 +118,7 @@ #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 diff --git a/mkspecs/aix-xlc-64/qplatformdefs.h b/mkspecs/aix-xlc-64/qplatformdefs.h index 0a0d11f..a25ea42 100644 --- a/mkspecs/aix-xlc-64/qplatformdefs.h +++ b/mkspecs/aix-xlc-64/qplatformdefs.h @@ -105,6 +105,7 @@ #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 @@ -113,6 +114,7 @@ #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 diff --git a/mkspecs/aix-xlc/qplatformdefs.h b/mkspecs/aix-xlc/qplatformdefs.h index b162513..3856600 100644 --- a/mkspecs/aix-xlc/qplatformdefs.h +++ b/mkspecs/aix-xlc/qplatformdefs.h @@ -105,6 +105,7 @@ #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 @@ -113,6 +114,7 @@ #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 diff --git a/mkspecs/common/symbian/qplatformdefs.h b/mkspecs/common/symbian/qplatformdefs.h index 2d0e6e8..e1d8f6a 100644 --- a/mkspecs/common/symbian/qplatformdefs.h +++ b/mkspecs/common/symbian/qplatformdefs.h @@ -112,6 +112,7 @@ #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 @@ -120,6 +121,7 @@ #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 diff --git a/mkspecs/common/wince/qplatformdefs.h b/mkspecs/common/wince/qplatformdefs.h index f00ed71..eecbd1e 100644 --- a/mkspecs/common/wince/qplatformdefs.h +++ b/mkspecs/common/wince/qplatformdefs.h @@ -111,6 +111,7 @@ #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 diff --git a/mkspecs/cygwin-g++/qplatformdefs.h b/mkspecs/cygwin-g++/qplatformdefs.h index 78f7398..6cf02f2 100644 --- a/mkspecs/cygwin-g++/qplatformdefs.h +++ b/mkspecs/cygwin-g++/qplatformdefs.h @@ -119,6 +119,7 @@ #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 diff --git a/mkspecs/darwin-g++/qplatformdefs.h b/mkspecs/darwin-g++/qplatformdefs.h index 31e32f1..8ae5606 100644 --- a/mkspecs/darwin-g++/qplatformdefs.h +++ b/mkspecs/darwin-g++/qplatformdefs.h @@ -79,6 +79,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/freebsd-g++/qplatformdefs.h b/mkspecs/freebsd-g++/qplatformdefs.h index 470923a..8b07cdc 100644 --- a/mkspecs/freebsd-g++/qplatformdefs.h +++ b/mkspecs/freebsd-g++/qplatformdefs.h @@ -81,6 +81,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/hpux-acc-64/qplatformdefs.h b/mkspecs/hpux-acc-64/qplatformdefs.h index a8025d0..7ef3d51 100644 --- a/mkspecs/hpux-acc-64/qplatformdefs.h +++ b/mkspecs/hpux-acc-64/qplatformdefs.h @@ -104,6 +104,7 @@ #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 @@ -112,6 +113,7 @@ #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 diff --git a/mkspecs/hpux-acc-o64/qplatformdefs.h b/mkspecs/hpux-acc-o64/qplatformdefs.h index 4927cf9..e082d9d 100644 --- a/mkspecs/hpux-acc-o64/qplatformdefs.h +++ b/mkspecs/hpux-acc-o64/qplatformdefs.h @@ -105,6 +105,7 @@ #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 @@ -113,6 +114,7 @@ #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 diff --git a/mkspecs/hpux-acc/qplatformdefs.h b/mkspecs/hpux-acc/qplatformdefs.h index ec416cd..7b540a1 100644 --- a/mkspecs/hpux-acc/qplatformdefs.h +++ b/mkspecs/hpux-acc/qplatformdefs.h @@ -107,6 +107,7 @@ #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 @@ -115,6 +116,7 @@ #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 diff --git a/mkspecs/hpux-g++-64/qplatformdefs.h b/mkspecs/hpux-g++-64/qplatformdefs.h index 31aa7ff..a8d06d8 100644 --- a/mkspecs/hpux-g++-64/qplatformdefs.h +++ b/mkspecs/hpux-g++-64/qplatformdefs.h @@ -104,6 +104,7 @@ #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 @@ -112,6 +113,7 @@ #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 diff --git a/mkspecs/hpux-g++/qplatformdefs.h b/mkspecs/hpux-g++/qplatformdefs.h index 2c46b7d..d89a026 100644 --- a/mkspecs/hpux-g++/qplatformdefs.h +++ b/mkspecs/hpux-g++/qplatformdefs.h @@ -106,6 +106,7 @@ #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 @@ -114,6 +115,7 @@ #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 diff --git a/mkspecs/hpuxi-acc-32/qplatformdefs.h b/mkspecs/hpuxi-acc-32/qplatformdefs.h index f02de1f..466f27e 100644 --- a/mkspecs/hpuxi-acc-32/qplatformdefs.h +++ b/mkspecs/hpuxi-acc-32/qplatformdefs.h @@ -105,6 +105,7 @@ #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 @@ -113,6 +114,7 @@ #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 diff --git a/mkspecs/hpuxi-acc-64/qplatformdefs.h b/mkspecs/hpuxi-acc-64/qplatformdefs.h index f02de1f..466f27e 100644 --- a/mkspecs/hpuxi-acc-64/qplatformdefs.h +++ b/mkspecs/hpuxi-acc-64/qplatformdefs.h @@ -105,6 +105,7 @@ #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 @@ -113,6 +114,7 @@ #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 diff --git a/mkspecs/hpuxi-g++-64/qplatformdefs.h b/mkspecs/hpuxi-g++-64/qplatformdefs.h index 546a7b5..d351af3 100644 --- a/mkspecs/hpuxi-g++-64/qplatformdefs.h +++ b/mkspecs/hpuxi-g++-64/qplatformdefs.h @@ -104,6 +104,7 @@ #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 @@ -112,6 +113,7 @@ #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 diff --git a/mkspecs/hurd-g++/qplatformdefs.h b/mkspecs/hurd-g++/qplatformdefs.h index d5aaf66..611252c 100644 --- a/mkspecs/hurd-g++/qplatformdefs.h +++ b/mkspecs/hurd-g++/qplatformdefs.h @@ -87,6 +87,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/irix-cc-64/qplatformdefs.h b/mkspecs/irix-cc-64/qplatformdefs.h index 6d436a1..bfb19ca 100644 --- a/mkspecs/irix-cc-64/qplatformdefs.h +++ b/mkspecs/irix-cc-64/qplatformdefs.h @@ -103,6 +103,7 @@ #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 @@ -111,6 +112,7 @@ #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 diff --git a/mkspecs/irix-cc/qplatformdefs.h b/mkspecs/irix-cc/qplatformdefs.h index 6d436a1..bfb19ca 100644 --- a/mkspecs/irix-cc/qplatformdefs.h +++ b/mkspecs/irix-cc/qplatformdefs.h @@ -103,6 +103,7 @@ #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 @@ -111,6 +112,7 @@ #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 diff --git a/mkspecs/irix-g++/qplatformdefs.h b/mkspecs/irix-g++/qplatformdefs.h index 8191c15..4e2fda2 100644 --- a/mkspecs/irix-g++/qplatformdefs.h +++ b/mkspecs/irix-g++/qplatformdefs.h @@ -103,6 +103,7 @@ #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 @@ -111,6 +112,7 @@ #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 diff --git a/mkspecs/linux-cxx/qplatformdefs.h b/mkspecs/linux-cxx/qplatformdefs.h index 5bf9686..0c3a07e 100644 --- a/mkspecs/linux-cxx/qplatformdefs.h +++ b/mkspecs/linux-cxx/qplatformdefs.h @@ -110,6 +110,7 @@ #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 @@ -118,6 +119,7 @@ #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 diff --git a/mkspecs/linux-ecc-64/qplatformdefs.h b/mkspecs/linux-ecc-64/qplatformdefs.h index 5bf9686..0c3a07e 100644 --- a/mkspecs/linux-ecc-64/qplatformdefs.h +++ b/mkspecs/linux-ecc-64/qplatformdefs.h @@ -110,6 +110,7 @@ #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 @@ -118,6 +119,7 @@ #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 diff --git a/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h b/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h index 1430916..ecfbc73 100644 --- a/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h +++ b/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h @@ -110,6 +110,7 @@ #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 @@ -118,6 +119,7 @@ #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 diff --git a/mkspecs/linux-g++/qplatformdefs.h b/mkspecs/linux-g++/qplatformdefs.h index 1430916..ecfbc73 100644 --- a/mkspecs/linux-g++/qplatformdefs.h +++ b/mkspecs/linux-g++/qplatformdefs.h @@ -110,6 +110,7 @@ #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 @@ -118,6 +119,7 @@ #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 diff --git a/mkspecs/linux-kcc/qplatformdefs.h b/mkspecs/linux-kcc/qplatformdefs.h index 48a289b..65278c8 100644 --- a/mkspecs/linux-kcc/qplatformdefs.h +++ b/mkspecs/linux-kcc/qplatformdefs.h @@ -113,6 +113,7 @@ #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 @@ -121,6 +122,7 @@ #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 diff --git a/mkspecs/linux-llvm/qplatformdefs.h b/mkspecs/linux-llvm/qplatformdefs.h index 1430916..ecfbc73 100644 --- a/mkspecs/linux-llvm/qplatformdefs.h +++ b/mkspecs/linux-llvm/qplatformdefs.h @@ -110,6 +110,7 @@ #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 @@ -118,6 +119,7 @@ #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 diff --git a/mkspecs/linux-lsb-g++/qplatformdefs.h b/mkspecs/linux-lsb-g++/qplatformdefs.h index dc48a089..0928b71 100644 --- a/mkspecs/linux-lsb-g++/qplatformdefs.h +++ b/mkspecs/linux-lsb-g++/qplatformdefs.h @@ -114,6 +114,7 @@ #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 @@ -122,6 +123,7 @@ #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 diff --git a/mkspecs/linux-pgcc/qplatformdefs.h b/mkspecs/linux-pgcc/qplatformdefs.h index 5bf9686..0c3a07e 100644 --- a/mkspecs/linux-pgcc/qplatformdefs.h +++ b/mkspecs/linux-pgcc/qplatformdefs.h @@ -110,6 +110,7 @@ #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 @@ -118,6 +119,7 @@ #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 diff --git a/mkspecs/lynxos-g++/qplatformdefs.h b/mkspecs/lynxos-g++/qplatformdefs.h index e362676..96764a3 100644 --- a/mkspecs/lynxos-g++/qplatformdefs.h +++ b/mkspecs/lynxos-g++/qplatformdefs.h @@ -80,6 +80,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/macx-g++/qplatformdefs.h b/mkspecs/macx-g++/qplatformdefs.h index 98e5eaf..3a9288b 100644 --- a/mkspecs/macx-g++/qplatformdefs.h +++ b/mkspecs/macx-g++/qplatformdefs.h @@ -80,6 +80,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/macx-g++40/qplatformdefs.h b/mkspecs/macx-g++40/qplatformdefs.h index 98e5eaf..3a9288b 100644 --- a/mkspecs/macx-g++40/qplatformdefs.h +++ b/mkspecs/macx-g++40/qplatformdefs.h @@ -80,6 +80,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/macx-g++42/qplatformdefs.h b/mkspecs/macx-g++42/qplatformdefs.h index 98e5eaf..3a9288b 100644 --- a/mkspecs/macx-g++42/qplatformdefs.h +++ b/mkspecs/macx-g++42/qplatformdefs.h @@ -80,6 +80,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/macx-llvm/qplatformdefs.h b/mkspecs/macx-llvm/qplatformdefs.h index 98e5eaf..3a9288b 100644 --- a/mkspecs/macx-llvm/qplatformdefs.h +++ b/mkspecs/macx-llvm/qplatformdefs.h @@ -80,6 +80,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/macx-pbuilder/qplatformdefs.h b/mkspecs/macx-pbuilder/qplatformdefs.h index 04aaab7..05ee441 100644 --- a/mkspecs/macx-pbuilder/qplatformdefs.h +++ b/mkspecs/macx-pbuilder/qplatformdefs.h @@ -80,6 +80,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/macx-xcode/qplatformdefs.h b/mkspecs/macx-xcode/qplatformdefs.h index 98e5eaf..3a9288b 100644 --- a/mkspecs/macx-xcode/qplatformdefs.h +++ b/mkspecs/macx-xcode/qplatformdefs.h @@ -80,6 +80,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/macx-xlc/qplatformdefs.h b/mkspecs/macx-xlc/qplatformdefs.h index e701217..bc2cfb6 100644 --- a/mkspecs/macx-xlc/qplatformdefs.h +++ b/mkspecs/macx-xlc/qplatformdefs.h @@ -80,6 +80,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/netbsd-g++/qplatformdefs.h b/mkspecs/netbsd-g++/qplatformdefs.h index 6e0fee7..40f83a2 100644 --- a/mkspecs/netbsd-g++/qplatformdefs.h +++ b/mkspecs/netbsd-g++/qplatformdefs.h @@ -80,6 +80,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/openbsd-g++/qplatformdefs.h b/mkspecs/openbsd-g++/qplatformdefs.h index ef313aa..90e4c21 100644 --- a/mkspecs/openbsd-g++/qplatformdefs.h +++ b/mkspecs/openbsd-g++/qplatformdefs.h @@ -81,6 +81,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/sco-cc/qplatformdefs.h b/mkspecs/sco-cc/qplatformdefs.h index 4c53c18..41f4f0f 100644 --- a/mkspecs/sco-cc/qplatformdefs.h +++ b/mkspecs/sco-cc/qplatformdefs.h @@ -81,6 +81,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/sco-g++/qplatformdefs.h b/mkspecs/sco-g++/qplatformdefs.h index 3ecb86d..613f22e 100644 --- a/mkspecs/sco-g++/qplatformdefs.h +++ b/mkspecs/sco-g++/qplatformdefs.h @@ -85,6 +85,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t diff --git a/mkspecs/solaris-cc-64/qplatformdefs.h b/mkspecs/solaris-cc-64/qplatformdefs.h index 3d1ddeb..f344ffc 100644 --- a/mkspecs/solaris-cc-64/qplatformdefs.h +++ b/mkspecs/solaris-cc-64/qplatformdefs.h @@ -111,6 +111,7 @@ static inline int qt_socket_connect(int s, struct sockaddr *addr, QT_SOCKLEN_T a #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 @@ -119,6 +120,7 @@ static inline int qt_socket_connect(int s, struct sockaddr *addr, QT_SOCKLEN_T a #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 diff --git a/mkspecs/solaris-cc/qplatformdefs.h b/mkspecs/solaris-cc/qplatformdefs.h index 6c5fd5f..8b2104a 100644 --- a/mkspecs/solaris-cc/qplatformdefs.h +++ b/mkspecs/solaris-cc/qplatformdefs.h @@ -119,6 +119,7 @@ static inline int qt_socket_connect(int s, struct sockaddr *addr, QT_SOCKLEN_T a #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 @@ -127,6 +128,7 @@ static inline int qt_socket_connect(int s, struct sockaddr *addr, QT_SOCKLEN_T a #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 diff --git a/mkspecs/solaris-g++-64/qplatformdefs.h b/mkspecs/solaris-g++-64/qplatformdefs.h index 09aabfd..a6f9c8a 100644 --- a/mkspecs/solaris-g++-64/qplatformdefs.h +++ b/mkspecs/solaris-g++-64/qplatformdefs.h @@ -128,6 +128,7 @@ static inline int qt_socket_bind(int s, struct sockaddr *addr, QT_SOCKLEN_T addr #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 @@ -136,6 +137,7 @@ static inline int qt_socket_bind(int s, struct sockaddr *addr, QT_SOCKLEN_T addr #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 diff --git a/mkspecs/solaris-g++/qplatformdefs.h b/mkspecs/solaris-g++/qplatformdefs.h index 01b551d..c37b366 100644 --- a/mkspecs/solaris-g++/qplatformdefs.h +++ b/mkspecs/solaris-g++/qplatformdefs.h @@ -132,6 +132,7 @@ static inline int qt_socket_bind(int s, struct sockaddr *addr, QT_SOCKLEN_T addr #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 @@ -140,6 +141,7 @@ static inline int qt_socket_bind(int s, struct sockaddr *addr, QT_SOCKLEN_T addr #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 diff --git a/mkspecs/tru64-cxx/qplatformdefs.h b/mkspecs/tru64-cxx/qplatformdefs.h index 7c25fa0..aa3a909 100644 --- a/mkspecs/tru64-cxx/qplatformdefs.h +++ b/mkspecs/tru64-cxx/qplatformdefs.h @@ -83,6 +83,7 @@ #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 off_t diff --git a/mkspecs/tru64-g++/qplatformdefs.h b/mkspecs/tru64-g++/qplatformdefs.h index 63eea44..0e8b345 100644 --- a/mkspecs/tru64-g++/qplatformdefs.h +++ b/mkspecs/tru64-g++/qplatformdefs.h @@ -83,6 +83,7 @@ #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 off_t diff --git a/mkspecs/unixware-cc/qplatformdefs.h b/mkspecs/unixware-cc/qplatformdefs.h index ea523fb..3a6b314 100644 --- a/mkspecs/unixware-cc/qplatformdefs.h +++ b/mkspecs/unixware-cc/qplatformdefs.h @@ -81,6 +81,7 @@ #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 off_t diff --git a/mkspecs/unixware-g++/qplatformdefs.h b/mkspecs/unixware-g++/qplatformdefs.h index ea523fb..3a6b314 100644 --- a/mkspecs/unixware-g++/qplatformdefs.h +++ b/mkspecs/unixware-g++/qplatformdefs.h @@ -81,6 +81,7 @@ #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 off_t diff --git a/mkspecs/unsupported/qnx-g++/qplatformdefs.h b/mkspecs/unsupported/qnx-g++/qplatformdefs.h index f309f81..3abdc92 100644 --- a/mkspecs/unsupported/qnx-g++/qplatformdefs.h +++ b/mkspecs/unsupported/qnx-g++/qplatformdefs.h @@ -87,6 +87,7 @@ #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 @@ -95,6 +96,7 @@ #define QT_FTELL ::ftello #define QT_FGETPOS ::fgetpos #define QT_FSETPOS ::fsetpos +#define QT_MMAP ::mmap #define QT_FPOS_T fpos_t #define QT_OFF_T off_t #endif diff --git a/mkspecs/unsupported/vxworks-simpentium-g++/qplatformdefs.h b/mkspecs/unsupported/vxworks-simpentium-g++/qplatformdefs.h index 5cec788..d16fa8a 100644 --- a/mkspecs/unsupported/vxworks-simpentium-g++/qplatformdefs.h +++ b/mkspecs/unsupported/vxworks-simpentium-g++/qplatformdefs.h @@ -76,6 +76,7 @@ #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 @@ -84,6 +85,7 @@ #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 -- cgit v0.12 From 0689a85ca20a36808b388efc452892606d47b34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 14:48:50 +0200 Subject: Fix 32/64-bit issues with QFile::map/unmap() on *nix systems We would previously silently ignore overflows in 32-bit systems and not properly support 64-bit offsets in systems that support it because of integer overflow. There was also a problem that could prevent unmap from succeeding, because we were passing the wrong length argument. Task-number: QT-1594 Reviewed-by: Thiago Macieira --- src/corelib/io/qfsfileengine_p.h | 2 +- src/corelib/io/qfsfileengine_unix.cpp | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 66e0219..ee127c1 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -114,7 +114,7 @@ public: mutable int cachedFd; mutable DWORD fileAttrib; #else - QHash > maps; + QHash > maps; mutable QT_STATBUF st; #endif int fd; diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index b0cddaa..d346685 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1243,34 +1243,45 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla q->setError(QFile::PermissionsError, qt_error_string(int(EACCES))); return 0; } - if (offset < 0) { + + if (offset < 0 || offset != qint64(QT_OFF_T(offset)) + || size < 0 || size > (size_t)-1) { q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL))); return 0; } + int access = 0; if (openMode & QIODevice::ReadOnly) access |= PROT_READ; if (openMode & QIODevice::WriteOnly) access |= PROT_WRITE; - int pagesSize = getpagesize(); - int realOffset = offset / pagesSize; - int extra = offset % pagesSize; + int pageSize = getpagesize(); + int extra = offset % pageSize; + + if (size + extra > (size_t)-1) { + q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL))); + return 0; + } + + size_t realSize = (size_t)size + extra; + QT_OFF_T realOffset = QT_OFF_T(offset); + realOffset &= ~(QT_OFF_T(pageSize)); #ifdef Q_OS_SYMBIAN void *mapAddress; - TRAPD(err, mapAddress = mmap((void*)0, (size_t)size + extra, - access, MAP_SHARED, nativeHandle(), realOffset * pagesSize)); + TRAPD(err, mapAddress = QT_MMAP((void*)0, realSize, + access, MAP_SHARED, nativeHandle(), realOffset)); if (err != KErrNone) { qWarning("OpenC bug: leave from mmap %d", err); mapAddress = MAP_FAILED; errno = EINVAL; } #else - void *mapAddress = mmap((void*)0, (size_t)size + extra, - access, MAP_SHARED, nativeHandle(), realOffset * pagesSize); + void *mapAddress = QT_MMAP((void*)0, realSize, + access, MAP_SHARED, nativeHandle(), realOffset); #endif if (MAP_FAILED != mapAddress) { uchar *address = extra + static_cast(mapAddress); - maps[address] = QPair(extra, size); + maps[address] = QPair(extra, realSize); return address; } @@ -1300,7 +1311,7 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr) } uchar *start = ptr - maps[ptr].first; - int len = maps[ptr].second; + size_t len = maps[ptr].second; if (-1 == munmap(start, len)) { q->setError(QFile::UnspecifiedError, qt_error_string(errno)); return false; -- cgit v0.12 From 512c2284cafb3eb23d06fc5cdc4e424b711a04b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 17:42:39 +0200 Subject: (Windows) Don't create a file mapping for each view that is mapped Creating a file mapping for each view mapped to memory is sub-optimal and slow. With this change, a single mapping is created and reused when mapping subsequent views of the file. The handle returned from CreateFileForMapping (used in WinCE 5) is now discarded, since the kernel manages it automatically with the file mapping. This simplifies use of the deprecated map API. Reviewed-by: Maurice Kalinowski Reviewed-by: Marius Storm-Olsen --- src/corelib/io/qfsfileengine.cpp | 4 +- src/corelib/io/qfsfileengine_p.h | 8 +--- src/corelib/io/qfsfileengine_win.cpp | 84 +++++++++++++----------------------- 3 files changed, 34 insertions(+), 62 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index fb096a7..2c5451d 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -122,11 +122,9 @@ void QFSFileEnginePrivate::init() #ifdef Q_OS_WIN fileAttrib = INVALID_FILE_ATTRIBUTES; fileHandle = INVALID_HANDLE_VALUE; + mapHandle = INVALID_HANDLE_VALUE; cachedFd = -1; #endif -#ifdef Q_USE_DEPRECATED_MAP_API - fileMapHandle = INVALID_HANDLE_VALUE; -#endif } /*! diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index ee127c1..87f0737 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -110,7 +110,8 @@ public: FILE *fh; #ifdef Q_WS_WIN HANDLE fileHandle; - QHash > maps; + HANDLE mapHandle; + QHash maps; mutable int cachedFd; mutable DWORD fileAttrib; #else @@ -119,11 +120,6 @@ public: #endif int fd; -#ifdef Q_USE_DEPRECATED_MAP_API - void mapHandleClose(); - HANDLE fileMapHandle; -#endif - enum LastIOCommand { IOFlushCommand, diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 898447c..151eabd 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -455,17 +455,10 @@ bool QFSFileEnginePrivate::nativeClose() // Windows native mode. bool ok = true; - if ((fileHandle == INVALID_HANDLE_VALUE || !CloseHandle(fileHandle)) -#ifdef Q_USE_DEPRECATED_MAP_API - && (fileMapHandle == INVALID_HANDLE_VALUE || !CloseHandle(fileMapHandle)) -#endif - ) { + if ((fileHandle == INVALID_HANDLE_VALUE || !::CloseHandle(fileHandle))) { q->setError(QFile::UnspecifiedError, qt_error_string()); ok = false; } -#ifdef Q_USE_DEPRECATED_MAP_API - fileMapHandle = INVALID_HANDLE_VALUE; -#endif fileHandle = INVALID_HANDLE_VALUE; cachedFd = -1; // gets closed by CloseHandle above @@ -1931,42 +1924,42 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, return 0; } + if (mapHandle == INVALID_HANDLE_VALUE) { + // get handle to the file + HANDLE handle = fileHandle; - // get handle to the file - HANDLE handle = fileHandle; #ifndef Q_OS_WINCE - if (handle == INVALID_HANDLE_VALUE && fh) - handle = (HANDLE)_get_osfhandle(QT_FILENO(fh)); + if (handle == INVALID_HANDLE_VALUE && fh) + handle = (HANDLE)::_get_osfhandle(QT_FILENO(fh)); #endif #ifdef Q_USE_DEPRECATED_MAP_API - if (fileMapHandle == INVALID_HANDLE_VALUE) { nativeClose(); - fileMapHandle = CreateFileForMapping((const wchar_t*)nativeFilePath.constData(), + // handle automatically closed by kernel with mapHandle (below). + handle = ::CreateFileForMapping((const wchar_t*)nativeFilePath.constData(), GENERIC_READ | (openMode & QIODevice::WriteOnly ? GENERIC_WRITE : 0), 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - } - handle = fileMapHandle; #endif - if (handle == INVALID_HANDLE_VALUE) { - q->setError(QFile::PermissionsError, qt_error_string(ERROR_ACCESS_DENIED)); - return 0; - } + if (handle == INVALID_HANDLE_VALUE) { + q->setError(QFile::PermissionsError, qt_error_string(ERROR_ACCESS_DENIED)); + return 0; + } - // first create the file mapping handle - DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY; - HANDLE mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0); - if (mapHandle == NULL) { - q->setError(QFile::PermissionsError, qt_error_string()); + // first create the file mapping handle + DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY; + mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0); + if (mapHandle == INVALID_HANDLE_VALUE) { + q->setError(QFile::PermissionsError, qt_error_string()); #ifdef Q_USE_DEPRECATED_MAP_API - mapHandleClose(); + ::CloseHandle(handle); #endif - return 0; + return 0; + } } // setup args to map @@ -1978,17 +1971,17 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, DWORD offsetLo = offset & Q_UINT64_C(0xffffffff); SYSTEM_INFO sysinfo; ::GetSystemInfo(&sysinfo); - int mask = sysinfo.dwAllocationGranularity - 1; - int extra = offset & mask; + DWORD mask = sysinfo.dwAllocationGranularity - 1; + DWORD extra = offset & mask; if (extra) offsetLo &= ~mask; // attempt to create the map - LPVOID mapAddress = MapViewOfFile(mapHandle, access, + LPVOID mapAddress = ::MapViewOfFile(mapHandle, access, offsetHi, offsetLo, size + extra); if (mapAddress) { uchar *address = extra + static_cast(mapAddress); - maps[address] = QPair(extra, mapHandle); + maps[address] = extra; return address; } @@ -2001,10 +1994,8 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, default: q->setError(QFile::UnspecifiedError, qt_error_string()); } - CloseHandle(mapHandle); -#ifdef Q_USE_DEPRECATED_MAP_API - mapHandleClose(); -#endif + + ::CloseHandle(mapHandle); return 0; } @@ -2015,32 +2006,19 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr) q->setError(QFile::PermissionsError, qt_error_string(ERROR_ACCESS_DENIED)); return false; } - uchar *start = ptr - maps[ptr].first; + uchar *start = ptr - maps[ptr]; if (!UnmapViewOfFile(start)) { q->setError(QFile::PermissionsError, qt_error_string()); return false; } - if (!CloseHandle((HANDLE)maps[ptr].second)) { - q->setError(QFile::UnspecifiedError, qt_error_string()); - return false; - } maps.remove(ptr); - -#ifdef Q_USE_DEPRECATED_MAP_API - mapHandleClose(); -#endif - return true; -} - -#ifdef Q_USE_DEPRECATED_MAP_API -void QFSFileEnginePrivate::mapHandleClose() -{ if (maps.isEmpty()) { - CloseHandle(fileMapHandle); - fileMapHandle = INVALID_HANDLE_VALUE; + ::CloseHandle(mapHandle); + mapHandle = INVALID_HANDLE_VALUE; } + + return true; } -#endif QT_END_NAMESPACE -- cgit v0.12 From badfa3435f740ec7120b2ed3367fa2be50382136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 16 Oct 2009 18:10:47 +0200 Subject: Fixes some issues with large files in 32-bit systems Reviewed-by: Thiago Macieira --- src/corelib/io/qfile.cpp | 2 +- src/corelib/io/qfsfileengine.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 134c4b8..64d8ef3 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1064,7 +1064,7 @@ bool QFile::open(FILE *fh, OpenMode mode) if (mode & Append) { seek(size()); } else { - long pos = ftell(fh); + qint64 pos = (qint64)QT_FTELL(fh); if (pos != -1) seek(pos); } diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 2c5451d..c34f8ad 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -564,6 +564,9 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos) if (lastIOCommand != QFSFileEnginePrivate::IOFlushCommand && !q->flush()) return false; + if (pos < 0 || pos != qint64(QT_OFF_T(pos))) + return false; + if (fh) { // Buffered stdlib mode. int ret; @@ -577,7 +580,7 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos) } } else { // Unbuffered stdio mode. - if (QT_LSEEK(fd, pos, SEEK_SET) == -1) { + if (QT_LSEEK(fd, QT_OFF_T(pos), SEEK_SET) == -1) { qWarning() << "QFile::at: Cannot set file position" << pos; q->setError(QFile::PositionError, qt_error_string(errno)); return false; -- cgit v0.12 From 6f52892206b155451e7b24cdbb1b4ab6569153e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 20 Oct 2009 15:39:06 +0200 Subject: Get file position when attaching an open file descriptor to QFile This was already being done when attaching to FILE* streams. Doing the same here makes the API consistent and more usable. Namely, one can use QFile::pos() to obtain the file position. Test case verifies this doesn't break support for sequential files. More thorough test case included in large file support test. Reviewed-by: Thiago Macieira --- src/corelib/io/qfile.cpp | 7 +++++- tests/auto/qfile/tst_qfile.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 64d8ef3..4dd6185 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1120,8 +1120,13 @@ bool QFile::open(int fd, OpenMode mode) } if(d->openExternalFile(mode, fd)) { QIODevice::open(mode); - if (mode & Append) + if (mode & Append) { seek(size()); + } else { + qint64 pos = (qint64)QT_LSEEK(fd, QT_OFF_T(0), SEEK_CUR); + if (pos != -1) + seek(pos); + } return true; } return false; diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 19fbecd..bbb6280 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -187,6 +187,8 @@ private slots: void mapOpenMode_data(); void mapOpenMode(); + void openStandardStreams(); + // --- Task related tests below this line void task167217(); @@ -2634,5 +2636,58 @@ void tst_QFile::openDirectory() QVERIFY(!f1.open(QIODevice::ReadOnly|QIODevice::Unbuffered)); } +void tst_QFile::openStandardStreams() +{ + // Using file descriptors + { + QFile in; + in.open(STDIN_FILENO, QIODevice::ReadOnly); + QCOMPARE( in.pos(), (qint64)0 ); + QCOMPARE( in.size(), (qint64)0 ); + QVERIFY( in.isSequential() ); + } + + { + QFile out; + out.open(STDOUT_FILENO, QIODevice::WriteOnly); + QCOMPARE( out.pos(), (qint64)0 ); + QCOMPARE( out.size(), (qint64)0 ); + QVERIFY( out.isSequential() ); + } + + { + QFile err; + err.open(STDERR_FILENO, QIODevice::WriteOnly); + QCOMPARE( err.pos(), (qint64)0 ); + QCOMPARE( err.size(), (qint64)0 ); + QVERIFY( err.isSequential() ); + } + + // Using streams + { + QFile in; + in.open(stdin, QIODevice::ReadOnly); + QCOMPARE( in.pos(), (qint64)0 ); + QCOMPARE( in.size(), (qint64)0 ); + QVERIFY( in.isSequential() ); + } + + { + QFile out; + out.open(stdout, QIODevice::WriteOnly); + QCOMPARE( out.pos(), (qint64)0 ); + QCOMPARE( out.size(), (qint64)0 ); + QVERIFY( out.isSequential() ); + } + + { + QFile err; + err.open(stderr, QIODevice::WriteOnly); + QCOMPARE( err.pos(), (qint64)0 ); + QCOMPARE( err.size(), (qint64)0 ); + QVERIFY( err.isSequential() ); + } +} + QTEST_MAIN(tst_QFile) #include "tst_qfile.moc" -- cgit v0.12 From c6651f91b8f31d94ef37aa41cc2fd76d97e990e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 20 Oct 2009 16:28:22 +0200 Subject: Adding a test case for large file support The test case creates a (tentatively sparse) very large file with scattered data and uses it to test various aspects of large file support in QFile. Reviewed-by: Thiago Macieira --- tests/auto/qfile/largefile/largefile.pro | 4 + tests/auto/qfile/largefile/tst_largefile.cpp | 492 +++++++++++++++++++++++++++ tests/auto/qfile/qfile.pro | 2 +- 3 files changed, 497 insertions(+), 1 deletion(-) create mode 100644 tests/auto/qfile/largefile/largefile.pro create mode 100644 tests/auto/qfile/largefile/tst_largefile.cpp diff --git a/tests/auto/qfile/largefile/largefile.pro b/tests/auto/qfile/largefile/largefile.pro new file mode 100644 index 0000000..0f96865 --- /dev/null +++ b/tests/auto/qfile/largefile/largefile.pro @@ -0,0 +1,4 @@ +load(qttest_p4) + +QT = core +SOURCES += tst_largefile.cpp diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp new file mode 100644 index 0000000..398ca3f --- /dev/null +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -0,0 +1,492 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#ifdef Q_OS_WIN + +#include +#include + +#ifndef FSCTL_SET_SPARSE +// MinGW doesn't define this. +#define FSCTL_SET_SPARSE (0x900C4) +#endif + +#endif // Q_OS_WIN + +class tst_LargeFile + : public QObject +{ + Q_OBJECT + +public: + tst_LargeFile() + : blockSize(1 << 12) + , maxSizeBits() + , largeFile("qt_largefile.tmp") + , fd_(-1) + , stream_(0) + { + #if defined(QT_LARGEFILE_SUPPORT) && !defined(Q_OS_MAC) + maxSizeBits = 36; // 64 GiB + #elif defined(Q_OS_MAC) + // HFS+ does not support sparse files, so we limit file size for the test + // on Mac OS. + maxSizeBits = 32; // 4 GiB + #else + maxSizeBits = 24; // 16 MiB + #endif + } + +private: + void sparseFileData(); + QByteArray const &getDataBlock(int index, qint64 position); + +private slots: + // The LargeFile test case was designed to be run in order as a single unit + + void initTestCase(); + void cleanupTestCase(); + + void init(); + void cleanup(); + + // Create and fill large file + void createSparseFile(); + void fillFileSparsely(); + void closeSparseFile(); + + // Verify file was created + void fileCreated(); + + // Positioning in large files + void filePositioning(); + void fdPositioning(); + void streamPositioning(); + + // Read data from file + void openFileForReading(); + void readFile(); + + // Map/unmap large file + void mapFile(); + void mapOffsetOverflow(); + + void closeFile() { largeFile.close(); } + + // Test data + void fillFileSparsely_data() { sparseFileData(); } + void filePositioning_data() { sparseFileData(); } + void fdPositioning_data() { sparseFileData(); } + void streamPositioning_data() { sparseFileData(); } + void readFile_data() { sparseFileData(); } + void mapFile_data() { sparseFileData(); } + +private: + const int blockSize; + int maxSizeBits; + + QFile largeFile; + + QVector generatedBlocks; + + int fd_; + FILE *stream_; +}; + +/* + Convenience function to hide reinterpret_cast when copying a POD directly + into a QByteArray. + */ +template +static inline void appendRaw(QByteArray &array, T data) +{ + array.append(reinterpret_cast(&data), sizeof(T)); +} + +/* + Pad array with filler up to size. On return, array.size() returns size. + */ +static inline void topUpWith(QByteArray &array, QByteArray filler, int size) +{ + Q_ASSERT(filler.size() > 0); + + for (int i = (size - array.size()) / filler.size(); i > 0; --i) + array.append(filler); + + if (array.size() < size) { + Q_ASSERT(size - array.size() < filler.size()); + array.append(filler.left(size - array.size())); + } +} + +/* + Generate a unique data block containing identifiable data. Unaligned, + overlapping and partial blocks should not compare equal. + */ +static inline QByteArray generateDataBlock(int blockSize, QString text, qint64 userBits = -1) +{ + QByteArray block; + block.reserve(blockSize); + + // Use of counter and randomBits means content of block will be dependent + // on the generation order. For (file-)systems that do not support sparse + // files, these can be removed so the test file can be reused and doesn't + // have to be generated for every run. + + static qint64 counter = 0; + + qint64 randomBits = ((qint64)qrand() << 32) + | ((qint64)qrand() & 0x00000000ffffffff); + + appendRaw(block, randomBits); + appendRaw(block, userBits); + appendRaw(block, counter); + appendRaw(block, (qint32)0xdeadbeef); + appendRaw(block, blockSize); + + QByteArray userContent = text.toUtf8(); + appendRaw(block, userContent.size()); + block.append(userContent); + appendRaw(block, (qint64)0); + + // size, so far + appendRaw(block, block.size()); + + QByteArray filler("0123456789"); + block.append(filler.right(10 - block.size() % 10)); + topUpWith(block, filler, blockSize - 2 * sizeof(qint64)); + + appendRaw(block, counter); + appendRaw(block, userBits); + appendRaw(block, randomBits); + + Q_ASSERT( block.size() >= blockSize ); + block.resize(blockSize); + + ++counter; + return block; +} + +/* + Generates data blocks the first time they are requested. Keeps copies for reuse. + */ +QByteArray const &tst_LargeFile::getDataBlock(int index, qint64 position) +{ + if (index >= generatedBlocks.size()) + generatedBlocks.resize(index + 1); + + if (generatedBlocks[index].isNull()) { + QString text = QString("Current %1-byte block (index = %2) " + "starts %3 bytes into the file '%4'.") + .arg(blockSize) + .arg(index) + .arg(position) + .arg(largeFile.fileName()); + + generatedBlocks[index] = generateDataBlock(blockSize, text, (qint64)1 << index); + } + + return generatedBlocks[index]; +} + +void tst_LargeFile::initTestCase() +{ + QVERIFY( !largeFile.exists() || largeFile.remove() ); +} + +void tst_LargeFile::cleanupTestCase() +{ + largeFile.close(); + QVERIFY( !largeFile.exists() || largeFile.remove() ); +} + +void tst_LargeFile::init() +{ + fd_ = -1; + stream_ = 0; +} + +void tst_LargeFile::cleanup() +{ + if (-1 != fd_) + QT_CLOSE(fd_); + if (stream_) + ::fclose(stream_); +} + +void tst_LargeFile::sparseFileData() +{ + QTest::addColumn("index"); + QTest::addColumn("position"); + QTest::addColumn("block"); + + QTest::newRow(QString("block[%1] @%2)") + .arg(0).arg(0) + .toLocal8Bit().constData()) + << 0 << (qint64)0 << getDataBlock(0, 0); + + // While on Linux sparse files scale well, on Windows, testing at every + // power of 2 leads to very large files. i += 4 gives us a good coverage + // without taxing too much on resources. + for (int index = 12; index <= maxSizeBits; index += 4) { + qint64 position = (qint64)1 << index; + QByteArray block = getDataBlock(index, position); + + QTest::newRow( + QString("block[%1] @%2)") + .arg(index).arg(position) + .toLocal8Bit().constData()) + << index << position << block; + } +} + +void tst_LargeFile::createSparseFile() +{ +#if defined(Q_OS_WIN) + // On Windows platforms, we must explicitly set the file to be sparse, + // so disk space is not allocated for the full file when writing to it. + HANDLE handle = ::CreateFileA(largeFile.fileName().toLocal8Bit().constData(), + GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0); + QVERIFY( INVALID_HANDLE_VALUE != handle ); + + DWORD bytes; + if (!::DeviceIoControl(handle, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, + &bytes, NULL)) { + QWARN("Unable to set test file as sparse. " + "Limiting test file to 16MiB."); + maxSizeBits = 24; + } + + int fd = ::_open_osfhandle((intptr_t)handle, 0); + QVERIFY( -1 != fd ); + QVERIFY( largeFile.open(fd, QIODevice::WriteOnly) ); +#else // !Q_OS_WIN + QVERIFY( largeFile.open(QIODevice::WriteOnly) ); +#endif +} + +void tst_LargeFile::closeSparseFile() +{ +#if defined(Q_OS_WIN) + int fd = largeFile.handle(); +#endif + + largeFile.close(); + +#if defined(Q_OS_WIN) + if (-1 != fd) + ::_close(fd); +#endif +} + +void tst_LargeFile::fillFileSparsely() +{ + QFETCH( qint64, position ); + QFETCH( QByteArray, block ); + QCOMPARE( block.size(), blockSize ); + + QVERIFY( largeFile.seek(position) ); + QCOMPARE( largeFile.pos(), position ); + + QCOMPARE( largeFile.write(block), (qint64)blockSize ); + QCOMPARE( largeFile.pos(), position + blockSize ); + QVERIFY( largeFile.flush() ); +} + +void tst_LargeFile::fileCreated() +{ + QFileInfo info(largeFile); + + QVERIFY( info.exists() ); + QVERIFY( info.isFile() ); + QVERIFY( info.size() >= ((qint64)1 << maxSizeBits) + blockSize ); +} + +void tst_LargeFile::filePositioning() +{ + QFETCH( qint64, position ); + + QFile file(largeFile.fileName()); + QVERIFY( file.open(QIODevice::ReadOnly) ); + + QVERIFY( file.seek(position) ); + QCOMPARE( file.pos(), position ); +} + +void tst_LargeFile::fdPositioning() +{ + QFETCH( qint64, position ); + + fd_ = QT_OPEN(largeFile.fileName().toLocal8Bit().constData(), + QT_OPEN_RDONLY | QT_OPEN_LARGEFILE); + QVERIFY( -1 != fd_ ); + + QFile file; + QVERIFY( file.open(fd_, QIODevice::ReadOnly) ); + QCOMPARE( file.pos(), (qint64)0 ); + QVERIFY( file.seek(position) ); + QCOMPARE( file.pos(), position ); + + file.close(); + + QCOMPARE( QT_LSEEK(fd_, QT_OFF_T(0), SEEK_SET), QT_OFF_T(0) ); + QCOMPARE( QT_LSEEK(fd_, QT_OFF_T(position), SEEK_SET), QT_OFF_T(position) ); + + QVERIFY( file.open(fd_, QIODevice::ReadOnly) ); + QCOMPARE( QT_LSEEK(fd_, QT_OFF_T(0), SEEK_CUR), QT_OFF_T(position) ); + QCOMPARE( file.pos(), position ); + QVERIFY( file.seek(0) ); + QCOMPARE( file.pos(), (qint64)0 ); + + file.close(); + + QVERIFY( !QT_CLOSE(fd_) ); + fd_ = -1; +} + +void tst_LargeFile::streamPositioning() +{ + QFETCH( qint64, position ); + + stream_ = QT_FOPEN(largeFile.fileName().toLocal8Bit().constData(), "rb"); + QVERIFY( 0 != stream_ ); + + QFile file; + QVERIFY( file.open(stream_, QIODevice::ReadOnly) ); + QCOMPARE( file.pos(), (qint64)0 ); + QVERIFY( file.seek(position) ); + QCOMPARE( file.pos(), position ); + + file.close(); + + QVERIFY( !QT_FSEEK(stream_, QT_OFF_T(0), SEEK_SET) ); + QCOMPARE( QT_FTELL(stream_), QT_OFF_T(0) ); + QVERIFY( !QT_FSEEK(stream_, QT_OFF_T(position), SEEK_SET) ); + QCOMPARE( QT_FTELL(stream_), QT_OFF_T(position) ); + + QVERIFY( file.open(stream_, QIODevice::ReadOnly) ); + QCOMPARE( QT_FTELL(stream_), QT_OFF_T(position) ); + QCOMPARE( file.pos(), position ); + QVERIFY( file.seek(0) ); + QCOMPARE( file.pos(), (qint64)0 ); + + file.close(); + + QVERIFY( !::fclose(stream_) ); + stream_ = 0; +} + +void tst_LargeFile::openFileForReading() +{ + QVERIFY( largeFile.open(QIODevice::ReadOnly) ); +} + +void tst_LargeFile::readFile() +{ + QFETCH( qint64, position ); + QFETCH( QByteArray, block ); + QCOMPARE( block.size(), blockSize ); + + QVERIFY( largeFile.size() >= position + blockSize ); + + QVERIFY( largeFile.seek(position) ); + QCOMPARE( largeFile.pos(), position ); + + QCOMPARE( largeFile.read(blockSize), block ); + QCOMPARE( largeFile.pos(), position + blockSize ); +} + +void tst_LargeFile::mapFile() +{ + QFETCH( qint64, position ); + QFETCH( QByteArray, block ); + QCOMPARE( block.size(), blockSize ); + + // Keep full block mapped to facilitate OS and/or internal reuse by Qt. + uchar *baseAddress = largeFile.map(position, blockSize); + QVERIFY( baseAddress ); + QVERIFY( qEqual(block.begin(), block.end(), reinterpret_cast(baseAddress)) ); + + for (int offset = 1; offset < blockSize; ++offset) { + uchar *address = largeFile.map(position + offset, blockSize - offset); + + QVERIFY( address ); + if ( !qEqual(block.begin() + offset, block.end(), reinterpret_cast(address)) ) { + qDebug() << "Expected:" << block.toHex(); + qDebug() << "Actual :" << QByteArray(reinterpret_cast(address), blockSize).toHex(); + QVERIFY(false); + } + + QVERIFY( largeFile.unmap( address ) ); + } + + QVERIFY( largeFile.unmap( baseAddress ) ); +} + +void tst_LargeFile::mapOffsetOverflow() +{ + // Out-of-range mappings should fail, and not silently clip the offset + for (int i = 50; i < 63; ++i) { + uchar *address = 0; + + address = largeFile.map(((qint64)1 << i), blockSize); + QVERIFY( !address ); + + address = largeFile.map(((qint64)1 << i) + blockSize, blockSize); + QVERIFY( !address ); + } +} + +QTEST_APPLESS_MAIN(tst_LargeFile) +#include "tst_largefile.moc" + diff --git a/tests/auto/qfile/qfile.pro b/tests/auto/qfile/qfile.pro index eebfcda..f70f750 100644 --- a/tests/auto/qfile/qfile.pro +++ b/tests/auto/qfile/qfile.pro @@ -5,5 +5,5 @@ wince*:{ SUBDIRS = test stdinprocess } - +SUBDIRS += largefile -- cgit v0.12 From d5b4afa7b63bb5e0d6afb3491e5fd62e7bf2e890 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 20 Oct 2009 17:50:11 +0100 Subject: When creating a Symbian WId for a visible widget, make the control visible after activating the window. This change was required in order to be able to run the test case for the below task; however, it is more generally required. Without it, the contents of the descendents of this widget will not be visible, until they are explicitly hidden and then re-shown. Task-number: QTBUG-4787 Reviewed-by: axis --- src/gui/kernel/qwidget_s60.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index abf5ba5..2cc3d3f 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -434,8 +434,10 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de drawableWindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); - if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) + if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) { activateSymbianWindow(control.data()); + control->MakeVisible(true); + } // We wait until the control is fully constructed before calling setWinId, because // this generates a WinIdChanged event. -- cgit v0.12 From ffb1006aaf1ee03ff28864d0165ddf0fddb759d7 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 21 Oct 2009 15:41:21 +0100 Subject: Video screen region is updated in response to ancestors of video widget being moved. Because QWidget::moveEvent is only called when a widget moves relative to its parent, a widget's absolute screen position may change without it receiving a moveEvent (for example, as a result of its parent being moved). The MMF video playback API on Symbian v9.4 requires, in addition to a window handle, an absolute screen rectangle. Changes in the video widget's absolute screen position therefore need to be propagated into the MMF. This change introduces a new object, AncestorMoveMonitor, which installs an event filter on the QCoreApplication instance. A VideoOutput object registers with the AncestorMoveMonitor, which listens on its behalf for MoveEvents and ParentChangeEvents directed at any of the ancestors of the VideoOutput. MoveEvents trigger a callback to the VideoOutput instance, which then notifies the MMF of the new screen rectangle. ParentChangeEvents cause the AncestorMoveMonitor to update the ancestor list associated with the target VideoOutput instance. The video position now tracks that of the associated widget, but there are two problems which require further investigation: 1. The video window lags behind. This may be an unavoidable consequence of the fact that setting a new screen rectangle causes the MMF to tear down its DSA session and start a new one; this is known to block the window server and take some time to complete. 2. Artifacts are visible around the edges of the moving video widget. Task-number: QTBUG-4787 Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/ancestormovemonitor.cpp | 175 ++++++++++++++++++++++++ src/3rdparty/phonon/mmf/ancestormovemonitor.h | 95 +++++++++++++ src/3rdparty/phonon/mmf/backend.cpp | 7 +- src/3rdparty/phonon/mmf/backend.h | 7 + src/3rdparty/phonon/mmf/videooutput.cpp | 30 +++- src/3rdparty/phonon/mmf/videooutput.h | 15 +- src/3rdparty/phonon/mmf/videowidget.cpp | 5 +- src/3rdparty/phonon/mmf/videowidget.h | 3 +- src/plugins/phonon/mmf/plugin/plugin.pro | 2 + 9 files changed, 328 insertions(+), 11 deletions(-) create mode 100644 src/3rdparty/phonon/mmf/ancestormovemonitor.cpp create mode 100644 src/3rdparty/phonon/mmf/ancestormovemonitor.h diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp new file mode 100644 index 0000000..876499c --- /dev/null +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp @@ -0,0 +1,175 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include "ancestormovemonitor.h" +#include "utils.h" +#include "videooutput.h" + +#include + +QT_BEGIN_NAMESPACE + +using namespace Phonon::MMF; + +/*! \class MMF::AncestorMoveMonitor + \internal + \brief Class which installs a global event filter, and listens for move + events which may affect the absolute position of widgets registered with + the monitor + See QTBUG-4956 +*/ + +//----------------------------------------------------------------------------- +// Constructor / destructor +//----------------------------------------------------------------------------- + +AncestorMoveMonitor::AncestorMoveMonitor(QObject *parent) + : QObject(parent) +{ + QCoreApplication::instance()->installEventFilter(this); +} + +AncestorMoveMonitor::~AncestorMoveMonitor() +{ + QCoreApplication::instance()->removeEventFilter(this); +} + + +//----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +void AncestorMoveMonitor::registerTarget(VideoOutput *target) +{ + TRACE_CONTEXT(AncestorMoveMonitor::registerTarget, EVideoInternal); + TRACE_ENTRY("target 0x%08x", target); + + // First un-register the target, in case this is being called as a result + // of re-parenting. This is not the most efficient way to update the + // target hash, but since this is not likely to be a frequent operation, + // simplicity is preferred over outright speed. In any case, re-parenting + // of the video widget leads to re-creation of native windows, which is + // likely to take far more processing than any implementation of this + // function. + unRegisterTarget(target); + + QWidget *ancestor = target->parentWidget(); + while(ancestor) { + const Hash::iterator it = m_hash.find(ancestor); + if(m_hash.end() == it) { + TargetList targetList; + targetList.append(target); + m_hash.insert(ancestor, targetList); + } else { + TargetList& targetList = it.value(); + Q_ASSERT(targetList.indexOf(target) == -1); + targetList.append(target); + } + ancestor = ancestor->parentWidget(); + } + + dump(); + + TRACE_EXIT_0(); +} + +void AncestorMoveMonitor::unRegisterTarget(VideoOutput *target) +{ + TRACE_CONTEXT(AncestorMoveMonitor::unRegisterTarget, EVideoInternal); + TRACE_ENTRY("target 0x%08x", target); + + Hash::iterator it = m_hash.begin(); + while(it != m_hash.end()) { + TargetList& targetList = it.value(); + const int index = targetList.indexOf(target); + if(index != -1) + targetList.removeAt(index); + if(targetList.count()) + ++it; + else + it = m_hash.erase(it); + } + + dump(); + + TRACE_EXIT_0(); +} + +bool AncestorMoveMonitor::eventFilter(QObject *watched, QEvent *event) +{ + TRACE_CONTEXT(AncestorMoveMonitor::eventFilter, EVideoInternal); + + if(event->type() == QEvent::Move || event->type() == QEvent::ParentChange) { + + TRACE_ENTRY("watched 0x%08x event.type %d", watched, event->type()); + + const Hash::const_iterator it = m_hash.find(watched); + if(it != m_hash.end()) { + const TargetList& targetList = it.value(); + VideoOutput* target = 0; + foreach(target, targetList) { + switch (event->type()) { + + case QEvent::Move: + // Notify the target that its ancestor has moved + target->ancestorMoved(); + break; + + case QEvent::ParentChange: + // Update ancestor list for the target + registerTarget(target); + break; + + default: + Q_ASSERT(false); + } + } + } + + TRACE_EXIT_0(); + } + + // The event is never consumed by this filter + return false; +} + +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +void AncestorMoveMonitor::dump() +{ +#ifndef QT_NO_DEBUG + TRACE_CONTEXT(AncestorMoveMonitor::dump, EVideoInternal); + for(Hash::const_iterator it = m_hash.begin(); + it != m_hash.end(); ++it) { + const QObject *ancestor = it.key(); + TRACE("ancestor 0x%08x", ancestor); + const TargetList& targetList = it.value(); + VideoOutput* target = 0; + foreach(target, targetList) { + TRACE(" target 0x%08x", target); + } + } +#endif +} + + + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.h b/src/3rdparty/phonon/mmf/ancestormovemonitor.h new file mode 100644 index 0000000..0e681aa --- /dev/null +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.h @@ -0,0 +1,95 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_ANCESTORMOVEMONITOR_H +#define PHONON_MMF_ANCESTORMOVEMONITOR_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ +class VideoOutput; + +class AncestorMoveMonitor : public QObject +{ + Q_OBJECT + +public: + explicit AncestorMoveMonitor(QObject *parent); + ~AncestorMoveMonitor(); + + /** + * Register target widget for notification. + * + * The widget receives an ancestorMoveEvent callback when a move event + * is delivered to any of its ancestors: + * + * If the target is already registered, this function causes its + * ancestor list to be updated - therefore it should be called when + * the target receives a ParentChange event. + */ + void registerTarget(VideoOutput *target); + + /** + * Remove target from the monitor. + * + * The target will no longer receive notification when move events are + * delivered to its ancestors. + */ + void unRegisterTarget(VideoOutput *target); + +protected: + /** + * Function which receives events from the global event filter. + */ + bool eventFilter(QObject *watched, QEvent *event); + + void dump(); + +private: + /** + * List of registered target widgets which descend from a given + * ancestor. + * + * Note that the members of the list should be non-redundant; this + * invariant is checked in debug builds. Semantically, the value is + * therefore a set, however we use QList rather than QSet for + * efficiency of iteration. + */ + typedef QList TargetList; + + /** + * Map from widget on which the move event occurs, to widgets which + * descend from it and therefore need to be notified. + */ + typedef QHash Hash; + Hash m_hash; + +}; +} +} + +QT_END_NAMESPACE + +#endif diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index f542ec9..cac27e3 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -24,6 +24,7 @@ along with this library. If not, see . #include // for TDataType #include "abstractaudioeffect.h" +#include "ancestormovemonitor.h" #include "audiooutput.h" #include "audioplayer.h" #include "backend.h" @@ -45,7 +46,9 @@ using namespace Phonon::MMF; \internal */ -Backend::Backend(QObject *parent) : QObject(parent) +Backend::Backend(QObject *parent) + : QObject(parent) + , m_ancestorMoveMonitor(new AncestorMoveMonitor(this)) { TRACE_CONTEXT(Backend::Backend, EBackend); TRACE_ENTRY_0(); @@ -87,7 +90,7 @@ QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const return EffectFactory::createAudioEffect(effect, parent); } case VideoWidgetClass: - result = new VideoWidget(qobject_cast(parent)); + result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast(parent)); break; default: diff --git a/src/3rdparty/phonon/mmf/backend.h b/src/3rdparty/phonon/mmf/backend.h index 1886ae6..9e3d3b3 100644 --- a/src/3rdparty/phonon/mmf/backend.h +++ b/src/3rdparty/phonon/mmf/backend.h @@ -19,8 +19,11 @@ along with this library. If not, see . #ifndef PHONON_MMF_BACKEND_H #define PHONON_MMF_BACKEND_H +#include "ancestormovemonitor.h" + #include #include +#include QT_BEGIN_NAMESPACE @@ -47,6 +50,10 @@ public: Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); + +private: + QScopedPointer m_ancestorMoveMonitor; + }; } } diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index f0393a7..5288b4d 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -16,6 +16,7 @@ along with this library. If not, see . */ +#include "ancestormovemonitor.h" #include "utils.h" #include "videooutput.h" #include "videooutputobserver.h" @@ -44,8 +45,10 @@ using namespace Phonon::MMF; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::VideoOutput::VideoOutput(QWidget* parent) +MMF::VideoOutput::VideoOutput + (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : QWidget(parent) + , m_ancestorMoveMonitor(ancestorMoveMonitor) , m_observer(0) { TRACE_CONTEXT(VideoOutput::VideoOutput, EVideoInternal); @@ -63,6 +66,8 @@ MMF::VideoOutput::VideoOutput(QWidget* parent) // to be invisible when running on the target device. qt_widget_private(this)->extraData()->disableBlit = true; + registerForAncestorMoved(); + dump(); TRACE_EXIT_0(); @@ -73,6 +78,8 @@ MMF::VideoOutput::~VideoOutput() TRACE_CONTEXT(VideoOutput::~VideoOutput, EVideoInternal); TRACE_ENTRY_0(); + m_ancestorMoveMonitor->unRegisterTarget(this); + TRACE_EXIT_0(); } @@ -97,6 +104,15 @@ void MMF::VideoOutput::setObserver(VideoOutputObserver* observer) m_observer = observer; } +void MMF::VideoOutput::ancestorMoved() +{ + TRACE_CONTEXT(VideoOutput::ancestorMoved, EVideoInternal); + TRACE_ENTRY_0(); + + videoOutputRegionChanged(); + + TRACE_EXIT_0(); +} //----------------------------------------------------------------------------- // QWidget @@ -154,8 +170,11 @@ bool MMF::VideoOutput::event(QEvent* event) TRACE_0("WinIdChange"); videoOutputRegionChanged(); return true; - } - else + } else if (event->type() == QEvent::ParentChange) { + // Tell ancestor move monitor to update ancestor list for this widget + registerForAncestorMoved(); + return true; + } else return QWidget::event(event); } @@ -171,6 +190,11 @@ void MMF::VideoOutput::videoOutputRegionChanged() m_observer->videoOutputRegionChanged(); } +void MMF::VideoOutput::registerForAncestorMoved() +{ + m_ancestorMoveMonitor->registerTarget(this); +} + void MMF::VideoOutput::dump() const { #ifndef QT_NO_DEBUG diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index 7bc0b52..db4d127 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -30,6 +30,7 @@ namespace Phonon { namespace MMF { +class AncestorMoveMonitor; class VideoOutputObserver; class VideoOutput : public QWidget @@ -37,12 +38,14 @@ class VideoOutput : public QWidget Q_OBJECT public: - explicit VideoOutput(QWidget* parent); + VideoOutput(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); ~VideoOutput(); void setFrameSize(const QSize& size); void setObserver(VideoOutputObserver* observer); + void ancestorMoved(); + protected: // Override QWidget functions QSize sizeHint() const; @@ -55,11 +58,17 @@ private: void dump() const; void videoOutputRegionChanged(); + void registerForAncestorMoved(); + private: - QSize m_frameSize; + // Not owned + AncestorMoveMonitor* m_ancestorMoveMonitor; // Not owned - VideoOutputObserver* m_observer; + VideoOutputObserver* m_observer; + + QSize m_frameSize; + }; } } diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index 8a5c9ff..7d7abf1 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -49,9 +49,10 @@ static const qreal DefaultSaturation = 1.0; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::VideoWidget::VideoWidget(QWidget* parent) +MMF::VideoWidget::VideoWidget + (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : MediaNode(parent) - , m_widget(new VideoOutput(parent)) + , m_widget(new VideoOutput(ancestorMoveMonitor, parent)) , m_aspectRatio(DefaultAspectRatio) , m_brightness(DefaultBrightness) , m_scaleMode(DefaultScaleMode) diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h index 970f749..318dfae 100644 --- a/src/3rdparty/phonon/mmf/videowidget.h +++ b/src/3rdparty/phonon/mmf/videowidget.h @@ -31,6 +31,7 @@ namespace Phonon { namespace MMF { +class AncestorMoveMonitor; class VideoOutput; class VideoWidget : public MediaNode @@ -40,7 +41,7 @@ class VideoWidget : public MediaNode Q_INTERFACES(Phonon::VideoWidgetInterface) public: - VideoWidget(QWidget* parent); + VideoWidget(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); ~VideoWidget(); // VideoWidgetInterface diff --git a/src/plugins/phonon/mmf/plugin/plugin.pro b/src/plugins/phonon/mmf/plugin/plugin.pro index eb7fd27..793c307 100644 --- a/src/plugins/phonon/mmf/plugin/plugin.pro +++ b/src/plugins/phonon/mmf/plugin/plugin.pro @@ -26,6 +26,7 @@ HEADERS += \ $$PHONON_MMF_DIR/abstractaudioeffect.h \ $$PHONON_MMF_DIR/abstractmediaplayer.h \ $$PHONON_MMF_DIR/abstractplayer.h \ + $$PHONON_MMF_DIR/ancestormovemonitor.h \ $$PHONON_MMF_DIR/audiooutput.h \ $$PHONON_MMF_DIR/audioequalizer.h \ $$PHONON_MMF_DIR/audioplayer.h \ @@ -47,6 +48,7 @@ SOURCES += \ $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ $$PHONON_MMF_DIR/abstractmediaplayer.cpp \ $$PHONON_MMF_DIR/abstractplayer.cpp \ + $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ $$PHONON_MMF_DIR/audiooutput.cpp \ $$PHONON_MMF_DIR/audioequalizer.cpp \ $$PHONON_MMF_DIR/audioplayer.cpp \ -- cgit v0.12 From d0fa7d4b30fa34fe2a684c331213528c193da85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 22 Oct 2009 20:18:21 +0200 Subject: Windows doesn't #define STD{IN,OUT,ERR}_FILENO Reviewed-by: Markus Goetz --- tests/auto/qfile/tst_qfile.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index bbb6280..4971762 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -79,6 +79,18 @@ # define SRCDIR "" #endif +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif + +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif + Q_DECLARE_METATYPE(QFile::FileError) //TESTED_CLASS= -- cgit v0.12 From 3be1b879c9fbe37b71cce3c95ec4a3753a25a641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 23 Oct 2009 11:15:56 +0200 Subject: Check for non-zero return from fseek While POSIX specifies a -1 return on error, on Windows only non-zero is documented for error conditions. All platforms agree that zero is returned on success so we check for that instead. Reviewed-by: Markus Goetz --- src/corelib/io/qfsfileengine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index c34f8ad..a7de896 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -317,9 +317,9 @@ bool QFSFileEnginePrivate::openFh(QIODevice::OpenMode openMode, FILE *fh) int ret; do { ret = QT_FSEEK(fh, 0, SEEK_END); - } while (ret == -1 && errno == EINTR); + } while (ret != 0 && errno == EINTR); - if (ret == -1) { + if (ret != 0) { q->setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError, qt_error_string(int(errno))); @@ -572,9 +572,9 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos) int ret; do { ret = QT_FSEEK(fh, QT_OFF_T(pos), SEEK_SET); - } while (ret == -1 && errno == EINTR); + } while (ret != 0 && errno == EINTR); - if (ret == -1) { + if (ret != 0) { q->setError(QFile::ReadError, qt_error_string(int(errno))); return false; } -- cgit v0.12 From 2ad49361eeb1ad14a2b9c6c95a9d20d20f9aa851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 23 Oct 2009 11:23:55 +0200 Subject: On Windows, report a 0 file size for streams and other funny files Obtain file size directly, instead of relying on fseek/ftell and messing with the file position. Also changed the return value on errors to 0. This is mostly relevant on streams and pipes, where we used to return whatever error value ftell returned (usually -1). This change also makes the return value consistent with what is returned on Unix platforms and what we document for Windows CE. Nevertheless, documentation of this and related issues is misleading and needs to be updated. Reviewed-by: Markus Goetz --- src/corelib/io/qfsfileengine_win.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 151eabd..b8a16fa 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -499,11 +499,8 @@ qint64 QFSFileEnginePrivate::nativeSize() const // Buffered stdlib mode. if (fh) { - QT_OFF_T oldPos = QT_FTELL(fh); - QT_FSEEK(fh, 0, SEEK_END); - QT_OFF_T fileSize = QT_FTELL(fh); - QT_FSEEK(fh, oldPos, SEEK_SET); - return qint64(fileSize); + qint64 fileSize = _filelengthi64(QT_FILENO(fh)); + return (fileSize == -1) ? 0 : fileSize; } // Not-open mode, where the file name is known: We'll check the -- cgit v0.12 From b402b8c4216ebb2d7db1e7e6cd33a45d1af422e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 23 Oct 2009 11:48:51 +0200 Subject: Fix the LargeFile test for Windows The test assumed fileName was stable, but it is documented behaviour that this can be reset when a file descriptor or FILE* stream is associated with a QFile. This was the case on Windows. --- tests/auto/qfile/largefile/tst_largefile.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index 398ca3f..d2bbffe 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -72,7 +72,6 @@ public: tst_LargeFile() : blockSize(1 << 12) , maxSizeBits() - , largeFile("qt_largefile.tmp") , fd_(-1) , stream_(0) { @@ -231,7 +230,7 @@ QByteArray const &tst_LargeFile::getDataBlock(int index, qint64 position) .arg(blockSize) .arg(index) .arg(position) - .arg(largeFile.fileName()); + .arg("qt_largefile.tmp"); generatedBlocks[index] = generateDataBlock(blockSize, text, (qint64)1 << index); } @@ -241,13 +240,17 @@ QByteArray const &tst_LargeFile::getDataBlock(int index, qint64 position) void tst_LargeFile::initTestCase() { - QVERIFY( !largeFile.exists() || largeFile.remove() ); + QFile file("qt_largefile.tmp"); + QVERIFY( !file.exists() || file.remove() ); } void tst_LargeFile::cleanupTestCase() { - largeFile.close(); - QVERIFY( !largeFile.exists() || largeFile.remove() ); + if (largeFile.isOpen()) + largeFile.close(); + + QFile file("qt_largefile.tmp"); + QVERIFY( !file.exists() || file.remove() ); } void tst_LargeFile::init() @@ -295,7 +298,7 @@ void tst_LargeFile::createSparseFile() #if defined(Q_OS_WIN) // On Windows platforms, we must explicitly set the file to be sparse, // so disk space is not allocated for the full file when writing to it. - HANDLE handle = ::CreateFileA(largeFile.fileName().toLocal8Bit().constData(), + HANDLE handle = ::CreateFileA("qt_largefile.tmp", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0); QVERIFY( INVALID_HANDLE_VALUE != handle ); @@ -311,6 +314,7 @@ void tst_LargeFile::createSparseFile() QVERIFY( -1 != fd ); QVERIFY( largeFile.open(fd, QIODevice::WriteOnly) ); #else // !Q_OS_WIN + largeFile.setFileName("qt_largefile.tmp"); QVERIFY( largeFile.open(QIODevice::WriteOnly) ); #endif } @@ -345,7 +349,7 @@ void tst_LargeFile::fillFileSparsely() void tst_LargeFile::fileCreated() { - QFileInfo info(largeFile); + QFileInfo info("qt_largefile.tmp"); QVERIFY( info.exists() ); QVERIFY( info.isFile() ); @@ -356,7 +360,7 @@ void tst_LargeFile::filePositioning() { QFETCH( qint64, position ); - QFile file(largeFile.fileName()); + QFile file("qt_largefile.tmp"); QVERIFY( file.open(QIODevice::ReadOnly) ); QVERIFY( file.seek(position) ); @@ -367,7 +371,7 @@ void tst_LargeFile::fdPositioning() { QFETCH( qint64, position ); - fd_ = QT_OPEN(largeFile.fileName().toLocal8Bit().constData(), + fd_ = QT_OPEN("qt_largefile.tmp", QT_OPEN_RDONLY | QT_OPEN_LARGEFILE); QVERIFY( -1 != fd_ ); @@ -398,7 +402,7 @@ void tst_LargeFile::streamPositioning() { QFETCH( qint64, position ); - stream_ = QT_FOPEN(largeFile.fileName().toLocal8Bit().constData(), "rb"); + stream_ = QT_FOPEN("qt_largefile.tmp", "rb"); QVERIFY( 0 != stream_ ); QFile file; @@ -428,6 +432,7 @@ void tst_LargeFile::streamPositioning() void tst_LargeFile::openFileForReading() { + largeFile.setFileName("qt_largefile.tmp"); QVERIFY( largeFile.open(QIODevice::ReadOnly) ); } -- cgit v0.12 From f808fe435dc00398775fe8040d3c811aed6332a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 23 Oct 2009 13:44:23 +0200 Subject: Fix QFile::isSequential on Windows When not using native HANDLEs, the return of isSequential was hardcoded to true for files with a fd, and for the standard FILE* streams stdin, stdout and stderr; false for all other FILE* streams. We now use the native GetFileType call for all files by obtaining a native handle where required. We also treat files of type FILE_TYPE_CHAR as sequential, as is the case for the standard streams in console applications. When standard streams are redirected to/from files, GetFileType will return FILE_TYPE_DISK for them and they won't be considered sequential. This is alright since in this mode they behave like regular files and QFile::seek() will work for random offsets. Reviewed-by: Marius Storm-Olsen --- src/corelib/io/qfsfileengine_win.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index b8a16fa..9fc4500 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -789,27 +789,18 @@ int QFSFileEnginePrivate::nativeHandle() const bool QFSFileEnginePrivate::nativeIsSequential() const { #if !defined(Q_OS_WINCE) - // stdlib / Windows native mode. - if (fh || fileHandle != INVALID_HANDLE_VALUE) { - if (fh == stdin || fh == stdout || fh == stderr) - return true; - - HANDLE handle = fileHandle; - if (fileHandle == INVALID_HANDLE_VALUE) { - // Rare case: using QFile::open(FILE*) to open a pipe. - handle = (HANDLE)_get_osfhandle(QT_FILENO(fh)); - return false; - } - - DWORD fileType = GetFileType(handle); - return fileType == FILE_TYPE_PIPE; - } + HANDLE handle = fileHandle; + if (fh || fd != -1) + handle = (HANDLE)_get_osfhandle(fh ? QT_FILENO(fh) : fd); + if (handle == INVALID_HANDLE_VALUE) + return false; - // stdio mode. - if (fd != -1) - return isSequentialFdFh(); -#endif + DWORD fileType = GetFileType(handle); + return (fileType == FILE_TYPE_CHAR) + || (fileType == FILE_TYPE_PIPE); +#else return false; +#endif } bool QFSFileEngine::remove() -- cgit v0.12 From 45a09e31ebb25d3ad4f63ae02f0a0b464577761e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 23 Oct 2009 15:02:05 +0200 Subject: Extending QFile::size test to cover files opened with fd and FILE* Also changed tested type from int to qint64, so we'll be able to see clipping issues, although there are no large files in this test, yet. Reviewed-by: Markus Goetz --- tests/auto/qfile/tst_qfile.cpp | 51 +++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 4971762..55cc286 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -117,6 +117,7 @@ private slots: void openUnbuffered(); void size_data(); void size(); + void sizeNoExist(); void seek(); void setSize(); void setSizeSeek(); @@ -452,23 +453,57 @@ void tst_QFile::openUnbuffered() void tst_QFile::size_data() { QTest::addColumn("filename"); - QTest::addColumn("size"); + QTest::addColumn("size"); - QTest::newRow( "exist01" ) << QString(SRCDIR "testfile.txt") << 245; - QTest::newRow( "nonexist01" ) << QString("foo.txt") << 0; + QTest::newRow( "exist01" ) << QString(SRCDIR "testfile.txt") << (qint64)245; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) // Only test UNC on Windows./ - QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testsharewritable/test.pri") << 34; + QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testsharewritable/test.pri") << (qint64)34; #endif } void tst_QFile::size() { QFETCH( QString, filename ); - QFile f( filename ); - QTEST( (int)f.size(), "size" ); - if (f.open(QFile::ReadOnly)) - QTEST( (int)f.size(), "size" ); + QFETCH( qint64, size ); + + { + QFile f( filename ); + QCOMPARE( f.size(), size ); + + QVERIFY( f.open(QIODevice::ReadOnly) ); + QCOMPARE( f.size(), size ); + } + + { + QFile f; + int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY); + QVERIFY( fd != -1 ); + QVERIFY( f.open(fd, QIODevice::ReadOnly) ); + QCOMPARE( f.size(), size ); + + f.close(); + QT_CLOSE(fd); + } + + { + QFile f; + FILE* stream = QT_FOPEN(filename.toLocal8Bit().constData(), "rb"); + QVERIFY( stream ); + QVERIFY( f.open(stream, QIODevice::ReadOnly) ); + QCOMPARE( f.size(), size ); + + f.close(); + fclose(stream); + } +} + +void tst_QFile::sizeNoExist() +{ + QFile file("nonexist01"); + QVERIFY( !file.exists() ); + QCOMPARE( file.size(), (qint64)0 ); + QVERIFY( !file.open(QIODevice::ReadOnly) ); } void tst_QFile::seek() -- cgit v0.12 From 7177618fd8ae91e553573263d5dd78a99c64e118 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 21 Oct 2009 11:27:22 +0200 Subject: Listen to hasVideoChanged() signal instead, such that we're more robust. This covers cases where the backend knows about video capability in a state other than the LoadingState. Patch by Adookkattil Saleem, slightly modified. Reviewed-by: Gareth Stockwell --- demos/qmediaplayer/mediaplayer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h index 83f14e8..f3af7cc 100644 --- a/demos/qmediaplayer/mediaplayer.h +++ b/demos/qmediaplayer/mediaplayer.h @@ -109,6 +109,7 @@ private slots: void bufferStatus(int percent); void openUrl(); void configureEffect(); + void hasVideoChanged(bool); private: QIcon playIcon; -- cgit v0.12 From df0f099b7ae0ffbea46411276a239d152f36a7e2 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 20 Oct 2009 17:50:11 +0100 Subject: When creating a Symbian WId for a visible widget, make the control visible after activating the window. This change was required in order to be able to run the test case for the below task; however, it is more generally required. Without it, the contents of the descendents of this widget will not be visible, until they are explicitly hidden and then re-shown. Task-number: QTBUG-4787 Reviewed-by: axis --- src/gui/kernel/qwidget_s60.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index cb615fe..3e332a3 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -434,8 +434,10 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de drawableWindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); - if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) + if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) { activateSymbianWindow(control.data()); + control->MakeVisible(true); + } // We wait until the control is fully constructed before calling setWinId, because // this generates a WinIdChanged event. -- cgit v0.12 From d54bc7379de145995534058dd2f6b400c9ab160e Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 21 Oct 2009 15:41:21 +0100 Subject: Video screen region is updated in response to ancestors of video widget being moved. Because QWidget::moveEvent is only called when a widget moves relative to its parent, a widget's absolute screen position may change without it receiving a moveEvent (for example, as a result of its parent being moved). The MMF video playback API on Symbian v9.4 requires, in addition to a window handle, an absolute screen rectangle. Changes in the video widget's absolute screen position therefore need to be propagated into the MMF. This change introduces a new object, AncestorMoveMonitor, which installs an event filter on the QCoreApplication instance. A VideoOutput object registers with the AncestorMoveMonitor, which listens on its behalf for MoveEvents and ParentChangeEvents directed at any of the ancestors of the VideoOutput. MoveEvents trigger a callback to the VideoOutput instance, which then notifies the MMF of the new screen rectangle. ParentChangeEvents cause the AncestorMoveMonitor to update the ancestor list associated with the target VideoOutput instance. The video position now tracks that of the associated widget, but there are two problems which require further investigation: 1. The video window lags behind. This may be an unavoidable consequence of the fact that setting a new screen rectangle causes the MMF to tear down its DSA session and start a new one; this is known to block the window server and take some time to complete. 2. Artifacts are visible around the edges of the moving video widget. Task-number: QTBUG-4787 Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/ancestormovemonitor.cpp | 175 ++++++++++++++++++++++++ src/3rdparty/phonon/mmf/ancestormovemonitor.h | 95 +++++++++++++ src/3rdparty/phonon/mmf/backend.cpp | 7 +- src/3rdparty/phonon/mmf/backend.h | 7 + src/3rdparty/phonon/mmf/videooutput.cpp | 30 +++- src/3rdparty/phonon/mmf/videooutput.h | 15 +- src/3rdparty/phonon/mmf/videowidget.cpp | 5 +- src/3rdparty/phonon/mmf/videowidget.h | 3 +- src/plugins/phonon/mmf/plugin/plugin.pro | 2 + 9 files changed, 328 insertions(+), 11 deletions(-) create mode 100644 src/3rdparty/phonon/mmf/ancestormovemonitor.cpp create mode 100644 src/3rdparty/phonon/mmf/ancestormovemonitor.h diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp new file mode 100644 index 0000000..876499c --- /dev/null +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp @@ -0,0 +1,175 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include "ancestormovemonitor.h" +#include "utils.h" +#include "videooutput.h" + +#include + +QT_BEGIN_NAMESPACE + +using namespace Phonon::MMF; + +/*! \class MMF::AncestorMoveMonitor + \internal + \brief Class which installs a global event filter, and listens for move + events which may affect the absolute position of widgets registered with + the monitor + See QTBUG-4956 +*/ + +//----------------------------------------------------------------------------- +// Constructor / destructor +//----------------------------------------------------------------------------- + +AncestorMoveMonitor::AncestorMoveMonitor(QObject *parent) + : QObject(parent) +{ + QCoreApplication::instance()->installEventFilter(this); +} + +AncestorMoveMonitor::~AncestorMoveMonitor() +{ + QCoreApplication::instance()->removeEventFilter(this); +} + + +//----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +void AncestorMoveMonitor::registerTarget(VideoOutput *target) +{ + TRACE_CONTEXT(AncestorMoveMonitor::registerTarget, EVideoInternal); + TRACE_ENTRY("target 0x%08x", target); + + // First un-register the target, in case this is being called as a result + // of re-parenting. This is not the most efficient way to update the + // target hash, but since this is not likely to be a frequent operation, + // simplicity is preferred over outright speed. In any case, re-parenting + // of the video widget leads to re-creation of native windows, which is + // likely to take far more processing than any implementation of this + // function. + unRegisterTarget(target); + + QWidget *ancestor = target->parentWidget(); + while(ancestor) { + const Hash::iterator it = m_hash.find(ancestor); + if(m_hash.end() == it) { + TargetList targetList; + targetList.append(target); + m_hash.insert(ancestor, targetList); + } else { + TargetList& targetList = it.value(); + Q_ASSERT(targetList.indexOf(target) == -1); + targetList.append(target); + } + ancestor = ancestor->parentWidget(); + } + + dump(); + + TRACE_EXIT_0(); +} + +void AncestorMoveMonitor::unRegisterTarget(VideoOutput *target) +{ + TRACE_CONTEXT(AncestorMoveMonitor::unRegisterTarget, EVideoInternal); + TRACE_ENTRY("target 0x%08x", target); + + Hash::iterator it = m_hash.begin(); + while(it != m_hash.end()) { + TargetList& targetList = it.value(); + const int index = targetList.indexOf(target); + if(index != -1) + targetList.removeAt(index); + if(targetList.count()) + ++it; + else + it = m_hash.erase(it); + } + + dump(); + + TRACE_EXIT_0(); +} + +bool AncestorMoveMonitor::eventFilter(QObject *watched, QEvent *event) +{ + TRACE_CONTEXT(AncestorMoveMonitor::eventFilter, EVideoInternal); + + if(event->type() == QEvent::Move || event->type() == QEvent::ParentChange) { + + TRACE_ENTRY("watched 0x%08x event.type %d", watched, event->type()); + + const Hash::const_iterator it = m_hash.find(watched); + if(it != m_hash.end()) { + const TargetList& targetList = it.value(); + VideoOutput* target = 0; + foreach(target, targetList) { + switch (event->type()) { + + case QEvent::Move: + // Notify the target that its ancestor has moved + target->ancestorMoved(); + break; + + case QEvent::ParentChange: + // Update ancestor list for the target + registerTarget(target); + break; + + default: + Q_ASSERT(false); + } + } + } + + TRACE_EXIT_0(); + } + + // The event is never consumed by this filter + return false; +} + +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +void AncestorMoveMonitor::dump() +{ +#ifndef QT_NO_DEBUG + TRACE_CONTEXT(AncestorMoveMonitor::dump, EVideoInternal); + for(Hash::const_iterator it = m_hash.begin(); + it != m_hash.end(); ++it) { + const QObject *ancestor = it.key(); + TRACE("ancestor 0x%08x", ancestor); + const TargetList& targetList = it.value(); + VideoOutput* target = 0; + foreach(target, targetList) { + TRACE(" target 0x%08x", target); + } + } +#endif +} + + + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.h b/src/3rdparty/phonon/mmf/ancestormovemonitor.h new file mode 100644 index 0000000..0e681aa --- /dev/null +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.h @@ -0,0 +1,95 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_ANCESTORMOVEMONITOR_H +#define PHONON_MMF_ANCESTORMOVEMONITOR_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ +class VideoOutput; + +class AncestorMoveMonitor : public QObject +{ + Q_OBJECT + +public: + explicit AncestorMoveMonitor(QObject *parent); + ~AncestorMoveMonitor(); + + /** + * Register target widget for notification. + * + * The widget receives an ancestorMoveEvent callback when a move event + * is delivered to any of its ancestors: + * + * If the target is already registered, this function causes its + * ancestor list to be updated - therefore it should be called when + * the target receives a ParentChange event. + */ + void registerTarget(VideoOutput *target); + + /** + * Remove target from the monitor. + * + * The target will no longer receive notification when move events are + * delivered to its ancestors. + */ + void unRegisterTarget(VideoOutput *target); + +protected: + /** + * Function which receives events from the global event filter. + */ + bool eventFilter(QObject *watched, QEvent *event); + + void dump(); + +private: + /** + * List of registered target widgets which descend from a given + * ancestor. + * + * Note that the members of the list should be non-redundant; this + * invariant is checked in debug builds. Semantically, the value is + * therefore a set, however we use QList rather than QSet for + * efficiency of iteration. + */ + typedef QList TargetList; + + /** + * Map from widget on which the move event occurs, to widgets which + * descend from it and therefore need to be notified. + */ + typedef QHash Hash; + Hash m_hash; + +}; +} +} + +QT_END_NAMESPACE + +#endif diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index f542ec9..cac27e3 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -24,6 +24,7 @@ along with this library. If not, see . #include // for TDataType #include "abstractaudioeffect.h" +#include "ancestormovemonitor.h" #include "audiooutput.h" #include "audioplayer.h" #include "backend.h" @@ -45,7 +46,9 @@ using namespace Phonon::MMF; \internal */ -Backend::Backend(QObject *parent) : QObject(parent) +Backend::Backend(QObject *parent) + : QObject(parent) + , m_ancestorMoveMonitor(new AncestorMoveMonitor(this)) { TRACE_CONTEXT(Backend::Backend, EBackend); TRACE_ENTRY_0(); @@ -87,7 +90,7 @@ QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const return EffectFactory::createAudioEffect(effect, parent); } case VideoWidgetClass: - result = new VideoWidget(qobject_cast(parent)); + result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast(parent)); break; default: diff --git a/src/3rdparty/phonon/mmf/backend.h b/src/3rdparty/phonon/mmf/backend.h index 1886ae6..9e3d3b3 100644 --- a/src/3rdparty/phonon/mmf/backend.h +++ b/src/3rdparty/phonon/mmf/backend.h @@ -19,8 +19,11 @@ along with this library. If not, see . #ifndef PHONON_MMF_BACKEND_H #define PHONON_MMF_BACKEND_H +#include "ancestormovemonitor.h" + #include #include +#include QT_BEGIN_NAMESPACE @@ -47,6 +50,10 @@ public: Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); + +private: + QScopedPointer m_ancestorMoveMonitor; + }; } } diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index f0393a7..5288b4d 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -16,6 +16,7 @@ along with this library. If not, see . */ +#include "ancestormovemonitor.h" #include "utils.h" #include "videooutput.h" #include "videooutputobserver.h" @@ -44,8 +45,10 @@ using namespace Phonon::MMF; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::VideoOutput::VideoOutput(QWidget* parent) +MMF::VideoOutput::VideoOutput + (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : QWidget(parent) + , m_ancestorMoveMonitor(ancestorMoveMonitor) , m_observer(0) { TRACE_CONTEXT(VideoOutput::VideoOutput, EVideoInternal); @@ -63,6 +66,8 @@ MMF::VideoOutput::VideoOutput(QWidget* parent) // to be invisible when running on the target device. qt_widget_private(this)->extraData()->disableBlit = true; + registerForAncestorMoved(); + dump(); TRACE_EXIT_0(); @@ -73,6 +78,8 @@ MMF::VideoOutput::~VideoOutput() TRACE_CONTEXT(VideoOutput::~VideoOutput, EVideoInternal); TRACE_ENTRY_0(); + m_ancestorMoveMonitor->unRegisterTarget(this); + TRACE_EXIT_0(); } @@ -97,6 +104,15 @@ void MMF::VideoOutput::setObserver(VideoOutputObserver* observer) m_observer = observer; } +void MMF::VideoOutput::ancestorMoved() +{ + TRACE_CONTEXT(VideoOutput::ancestorMoved, EVideoInternal); + TRACE_ENTRY_0(); + + videoOutputRegionChanged(); + + TRACE_EXIT_0(); +} //----------------------------------------------------------------------------- // QWidget @@ -154,8 +170,11 @@ bool MMF::VideoOutput::event(QEvent* event) TRACE_0("WinIdChange"); videoOutputRegionChanged(); return true; - } - else + } else if (event->type() == QEvent::ParentChange) { + // Tell ancestor move monitor to update ancestor list for this widget + registerForAncestorMoved(); + return true; + } else return QWidget::event(event); } @@ -171,6 +190,11 @@ void MMF::VideoOutput::videoOutputRegionChanged() m_observer->videoOutputRegionChanged(); } +void MMF::VideoOutput::registerForAncestorMoved() +{ + m_ancestorMoveMonitor->registerTarget(this); +} + void MMF::VideoOutput::dump() const { #ifndef QT_NO_DEBUG diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index 7bc0b52..db4d127 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -30,6 +30,7 @@ namespace Phonon { namespace MMF { +class AncestorMoveMonitor; class VideoOutputObserver; class VideoOutput : public QWidget @@ -37,12 +38,14 @@ class VideoOutput : public QWidget Q_OBJECT public: - explicit VideoOutput(QWidget* parent); + VideoOutput(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); ~VideoOutput(); void setFrameSize(const QSize& size); void setObserver(VideoOutputObserver* observer); + void ancestorMoved(); + protected: // Override QWidget functions QSize sizeHint() const; @@ -55,11 +58,17 @@ private: void dump() const; void videoOutputRegionChanged(); + void registerForAncestorMoved(); + private: - QSize m_frameSize; + // Not owned + AncestorMoveMonitor* m_ancestorMoveMonitor; // Not owned - VideoOutputObserver* m_observer; + VideoOutputObserver* m_observer; + + QSize m_frameSize; + }; } } diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index 8a5c9ff..7d7abf1 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -49,9 +49,10 @@ static const qreal DefaultSaturation = 1.0; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::VideoWidget::VideoWidget(QWidget* parent) +MMF::VideoWidget::VideoWidget + (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : MediaNode(parent) - , m_widget(new VideoOutput(parent)) + , m_widget(new VideoOutput(ancestorMoveMonitor, parent)) , m_aspectRatio(DefaultAspectRatio) , m_brightness(DefaultBrightness) , m_scaleMode(DefaultScaleMode) diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h index 970f749..318dfae 100644 --- a/src/3rdparty/phonon/mmf/videowidget.h +++ b/src/3rdparty/phonon/mmf/videowidget.h @@ -31,6 +31,7 @@ namespace Phonon { namespace MMF { +class AncestorMoveMonitor; class VideoOutput; class VideoWidget : public MediaNode @@ -40,7 +41,7 @@ class VideoWidget : public MediaNode Q_INTERFACES(Phonon::VideoWidgetInterface) public: - VideoWidget(QWidget* parent); + VideoWidget(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); ~VideoWidget(); // VideoWidgetInterface diff --git a/src/plugins/phonon/mmf/plugin/plugin.pro b/src/plugins/phonon/mmf/plugin/plugin.pro index eb7fd27..793c307 100644 --- a/src/plugins/phonon/mmf/plugin/plugin.pro +++ b/src/plugins/phonon/mmf/plugin/plugin.pro @@ -26,6 +26,7 @@ HEADERS += \ $$PHONON_MMF_DIR/abstractaudioeffect.h \ $$PHONON_MMF_DIR/abstractmediaplayer.h \ $$PHONON_MMF_DIR/abstractplayer.h \ + $$PHONON_MMF_DIR/ancestormovemonitor.h \ $$PHONON_MMF_DIR/audiooutput.h \ $$PHONON_MMF_DIR/audioequalizer.h \ $$PHONON_MMF_DIR/audioplayer.h \ @@ -47,6 +48,7 @@ SOURCES += \ $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ $$PHONON_MMF_DIR/abstractmediaplayer.cpp \ $$PHONON_MMF_DIR/abstractplayer.cpp \ + $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ $$PHONON_MMF_DIR/audiooutput.cpp \ $$PHONON_MMF_DIR/audioequalizer.cpp \ $$PHONON_MMF_DIR/audioplayer.cpp \ -- cgit v0.12 From 1c6bd7f61d2cbe0b8c0fa451f5f9a7efdfaf04c7 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 23 Oct 2009 14:16:38 +0300 Subject: Fixed softkey autotest build after 5370e5ff. Reviewed-by: axis --- tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp index 6efa85b..87e0533 100644 --- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp +++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp @@ -47,6 +47,10 @@ #include "qdialogbuttonbox.h" #include "private/qsoftkeymanager_p.h" +#ifdef Q_OS_SYMBIAN +#include "qsymbianevent.h" +#endif + #ifdef Q_WS_S60 static const int s60CommandStart = 6000; #endif @@ -69,6 +73,13 @@ private slots: void updateSoftKeysCompressed(); void handleCommand(); void checkSoftkeyEnableStates(); + +private: // utils + inline void simulateSymbianCommand(int command) + { + QSymbianEvent event1(QSymbianEvent::CommandEvent, command); + qApp->symbianProcessEvent(&event1); + }; }; class EventListener : public QObject @@ -167,8 +178,8 @@ void tst_QSoftKeyManager::handleCommand() // QTest::keyPress(&w, Qt::Key_Context1); // QTest::keyPress(&w, Qt::Key_Context2); - qApp->symbianHandleCommand(6000); - qApp->symbianHandleCommand(6001); + simulateSymbianCommand(6000); + simulateSymbianCommand(6001); QApplication::processEvents(); @@ -200,9 +211,9 @@ void tst_QSoftKeyManager::checkSoftkeyEnableStates() //disabled button gets none. for (int i = 0; i < 10; i++) { //simulate "Restore Defaults" softkey press - qApp->symbianHandleCommand(s60CommandStart); + simulateSymbianCommand(s60CommandStart); //simulate "help" softkey press - qApp->symbianHandleCommand(s60CommandStart + 1); + simulateSymbianCommand(s60CommandStart + 1); } QApplication::processEvents(); QCOMPARE(spy0.count(), 10); @@ -212,16 +223,16 @@ void tst_QSoftKeyManager::checkSoftkeyEnableStates() for (int i = 0; i < 10; i++) { //simulate "Restore Defaults" softkey press - qApp->symbianHandleCommand(s60CommandStart); + simulateSymbianCommand(s60CommandStart); //simulate "help" softkey press - qApp->symbianHandleCommand(s60CommandStart + 1); + simulateSymbianCommand(s60CommandStart + 1); //switch enabled button to disabled and vice versa pBHelp->setEnabled(!pBHelp->isEnabled()); pBDefaults->setEnabled(!pBDefaults->isEnabled()); } QApplication::processEvents(); QCOMPARE(spy0.count(), 5); - QCOMPARE(spy1.count(), 5); + QCOMPARE(spy1.count(), 5); } QTEST_MAIN(tst_QSoftKeyManager) -- cgit v0.12 From 58efa8aa5e845af2e3db840a8a654bd55fb98fb0 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Fri, 23 Oct 2009 11:52:05 +0200 Subject: Improve error handling. Errors reported via: * the DummyPlayer didn't work due to it not doing the usual state transitions/emission * MediaObject::setSource() due to errors being emitted before connections being set up. * A general state bug. Task-number: QTBUG-4752 Reviewed-by: Gareth Stockwell --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 36 +++++++++---------------- src/3rdparty/phonon/mmf/abstractmediaplayer.h | 4 --- src/3rdparty/phonon/mmf/abstractplayer.cpp | 32 +++++++++++++++++++--- src/3rdparty/phonon/mmf/abstractplayer.h | 9 +++++-- src/3rdparty/phonon/mmf/dummyplayer.cpp | 9 ------- src/3rdparty/phonon/mmf/dummyplayer.h | 4 --- src/3rdparty/phonon/mmf/mediaobject.cpp | 14 ++++++---- 7 files changed, 57 insertions(+), 51 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index af2c31e..998e861 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -359,26 +359,27 @@ qint64 MMF::AbstractMediaPlayer::toMilliSeconds(const TTimeIntervalMicroSeconds return in.Int64() / 1000; } +//----------------------------------------------------------------------------- +// Slots +//----------------------------------------------------------------------------- + +void MMF::AbstractMediaPlayer::tick() +{ + // For the MWC compiler, we need to qualify the base class. + emit MMF::AbstractPlayer::tick(currentTime()); +} + void MMF::AbstractMediaPlayer::changeState(PrivateState newState) { - TRACE_CONTEXT(AbstractPlayer::changeState, EAudioInternal); - TRACE_ENTRY("state %d newState %d", privateState(), newState); + TRACE_CONTEXT(AbstractMediaPlayer::changeState, EAudioInternal); // TODO: add some invariants to check that the transition is valid + AbstractPlayer::changeState(newState); const Phonon::State oldPhononState = phononState(privateState()); const Phonon::State newPhononState = phononState(newState); - if (oldPhononState != newPhononState) { - TRACE("emit stateChanged(%d, %d)", newPhononState, oldPhononState); - emit stateChanged(newPhononState, oldPhononState); - } - - setState(newState); - if ( - LoadingState == oldPhononState - and StoppedState == newPhononState - ) { + if (LoadingState == oldPhononState && StoppedState == newPhononState) { // Ensure initial volume is set on MMF API before starting playback doVolumeChanged(); @@ -391,17 +392,6 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) } } - TRACE_EXIT_0(); -} - -//----------------------------------------------------------------------------- -// Slots -//----------------------------------------------------------------------------- - -void MMF::AbstractMediaPlayer::tick() -{ - // For the MWC compiler, we need to qualify the base class. - emit MMF::AbstractPlayer::tick(currentTime()); } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index 698b899..1ea236b 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -71,10 +71,6 @@ protected: virtual int setDeviceVolume(int mmfVolume) = 0; virtual int openFile(RFile& file) = 0; virtual void close() = 0; - - /** - * Changes state and emits stateChanged() - */ virtual void changeState(PrivateState newState); protected: diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp index e3c0ecb..de2722d 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp @@ -118,12 +118,14 @@ void MMF::AbstractPlayer::videoOutputChanged() // Default behaviour is empty - overridden by VideoPlayer } -void MMF::AbstractPlayer::setError(Phonon::ErrorType error) +void MMF::AbstractPlayer::setError(Phonon::ErrorType error, + const QString &errorMessage) { TRACE_CONTEXT(AbstractPlayer::setError, EAudioInternal); TRACE_ENTRY("state %d error %d", m_state, error); m_error = error; + m_errorString = errorMessage; changeState(ErrorState); TRACE_EXIT_0(); @@ -138,9 +140,7 @@ Phonon::ErrorType MMF::AbstractPlayer::errorType() const QString MMF::AbstractPlayer::errorString() const { - // TODO: put in proper error strings - QString result; - return result; + return m_errorString; } Phonon::State MMF::AbstractPlayer::phononState() const @@ -173,5 +173,29 @@ void MMF::AbstractPlayer::setState(PrivateState newState) m_state = newState; } +void MMF::AbstractPlayer::changeState(PrivateState newState) +{ + TRACE_CONTEXT(AbstractPlayer::changeState, EAudioInternal); + TRACE_ENTRY("state %d newState %d", privateState(), newState); + + // TODO: add some invariants to check that the transition is valid + + const Phonon::State oldPhononState = phononState(privateState()); + + // We need to change the state before we emit stateChanged(), because + // some user code, for instance the mediaplayer, switch on MediaObject's + // state. + setState(newState); + + const Phonon::State newPhononState = phononState(newState); + + if (oldPhononState != newPhononState) { + TRACE("emit stateChanged(%d, %d)", newPhononState, oldPhononState); + emit stateChanged(newPhononState, oldPhononState); + } + + TRACE_EXIT_0(); +} + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index 08558cf..1c4ea02 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -93,7 +93,8 @@ public: /** * Records error and changes state to ErrorState */ - void setError(Phonon::ErrorType error); + void setError(Phonon::ErrorType error, + const QString &errorMessage = QString()); Phonon::State state() const; Q_SIGNALS: @@ -132,7 +133,10 @@ protected: PrivateState privateState() const; - virtual void changeState(PrivateState newState) = 0; + /** + * Changes state and emits stateChanged() + */ + virtual void changeState(PrivateState newState); /** * Modifies m_state directly. Typically you want to call changeState(), @@ -152,6 +156,7 @@ protected: private: PrivateState m_state; Phonon::ErrorType m_error; + QString m_errorString; qint32 m_tickInterval; qint32 m_transitionTime; qint32 m_prefinishMark; diff --git a/src/3rdparty/phonon/mmf/dummyplayer.cpp b/src/3rdparty/phonon/mmf/dummyplayer.cpp index bd21d20..e6f3855 100644 --- a/src/3rdparty/phonon/mmf/dummyplayer.cpp +++ b/src/3rdparty/phonon/mmf/dummyplayer.cpp @@ -87,11 +87,6 @@ qint64 MMF::DummyPlayer::currentTime() const return 0; } -QString MMF::DummyPlayer::errorString() const -{ - return QString(); -} - Phonon::ErrorType MMF::DummyPlayer::errorType() const { return Phonon::NoError; @@ -127,9 +122,5 @@ void MMF::DummyPlayer::doSetTickInterval(qint32) } -void MMF::DummyPlayer::changeState(PrivateState) -{ -} - QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/dummyplayer.h b/src/3rdparty/phonon/mmf/dummyplayer.h index 9ff9f78..c6270c9 100644 --- a/src/3rdparty/phonon/mmf/dummyplayer.h +++ b/src/3rdparty/phonon/mmf/dummyplayer.h @@ -54,7 +54,6 @@ public: virtual bool isSeekable() const; virtual qint64 currentTime() const; virtual Phonon::State state() const; - virtual QString errorString() const; virtual Phonon::ErrorType errorType() const; virtual qint64 totalTime() const; virtual MediaSource source() const; @@ -64,9 +63,6 @@ public: // AbstractPlayer virtual void doSetTickInterval(qint32 interval); - -protected: - virtual void changeState(PrivateState newState); }; } } diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 29ac2df..74aaa58 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -239,6 +239,7 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) const bool oldPlayerSeekable = oldPlayer->isSeekable(); Phonon::ErrorType error = NoError; + QString errorMessage; // Determine media type switch (source.type()) { @@ -253,7 +254,7 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) mediaType = fileMediaType(url.toLocalFile()); } else { - TRACE_0("Network streaming not supported yet"); + errorMessage = QLatin1String("Network streaming not supported yet"); error = NormalError; } } @@ -286,7 +287,8 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) newPlayer = new DummyPlayer(); } - newPlayer->setError(NormalError); + error = NormalError; + errorMessage = tr("Media type could not be determined"); break; case MediaTypeAudio: @@ -321,9 +323,11 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished())); connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); - if (error != NoError ) { - newPlayer = new DummyPlayer(); - newPlayer->setError(error); + // We need to call setError() after doing the connects, otherwise the + // error won't be received. + if (error != NoError) { + Q_ASSERT(m_player); + m_player->setError(error, errorMessage); } TRACE_EXIT_0(); -- cgit v0.12 From 7ee0143a417678f7108838230c5ada3bbd62c6cc Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Fri, 23 Oct 2009 16:56:58 +0200 Subject: Fix build caused by merge error. --- demos/qmediaplayer/mediaplayer.h | 1 - 1 file changed, 1 deletion(-) diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h index f3af7cc..08db0e5 100644 --- a/demos/qmediaplayer/mediaplayer.h +++ b/demos/qmediaplayer/mediaplayer.h @@ -93,7 +93,6 @@ public slots: void playPause(); void scaleChanged(QAction *); void aspectChanged(QAction *); - void hasVideoChanged(bool); private slots: void setAspect(int); -- cgit v0.12 From bc583eb7bcc11eaa778404bcf73d3f85315fe4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 26 Oct 2009 11:57:37 +0100 Subject: Fix silly error in bit fiddling That's what I get for not having the brain on when accepting suggestions... Reviewed-by: Thiago Macieira --- src/corelib/io/qfsfileengine_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index d346685..6af5674 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1264,7 +1264,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla size_t realSize = (size_t)size + extra; QT_OFF_T realOffset = QT_OFF_T(offset); - realOffset &= ~(QT_OFF_T(pageSize)); + realOffset &= ~(QT_OFF_T(pageSize - 1)); #ifdef Q_OS_SYMBIAN void *mapAddress; -- cgit v0.12 From b65eac5fa966a47b0ffe8e111553052fd4dffb40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 27 Oct 2009 15:26:41 +0100 Subject: Define QT_OPEN_LARGEFILE on Symbian + WinCE Reviewed-by: Thiago Macieira --- mkspecs/common/symbian/qplatformdefs.h | 1 + mkspecs/common/wince/qplatformdefs.h | 1 + 2 files changed, 2 insertions(+) diff --git a/mkspecs/common/symbian/qplatformdefs.h b/mkspecs/common/symbian/qplatformdefs.h index e1d8f6a..c0756b2 100644 --- a/mkspecs/common/symbian/qplatformdefs.h +++ b/mkspecs/common/symbian/qplatformdefs.h @@ -141,6 +141,7 @@ #define QT_CHDIR ::chdir #define QT_MKDIR ::mkdir #define QT_RMDIR ::rmdir +#define QT_OPEN_LARGEFILE 0 #define QT_OPEN_RDONLY O_RDONLY #define QT_OPEN_WRONLY O_WRONLY #define QT_OPEN_RDWR O_RDWR diff --git a/mkspecs/common/wince/qplatformdefs.h b/mkspecs/common/wince/qplatformdefs.h index eecbd1e..52a34e9 100644 --- a/mkspecs/common/wince/qplatformdefs.h +++ b/mkspecs/common/wince/qplatformdefs.h @@ -97,6 +97,7 @@ #define QT_CHDIR ::_chdir #define QT_MKDIR ::qt_wince__mkdir #define QT_RMDIR ::qt_wince__rmdir +#define QT_OPEN_LARGEFILE 0 #define QT_OPEN_RDONLY _O_RDONLY #define QT_OPEN_WRONLY _O_WRONLY #define QT_OPEN_RDWR _O_RDWR -- cgit v0.12 From 22b223c31ff961f52f62eaf20aa571b71dfe3bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 27 Oct 2009 15:57:54 +0100 Subject: (MSVC 2002/2003) Use 64-bit versions of ftell and fseek MSDN documents these as being available since Windows 95. Reviewed-by: Marius Storm-Olsen --- mkspecs/win32-msvc.net/qplatformdefs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/win32-msvc.net/qplatformdefs.h b/mkspecs/win32-msvc.net/qplatformdefs.h index 19f9ba4..e3e287e 100644 --- a/mkspecs/win32-msvc.net/qplatformdefs.h +++ b/mkspecs/win32-msvc.net/qplatformdefs.h @@ -115,8 +115,8 @@ #define QT_FOPEN ::fopen #ifdef QT_LARGEFILE_SUPPORT -#define QT_FSEEK ::fseek -#define QT_FTELL ::ftell +#define QT_FSEEK ::_fseeki64 +#define QT_FTELL ::_ftelli64 #else #define QT_FSEEK ::fseek #define QT_FTELL ::ftell -- cgit v0.12 From 79da7bb4739f9f63178ce5146702dce6b8feafb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 28 Oct 2009 14:09:04 +0100 Subject: Don't try to mmap past EOF On Mac OS, mmap would succeed, returning a valid pointer, but trying to read from it would result in a SIGBUS. By adding this check we commit to a safe cross-platform behavior users can depend on. Reviewed-by: Thiago Macieira --- src/corelib/io/qfsfileengine_unix.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 6af5674..7824520 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1250,6 +1250,12 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla return 0; } + // If we know the mapping will extend beyond EOF, fail early to avoid + // undefined behavior. Otherwise, let mmap have its say. + if (doStat() + && (QT_OFF_T(size) > st.st_size - QT_OFF_T(offset))) + return 0; + int access = 0; if (openMode & QIODevice::ReadOnly) access |= PROT_READ; if (openMode & QIODevice::WriteOnly) access |= PROT_WRITE; -- cgit v0.12 From 4531ffbd8aa2cc0ae656715e449caca1649c18b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 29 Oct 2009 14:28:36 +0100 Subject: Added QImagePixmapCleanupHooks functions for enabling hooks. Better than having to befriend QPixmapData and setting is_cached manually. Reviewed-by: Tom Cooksey --- src/gui/image/qimagepixmapcleanuphooks.cpp | 18 +++++++++++++++++- src/gui/image/qimagepixmapcleanuphooks_p.h | 4 ++++ src/gui/image/qpixmapdata_p.h | 3 +-- src/opengl/qgl.cpp | 4 ++-- src/opengl/qgl_x11.cpp | 3 ++- src/opengl/qgl_x11egl.cpp | 3 ++- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index ac30646..35322e9 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -40,7 +40,8 @@ ****************************************************************************/ #include "qimagepixmapcleanuphooks_p.h" -#include "qpixmapdata_p.h" +#include "private/qpixmapdata_p.h" +#include "private/qimage_p.h" QT_BEGIN_NAMESPACE @@ -132,4 +133,19 @@ void QImagePixmapCleanupHooks::executeImageHooks(qint64 key) qt_image_cleanup_hook_64(key); } +void QImagePixmapCleanupHooks::enableCleanupHooks(const QPixmap &pixmap) +{ + enableCleanupHooks(const_cast(pixmap).data_ptr().data()); +} + +void QImagePixmapCleanupHooks::enableCleanupHooks(QPixmapData *pixmapData) +{ + pixmapData->is_cached = true; +} + +void QImagePixmapCleanupHooks::enableCleanupHooks(const QImage &image) +{ + const_cast(image).data_ptr()->is_cached = true; +} + QT_END_NAMESPACE diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h index 16c8974..9e490d7 100644 --- a/src/gui/image/qimagepixmapcleanuphooks_p.h +++ b/src/gui/image/qimagepixmapcleanuphooks_p.h @@ -70,6 +70,10 @@ public: static QImagePixmapCleanupHooks *instance(); + static void enableCleanupHooks(const QImage &image); + static void enableCleanupHooks(const QPixmap &pixmap); + static void enableCleanupHooks(QPixmapData *pixmapData); + // Gets called when a pixmap is about to be modified: void addPixmapModificationHook(_qt_pixmap_cleanup_hook_pm); diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 2f4f201..e99409c 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -131,12 +131,11 @@ protected: private: friend class QPixmap; - friend class QGLContextPrivate; friend class QX11PixmapData; friend class QS60PixmapData; + friend class QImagePixmapCleanupHooks; // Needs to set is_cached friend class QGLTextureCache; //Needs to check the reference count friend class QExplicitlySharedDataPointer; - friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs to set is_cached QAtomicInt ref; int detach_no; diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e80521b..3fec1f0 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2137,7 +2137,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G Q_ASSERT(texture); if (texture->id > 0) - const_cast(image).data_ptr()->is_cached = true; + QImagePixmapCleanupHooks::enableCleanupHooks(image); return texture; } @@ -2396,7 +2396,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, Q_ASSERT(texture); if (texture->id > 0) - const_cast(pixmap).data_ptr()->is_cached = true; + QImagePixmapCleanupHooks::enableCleanupHooks(pixmap); return texture; } diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 86e593d..899047a 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #ifdef Q_OS_HPUX // for GLXPBuffer #include @@ -1704,7 +1705,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con pixmapData->gl_surface = (Qt::HANDLE)glxPixmap; // Make sure the cleanup hook gets called so we can delete the glx pixmap - pixmapData->is_cached = true; + QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); } GLuint textureId; diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 7180682..9b20297 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -42,6 +42,7 @@ #include "qgl.h" #include #include +#include #include #include #include "qgl_egl_p.h" @@ -531,7 +532,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl Q_ASSERT(sizeof(Qt::HANDLE) >= sizeof(EGLSurface)); // Just to make totally sure! pixmapData->gl_surface = (Qt::HANDLE)pixmapSurface; - pixmapData->is_cached = true; // Make sure the cleanup hook gets called + QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); // Make sure the cleanup hook gets called return true; } -- cgit v0.12 From 2f9c37c4b48c4b5005c89f1c5a5fa036e1e22811 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 29 Oct 2009 17:14:47 +0100 Subject: Avoid infinite loop when laying out text with unconvertible chars When the stringToCMap() fails, it can be because it did not have enough space in the layout, or it can because of other errors. In order to implement "try-again" processing in a simple way, we had an infinite loop which assumed that stringToCMap() would always succeed in the second run (which would be the case if the only possible error was "not enough space".) Since there are other possible failures not related to the number of glyphs, you could easily get into an infinite loop here, e.g. when laying out text that contains the Byte Order Mark. The fix changes the implementation to explictly try stringToCMap() twice at max, and is also how it's implemented in the default qtextengine.cpp. Task-number: QTBUG-4680 Reviewed-by: Trond --- src/gui/text/qtextengine_mac.cpp | 73 ++++++++++++++---------------- tests/auto/qtextlayout/tst_qtextlayout.cpp | 13 ++++++ 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp index eeccc72..54be53b 100644 --- a/src/gui/text/qtextengine_mac.cpp +++ b/src/gui/text/qtextengine_mac.cpp @@ -594,53 +594,50 @@ void QTextEngine::shapeTextMac(int item) const str = reinterpret_cast(uc); } - while (true) { - ensureSpace(num_glyphs); - num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - - QGlyphLayout g = availableGlyphs(&si); - g.numGlyphs = num_glyphs; - unsigned short *log_clusters = logClusters(&si); + ensureSpace(num_glyphs); + num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - if (fe->stringToCMap(str, - len, - &g, - &num_glyphs, - flags, - log_clusters, - attributes())) { + QGlyphLayout g = availableGlyphs(&si); + g.numGlyphs = num_glyphs; + unsigned short *log_clusters = logClusters(&si); - heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - break; - } + bool stringToCMapFailed = false; + if (!fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, attributes())) { + ensureSpace(num_glyphs); + stringToCMapFailed = fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, + attributes()); } - si.num_glyphs = num_glyphs; + if (!stringToCMapFailed) { + heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - layoutData->used += si.num_glyphs; + si.num_glyphs = num_glyphs; - QGlyphLayout g = shapedGlyphs(&si); + layoutData->used += si.num_glyphs; - if (si.analysis.script == QUnicodeTables::Arabic) { - QVarLengthArray props(len + 2); - QArabicProperties *properties = props.data(); - int f = si.position; - int l = len; - if (f > 0) { - --f; - ++l; - ++properties; - } - if (f + l < layoutData->string.length()) { - ++l; - } - qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); + QGlyphLayout g = shapedGlyphs(&si); - unsigned short *log_clusters = logClusters(&si); + if (si.analysis.script == QUnicodeTables::Arabic) { + QVarLengthArray props(len + 2); + QArabicProperties *properties = props.data(); + int f = si.position; + int l = len; + if (f > 0) { + --f; + ++l; + ++properties; + } + if (f + l < layoutData->string.length()) { + ++l; + } + qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); - for (int i = 0; i < len; ++i) { - int gpos = log_clusters[i]; - g.attributes[gpos].justification = properties[i].justification; + unsigned short *log_clusters = logClusters(&si); + + for (int i = 0; i < len; ++i) { + int gpos = log_clusters[i]; + g.attributes[gpos].justification = properties[i].justification; + } } } diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index fe87dfb..7c3f4f2 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -118,6 +118,7 @@ private slots: void smallTextLengthWordWrap(); void smallTextLengthWrapAtWordBoundaryOrAnywhere(); void testLineBreakingAllSpaces(); + void lineWidthFromBOM(); private: @@ -1306,6 +1307,18 @@ void tst_QTextLayout::columnWrapWithTabs() } +void tst_QTextLayout::lineWidthFromBOM() +{ + const QString string(QChar(0xfeff)); // BYTE ORDER MARK + QTextLayout layout(string); + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(INT_MAX / 256); + layout.endLayout(); + + // Don't spin into an infinite loop + } + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From 4204fdcc04e20eabd19704f2235ba06afa84605e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 29 Oct 2009 17:32:57 +0100 Subject: Avoid infinite loop when laying out text with unconvertible chars When the stringToCMap() fails, it can be because it did not have enough space in the layout, or it can because of other errors. In order to implement "try-again" processing in a simple way, we had an infinite loop which assumed that stringToCMap() would always succeed in the second run (which would be the case if the only possible error was "not enough space".) Since there are other possible failures not related to the number of glyphs, you could easily get into an infinite loop here, e.g. when laying out text that contains the Byte Order Mark. The fix changes the implementation to explictly try stringToCMap() twice at max, and is also how it's implemented in the default qtextengine.cpp. Task-number: QTBUG-4680 Reviewed-by: Trond Conflicts: src/gui/text/qtextengine_mac.cpp tests/auto/qtextlayout/tst_qtextlayout.cpp --- src/gui/text/qtextengine_mac.cpp | 77 ++++++++++++++---------------- tests/auto/qtextlayout/tst_qtextlayout.cpp | 14 ++++++ 2 files changed, 51 insertions(+), 40 deletions(-) diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp index 4f20094..e35f9e0 100644 --- a/src/gui/text/qtextengine_mac.cpp +++ b/src/gui/text/qtextengine_mac.cpp @@ -595,53 +595,50 @@ void QTextEngine::shapeTextMac(int item) const str = reinterpret_cast(uc); } - while (true) { - ensureSpace(num_glyphs); - num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - - QGlyphLayout g = availableGlyphs(&si); - g.numGlyphs = num_glyphs; - unsigned short *log_clusters = logClusters(&si); - - if (fe->stringToCMap(str, - len, - &g, - &num_glyphs, - flags, - log_clusters, - attributes())) { - - heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - break; - } + ensureSpace(num_glyphs); + num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; + + QGlyphLayout g = availableGlyphs(&si); + g.numGlyphs = num_glyphs; + unsigned short *log_clusters = logClusters(&si); + + bool stringToCMapFailed = false; + if (!fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, attributes())) { + ensureSpace(num_glyphs); + stringToCMapFailed = fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, + attributes()); } - si.num_glyphs = num_glyphs; + if (!stringToCMapFailed) { + heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - layoutData->used += si.num_glyphs; + si.num_glyphs = num_glyphs; - QGlyphLayout g = shapedGlyphs(&si); + layoutData->used += si.num_glyphs; - if (si.analysis.script == QUnicodeTables::Arabic) { - QVarLengthArray props(len + 2); - QArabicProperties *properties = props.data(); - int f = si.position; - int l = len; - if (f > 0) { - --f; - ++l; - ++properties; - } - if (f + l < layoutData->string.length()) { - ++l; - } - qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); + QGlyphLayout g = shapedGlyphs(&si); - unsigned short *log_clusters = logClusters(&si); + if (si.analysis.script == QUnicodeTables::Arabic) { + QVarLengthArray props(len + 2); + QArabicProperties *properties = props.data(); + int f = si.position; + int l = len; + if (f > 0) { + --f; + ++l; + ++properties; + } + if (f + l < layoutData->string.length()) { + ++l; + } + qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); - for (int i = 0; i < len; ++i) { - int gpos = log_clusters[i]; - g.attributes[gpos].justification = properties[i].justification; + unsigned short *log_clusters = logClusters(&si); + + for (int i = 0; i < len; ++i) { + int gpos = log_clusters[i]; + g.attributes[gpos].justification = properties[i].justification; + } } } diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index a5fed4e..b02a704 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -119,6 +119,7 @@ private slots: void smallTextLengthWordWrap(); void smallTextLengthWrapAtWordBoundaryOrAnywhere(); void testLineBreakingAllSpaces(); + void lineWidthFromBOM(); private: @@ -1277,5 +1278,18 @@ void tst_QTextLayout::widthOfTabs() QCOMPARE(qRound(engine.width(0, 5)), qRound(engine.boundingBox(0, 5).width)); } +void tst_QTextLayout::lineWidthFromBOM() +{ + const QString string(QChar(0xfeff)); // BYTE ORDER MARK + QTextLayout layout(string); + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(INT_MAX / 256); + layout.endLayout(); + + // Don't spin into an infinite loop + } + + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From 764d195bfa252775702bffc93989a35d0c19f035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 29 Oct 2009 15:32:03 +0100 Subject: Turns out 64-bit fseek/ftell are not available on VS 2003/2002... Not when linking dynamically to the CRT (/MT). So we can't rely on them. The declarations for those are also not on the standard headers. Reverts "(MSVC 2002/2003) Use 64-bit versions of ftell and fseek", fixes return type of QT_FTELL and skips known failures on large-file test case. --- mkspecs/win32-msvc.net/qplatformdefs.h | 6 ++++-- tests/auto/qfile/largefile/tst_largefile.cpp | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mkspecs/win32-msvc.net/qplatformdefs.h b/mkspecs/win32-msvc.net/qplatformdefs.h index e3e287e..da092fa 100644 --- a/mkspecs/win32-msvc.net/qplatformdefs.h +++ b/mkspecs/win32-msvc.net/qplatformdefs.h @@ -115,8 +115,10 @@ #define QT_FOPEN ::fopen #ifdef QT_LARGEFILE_SUPPORT -#define QT_FSEEK ::_fseeki64 -#define QT_FTELL ::_ftelli64 +// 64-bit versions of fseek/ftell not always available. E.g., when linking +// dynamically to CRT (/MT) +#define QT_FSEEK ::fseek +#define QT_FTELL (QT_OFF_T)::ftell #else #define QT_FSEEK ::fseek #define QT_FTELL ::ftell diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index d2bbffe..53dbc12 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -402,6 +402,11 @@ void tst_LargeFile::streamPositioning() { QFETCH( qint64, position ); +#if defined(QT_LARGEFILE_SUPPORT) && defined(Q_CC_MSVC) && _MSC_VER < 1400 + if (position >= (qint64)1 << 31) + QSKIP("MSVC 2003 doesn't have 64 bit versions of fseek/ftell.", SkipSingle); +#endif + stream_ = QT_FOPEN("qt_largefile.tmp", "rb"); QVERIFY( 0 != stream_ ); -- cgit v0.12 From 79eef278228aac21fbf8b21eaa337f2922bc68c1 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 28 Oct 2009 13:49:19 +0100 Subject: Lazily construct QPixmapData's for null pixmaps Reviewed-by: Trond --- src/gui/image/qpixmap.cpp | 64 +++++++++++++++++++++++++------------------ src/gui/image/qpixmap_mac.cpp | 3 ++ src/gui/image/qpixmap_qws.cpp | 8 +++--- src/gui/image/qpixmap_s60.cpp | 13 +++++---- src/gui/image/qpixmap_win.cpp | 3 ++ src/gui/image/qpixmap_x11.cpp | 7 +++-- src/gui/image/qpixmapdata.cpp | 13 +++++++++ src/gui/image/qpixmapdata_p.h | 2 ++ 8 files changed, 75 insertions(+), 38 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 45ff5f4..c452b9a 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -113,13 +113,10 @@ void QPixmap::init(int w, int h, Type type) void QPixmap::init(int w, int h, int type) { - QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); - if (gs) - data = gs->createPixmapData(static_cast(type)); + if ((w > 0 && h > 0) || type == QPixmapData::BitmapType) + data = QPixmapData::create(w, h, (QPixmapData::PixelType) type); else - data = QGraphicsSystem::createDefaultPixmapData(static_cast(type)); - - data->resize(w, h); + data = 0; } /*! @@ -307,7 +304,7 @@ QPixmap::QPixmap(const char * const xpm[]) QImage image(xpm); if (!image.isNull()) { - if (data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPixmapData::BitmapType) *this = QBitmap::fromImage(image); else *this = fromImage(image); @@ -322,8 +319,8 @@ QPixmap::QPixmap(const char * const xpm[]) QPixmap::~QPixmap() { - Q_ASSERT(data->ref >= 1); // Catch if ref-counting changes again - if (data->is_cached && data->ref == 1) // ref will be decrememnted after destructor returns + Q_ASSERT(!data || data->ref >= 1); // Catch if ref-counting changes again + if (data && data->is_cached && data->ref == 1) // ref will be decrememnted after destructor returns QImagePixmapCleanupHooks::executePixmapDestructionHooks(this); } @@ -544,7 +541,7 @@ bool QPixmap::isQBitmap() const */ bool QPixmap::isNull() const { - return data->isNull(); + return !data || data->isNull(); } /*! @@ -556,7 +553,7 @@ bool QPixmap::isNull() const */ int QPixmap::width() const { - return data->width(); + return data ? data->width() : 0; } /*! @@ -568,7 +565,7 @@ int QPixmap::width() const */ int QPixmap::height() const { - return data->height(); + return data ? data->height() : 0; } /*! @@ -581,7 +578,7 @@ int QPixmap::height() const */ QSize QPixmap::size() const { - return QSize(data->width(), data->height()); + return data ? QSize(data->width(), data->height()) : QSize(); } /*! @@ -593,7 +590,7 @@ QSize QPixmap::size() const */ QRect QPixmap::rect() const { - return QRect(0, 0, data->width(), data->height()); + return data ? QRect(0, 0, data->width(), data->height()) : QRect(); } /*! @@ -609,7 +606,7 @@ QRect QPixmap::rect() const */ int QPixmap::depth() const { - return data->depth(); + return data ? data->depth() : 0; } /*! @@ -639,7 +636,7 @@ void QPixmap::resize_helper(const QSize &s) return; // Create new pixmap - QPixmap pm(QSize(w, h), data->type); + QPixmap pm(QSize(w, h), data ? data->type : QPixmapData::PixmapType); bool uninit = false; #if defined(Q_WS_X11) QX11PixmapData *x11Data = data->classId() == QPixmapData::X11Class ? static_cast(data.data()) : 0; @@ -728,6 +725,9 @@ void QPixmap::setMask(const QBitmap &mask) return; } + if (isNull()) + return; + if (static_cast(mask).data == data) // trying to selfmask return; @@ -826,11 +826,14 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers QFileInfo info(fileName); QString key = QLatin1String("qt_pixmap_") + info.absoluteFilePath() + QLatin1Char('_') + QString::number(info.lastModified().toTime_t()) + QLatin1Char('_') + - QString::number(info.size()) + QLatin1Char('_') + QString::number(data->pixelType()); + QString::number(info.size()) + QLatin1Char('_') + QString::number(data ? data->pixelType() : QPixmapData::PixmapType); if (QPixmapCache::find(key, *this)) return true; + if (!data) + data = QPixmapData::create(0, 0, QPixmapData::PixmapType); + if (data->fromFile(fileName, format, flags)) { QPixmapCache::insert(key, *this); return true; @@ -863,6 +866,9 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I if (len == 0 || buf == 0) return false; + if (!data) + data = QPixmapData::create(0, 0, QPixmapData::PixmapType); + return data->fromData(buf, len, format, flags); } @@ -1008,6 +1014,9 @@ int QPixmap::serialNumber() const */ qint64 QPixmap::cacheKey() const { + if (isNull()) + return 0; + int classKey = data->classId(); if (classKey >= 1024) classKey = -(classKey >> 10); @@ -1224,7 +1233,7 @@ QPixmap::QPixmap(const QImage& image) QPixmap &QPixmap::operator=(const QImage &image) { - if (data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPixmapData::BitmapType) *this = QBitmap::fromImage(image); else *this = fromImage(image); @@ -1254,7 +1263,7 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Color */ bool QPixmap::convertFromImage(const QImage &image, ColorMode mode) { - if (data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPixmapData::BitmapType) *this = QBitmap::fromImage(image, colorModeToFlags(mode)); else *this = fromImage(image, colorModeToFlags(mode)); @@ -1341,7 +1350,7 @@ Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, bool QPixmap::isDetached() const { - return data->ref == 1; + return data && data->ref == 1; } /*! \internal @@ -1753,7 +1762,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) */ bool QPixmap::hasAlpha() const { - return (data->hasAlphaChannel() || !data->mask().isNull()); + return data && (data->hasAlphaChannel() || !data->mask().isNull()); } /*! @@ -1764,7 +1773,7 @@ bool QPixmap::hasAlpha() const */ bool QPixmap::hasAlphaChannel() const { - return data->hasAlphaChannel(); + return data && data->hasAlphaChannel(); } /*! @@ -1772,7 +1781,7 @@ bool QPixmap::hasAlphaChannel() const */ int QPixmap::metric(PaintDeviceMetric metric) const { - return data->metric(metric); + return data ? data->metric(metric) : 0; } /*! @@ -1844,7 +1853,7 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel) */ QPixmap QPixmap::alphaChannel() const { - return data->alphaChannel(); + return data ? data->alphaChannel() : QPixmap(); } /*! @@ -1852,7 +1861,7 @@ QPixmap QPixmap::alphaChannel() const */ QPaintEngine *QPixmap::paintEngine() const { - return data->paintEngine(); + return data ? data->paintEngine() : 0; } /*! @@ -1867,7 +1876,7 @@ QPaintEngine *QPixmap::paintEngine() const */ QBitmap QPixmap::mask() const { - return data->mask(); + return data ? data->mask() : QBitmap(); } /*! @@ -1916,6 +1925,9 @@ int QPixmap::defaultDepth() */ void QPixmap::detach() { + if (!data) + return; + QPixmapData::ClassId id = data->classId(); if (id == QPixmapData::RasterClass) { QRasterPixmapData *rasterData = static_cast(data.data()); diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index afa6f83..15350e8 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -965,6 +965,9 @@ Qt::HANDLE QPixmap::macQDAlphaHandle() const Qt::HANDLE QPixmap::macCGHandle() const { + if (isNull()) + return 0; + if (data->classId() == QPixmapData::MacClass) { QMacPixmapData *d = static_cast(data.data()); if (!d->cg_data) diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp index 6b4283e..a8516a5 100644 --- a/src/gui/image/qpixmap_qws.cpp +++ b/src/gui/image/qpixmap_qws.cpp @@ -114,7 +114,7 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) QRgb* QPixmap::clut() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast(data.data()); return d->image.colorTable().data(); } @@ -124,7 +124,7 @@ QRgb* QPixmap::clut() const int QPixmap::numCols() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast(data.data()); return d->image.numColors(); } @@ -134,7 +134,7 @@ int QPixmap::numCols() const const uchar* QPixmap::qwsBits() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast(data.data()); return d->image.bits(); } @@ -144,7 +144,7 @@ const uchar* QPixmap::qwsBits() const int QPixmap::qwsBytesPerLine() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast(data.data()); return d->image.bytesPerLine(); } diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 666d608..d4c97e1 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -311,7 +311,7 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h) CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const { QPixmapData *data = pixmapData(); - if (data->isNull()) + if (!data || data->isNull()) return 0; return reinterpret_cast(data->toNativeType(QPixmapData::FbsBitmap)); @@ -337,8 +337,9 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) if (!bitmap) return QPixmap(); - QPixmap pixmap; - pixmap.pixmapData()->fromNativeType(reinterpret_cast(bitmap), QPixmapData::FbsBitmap); + QScopedPointer data(new QS60PixmapData(QPixmapData::PixmapType)); + data->fromNativeType(reinterpret_cast(bitmap), QPixmapData::FbsBitmap); + QPixmap pixmap(data.take()); return pixmap; } @@ -752,9 +753,9 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) if (!sgImage) return QPixmap(); - QPixmap pixmap; - pixmap.pixmapData()->fromNativeType(reinterpret_cast(sgImage), QPixmapData::SgImage); - + QScopedPointer data(new QS60PixmapData(QPixmapData::PixmapType)); + data->fromNativeType(reinterpret_cast(bitmap), QPixmapData::SgImage); + QPixmap pixmap(data.take()); return pixmap; } diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 1b61484..04027c1 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -121,6 +121,9 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const { + if (isNull()) + return 0; + HBITMAP bitmap = 0; if (data->classId() == QPixmapData::RasterClass) { QRasterPixmapData* d = static_cast(data.data()); diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index ea9eff9..8a0120a 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1976,6 +1976,9 @@ void QPixmap::x11SetScreen(int screen) return; } + if (isNull()) + return; + if (data->classId() != QPixmapData::X11Class) return; @@ -2078,7 +2081,7 @@ bool QX11PixmapData::hasAlphaChannel() const const QX11Info &QPixmap::x11Info() const { - if (data->classId() == QPixmapData::X11Class) + if (data && data->classId() == QPixmapData::X11Class) return static_cast(data.data())->xinfo; else { static QX11Info nullX11Info; @@ -2135,7 +2138,7 @@ QPaintEngine* QX11PixmapData::paintEngine() const Qt::HANDLE QPixmap::x11PictureHandle() const { #ifndef QT_NO_XRENDER - if (data->classId() == QPixmapData::X11Class) + if (data && data->classId() == QPixmapData::X11Class) return static_cast(data.data())->picture; else return 0; diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 1ad1f02..10194e4 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -51,6 +51,19 @@ QT_BEGIN_NAMESPACE const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +QPixmapData *QPixmapData::create(int w, int h, PixelType type) +{ + QPixmapData *data; + QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); + if (gs) + data = gs->createPixmapData(static_cast(type)); + else + data = QGraphicsSystem::createDefaultPixmapData(static_cast(type)); + data->resize(w, h); + return data; +} + + QPixmapData::QPixmapData(PixelType pixelType, int objectId) : w(0), h(0), diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index e99409c..d1bb92a 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -122,6 +122,8 @@ public: virtual void fromNativeType(void* pixmap, NativeType type); #endif + static QPixmapData *create(int w, int h, PixelType type); + protected: void setSerialNumber(int serNo); int w; -- cgit v0.12 From 180e36e586437ffb751166f0088329ecbec3001e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Fri, 30 Oct 2009 13:43:40 +0200 Subject: S60Style: List items should be taller for touch use (5th Edition) This fixes private JIRA issue: QT-1479. The change makes itemview items taller by twice the QStyle::PM_FocusFrameVMargin amount (both margins) when touch is in use. It is rather curious that the QCommonStyle modifies QRect for itemviews in horizontal direction by twice the QStyle::PM_FocusFrameHMargin amount, but does not do it in vertical direction. Task-number: QT-1479 (private) Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b87f3a8..dc38397 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2266,10 +2266,19 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz += QSize(2*f->lineWidth, 4*f->lineWidth); break; case CT_TabBarTab: - QSize naviPaneSize = QS60StylePrivate::naviPaneSize(); + { + const QSize naviPaneSize = QS60StylePrivate::naviPaneSize(); + sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); + if (naviPaneSize.height() > sz.height()) + sz.setHeight(naviPaneSize.height()); + } + break; + case CT_ItemViewItem: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); - if (naviPaneSize.height() > sz.height()) - sz.setHeight(naviPaneSize.height()); + if (QS60StylePrivate::isTouchSupported()) + //Make itemview easier to use in touch devices + //QCommonStyle does not adjust height with horizontal margin, it only adjusts width + sz.setHeight(sz.height() + 2*pixelMetric(QStyle::PM_FocusFrameVMargin)); break; default: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); -- cgit v0.12 From e662c6a07a01506bd14b57790a887d5c68b79420 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 20 Oct 2009 16:42:06 +0200 Subject: Refactor of shader manager to not use partial shaders This is a first step towards supporting binary shaders. Note: This change will introduce a (rare) leak of shader objects, as the shaders will never be kicked out from the cache (because the cache is still a QList) :-) This will be corrected by the next patch. Reviewed-By: Samuel --- .../gl2paintengineex/qglcustomshaderstage.cpp | 21 +- .../gl2paintengineex/qglcustomshaderstage_p.h | 3 +- .../gl2paintengineex/qglengineshadermanager.cpp | 340 ++++++++++----------- .../gl2paintengineex/qglengineshadermanager_p.h | 64 ++-- 4 files changed, 211 insertions(+), 217 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp index ab2026c..b71a7b7 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp @@ -67,8 +67,10 @@ QGLCustomShaderStage::QGLCustomShaderStage() QGLCustomShaderStage::~QGLCustomShaderStage() { Q_D(QGLCustomShaderStage); - if (d->m_manager) - d->m_manager->removeCustomStage(this); + if (d->m_manager) { + d->m_manager->removeCustomStage(); + d->m_manager->sharedShaders->cleanupCustomStage(this); + } } void QGLCustomShaderStage::setUniformsDirty() @@ -85,6 +87,8 @@ bool QGLCustomShaderStage::setOnPainter(QPainter* p) qWarning("QGLCustomShaderStage::setOnPainter() - paint engine not OpenGL2"); return false; } + if (d->m_manager) + qWarning("Custom shader is already set on a painter"); QGL2PaintEngineEx *engine = static_cast(p->paintEngine()); d->m_manager = QGL2PaintEngineExPrivate::shaderManagerForEngine(engine); @@ -108,12 +112,21 @@ void QGLCustomShaderStage::removeFromPainter(QPainter* p) // This should leave the program in a compiled/linked state // if the next custom shader stage is this one again. d->m_manager->setCustomStage(0); + d->m_manager = 0; } -const char* QGLCustomShaderStage::source() const +QByteArray QGLCustomShaderStage::source() const { Q_D(const QGLCustomShaderStage); - return d->m_source.constData(); + return d->m_source; +} + +// Called by the shader manager if another custom shader is attached or +// the manager is deleted +void QGLCustomShaderStage::setInactive() +{ + Q_D(QGLCustomShaderStage); + d->m_manager = 0; } void QGLCustomShaderStage::setSource(const QByteArray& s) diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h index f8c13c5..e319389 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h @@ -74,8 +74,9 @@ public: bool setOnPainter(QPainter*); void removeFromPainter(QPainter*); - const char* source() const; + QByteArray source() const; + void setInactive(); protected: void setSource(const QByteArray&); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index af9306f..9dc2b53 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -78,7 +78,6 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) , blitShaderProg(0) , simpleShaderProg(0) { - memset(compiledShaders, 0, sizeof(compiledShaders)); /* Rather than having the shader source array statically initialised, it is initialised @@ -121,7 +120,7 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) code[ImageSrcFragmentShader] = qglslImageSrcFragmentShader; code[ImageSrcWithPatternFragmentShader] = qglslImageSrcWithPatternFragmentShader; code[NonPremultipliedImageSrcFragmentShader] = qglslNonPremultipliedImageSrcFragmentShader; - code[CustomImageSrcFragmentShader] = ""; // Supplied by app. + code[CustomImageSrcFragmentShader] = qglslCustomSrcFragmentShader; // Calls "customShader", which must be appended code[SolidBrushSrcFragmentShader] = qglslSolidBrushSrcFragmentShader; code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader; code[TextureBrushSrcWithPatternFragmentShader] = qglslTextureBrushSrcWithPatternFragmentShader; @@ -163,16 +162,26 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) qglEngineShaderSourceCodePopulated = true; } + QGLShader* fragShader; + QGLShader* vertexShader; + QByteArray source; + // Compile up the simple shader: + source.clear(); + source.append(qglEngineShaderSourceCode[MainVertexShader]); + source.append(qglEngineShaderSourceCode[PositionOnlyVertexShader]); + vertexShader = new QGLShader(QGLShader::VertexShader, context, this); + vertexShader->compile(source); + + source.clear(); + source.append(qglEngineShaderSourceCode[MainFragmentShader]); + source.append(qglEngineShaderSourceCode[ShockingPinkSrcFragmentShader]); + fragShader = new QGLShader(QGLShader::FragmentShader, context, this); + fragShader->compile(source); + simpleShaderProg = new QGLShaderProgram(context, this); - compileNamedShader(MainVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(PositionOnlyVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(MainFragmentShader, QGLShader::PartialFragmentShader); - compileNamedShader(ShockingPinkSrcFragmentShader, QGLShader::PartialFragmentShader); - simpleShaderProg->addShader(compiledShaders[MainVertexShader]); - simpleShaderProg->addShader(compiledShaders[PositionOnlyVertexShader]); - simpleShaderProg->addShader(compiledShaders[MainFragmentShader]); - simpleShaderProg->addShader(compiledShaders[ShockingPinkSrcFragmentShader]); + simpleShaderProg->addShader(vertexShader); + simpleShaderProg->addShader(fragShader); simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); simpleShaderProg->link(); if (!simpleShaderProg->isLinked()) { @@ -181,82 +190,29 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) } // Compile the blit shader: + source.clear(); + source.append(qglEngineShaderSourceCode[MainWithTexCoordsVertexShader]); + source.append(qglEngineShaderSourceCode[UntransformedPositionVertexShader]); + vertexShader = new QGLShader(QGLShader::VertexShader, context, this); + vertexShader->compile(source); + + source.clear(); + source.append(qglEngineShaderSourceCode[MainFragmentShader]); + source.append(qglEngineShaderSourceCode[ImageSrcFragmentShader]); + fragShader = new QGLShader(QGLShader::FragmentShader, context, this); + fragShader->compile(source); + blitShaderProg = new QGLShaderProgram(context, this); - compileNamedShader(MainWithTexCoordsVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(UntransformedPositionVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(MainFragmentShader, QGLShader::PartialFragmentShader); - compileNamedShader(ImageSrcFragmentShader, QGLShader::PartialFragmentShader); - blitShaderProg->addShader(compiledShaders[MainWithTexCoordsVertexShader]); - blitShaderProg->addShader(compiledShaders[UntransformedPositionVertexShader]); - blitShaderProg->addShader(compiledShaders[MainFragmentShader]); - blitShaderProg->addShader(compiledShaders[ImageSrcFragmentShader]); + blitShaderProg->addShader(vertexShader); + blitShaderProg->addShader(fragShader); blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); blitShaderProg->link(); if (!blitShaderProg->isLinked()) { qCritical() << "Errors linking blit shader:" - << blitShaderProg->log(); - } -} - -void QGLEngineSharedShaders::shaderDestroyed(QObject *shader) -{ - // Remove any shader programs which has this as the srcPixel shader: - for (int i = 0; i < cachedPrograms.size(); ++i) { - if (cachedPrograms.at(i).srcPixelFragShader == shader) { - delete cachedPrograms.at(i).program; - cachedPrograms.removeAt(i--); - } + << simpleShaderProg->log(); } - emit shaderProgNeedsChanging(); -} - -QGLShader *QGLEngineSharedShaders::compileNamedShader(ShaderName name, QGLShader::ShaderType type) -{ - Q_ASSERT(name != CustomImageSrcFragmentShader); - Q_ASSERT(name < InvalidShaderName); - - if (compiledShaders[name]) - return compiledShaders[name]; - - QByteArray source = qglEngineShaderSourceCode[name]; - QGLShader *newShader = new QGLShader(type, ctxGuard.context(), this); - newShader->compile(source); - -#if defined(QT_DEBUG) - // Name the shader for easier debugging - QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); - newShader->setObjectName(QLatin1String(m.valueToKey(name))); -#endif - - compiledShaders[name] = newShader; - return newShader; -} - -QGLShader *QGLEngineSharedShaders::compileCustomShader(QGLCustomShaderStage *stage, QGLShader::ShaderType type) -{ - QByteArray source = stage->source(); - source += qglslCustomSrcFragmentShader; - - QGLShader *newShader = customShaderCache.object(source); - if (newShader) - return newShader; - - newShader = new QGLShader(type, ctxGuard.context(), this); - newShader->compile(source); - customShaderCache.insert(source, newShader); - - connect(newShader, SIGNAL(destroyed(QObject *)), - this, SLOT(shaderDestroyed(QObject *))); - -#if defined(QT_DEBUG) - // Name the shader for easier debugging - QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); - newShader->setObjectName(QLatin1String(m.valueToKey(CustomImageSrcFragmentShader))); -#endif - - return newShader; } // The address returned here will only be valid until next time this function is called. @@ -270,14 +226,54 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS cachedPrograms.append(prog); QGLEngineShaderProg &cached = cachedPrograms.last(); + QByteArray source; + source.append(qglEngineShaderSourceCode[prog.mainFragShader]); + source.append(qglEngineShaderSourceCode[prog.srcPixelFragShader]); + if (prog.srcPixelFragShader == CustomImageSrcFragmentShader) + source.append(prog.customStageSource); + if (prog.compositionFragShader) + source.append(qglEngineShaderSourceCode[prog.compositionFragShader]); + if (prog.maskFragShader) + source.append(qglEngineShaderSourceCode[prog.maskFragShader]); + QGLShader* fragShader = new QGLShader(QGLShader::FragmentShader, ctxGuard.context(), this); + fragShader->compile(source); + + source.clear(); + source.append(qglEngineShaderSourceCode[prog.mainVertexShader]); + source.append(qglEngineShaderSourceCode[prog.positionVertexShader]); + QGLShader* vertexShader = new QGLShader(QGLShader::VertexShader, ctxGuard.context(), this); + vertexShader->compile(source); + +#if defined(QT_DEBUG) + // Name the shaders for easier debugging + QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); + QByteArray description; + description.append("Fragment shader: main="); + description.append(m.valueToKey(prog.mainFragShader)); + description.append(", srcPixel="); + description.append(m.valueToKey(prog.srcPixelFragShader)); + if (prog.compositionFragShader) { + description.append(", composition="); + description.append(m.valueToKey(prog.compositionFragShader)); + } + if (prog.maskFragShader) { + description.append(", mask="); + description.append(m.valueToKey(prog.maskFragShader)); + } + fragShader->setObjectName(QString::fromLatin1(description)); + + description.clear(); + description.append("Vertex shader: main="); + description.append(m.valueToKey(prog.mainVertexShader)); + description.append(", position="); + description.append(m.valueToKey(prog.positionVertexShader)); + vertexShader->setObjectName(QString::fromLatin1(description)); +#endif + // If the shader program's not found in the cache, create it now. cached.program = new QGLShaderProgram(ctxGuard.context(), this); - cached.program->addShader(cached.mainVertexShader); - cached.program->addShader(cached.positionVertexShader); - cached.program->addShader(cached.mainFragShader); - cached.program->addShader(cached.srcPixelFragShader); - cached.program->addShader(cached.maskFragShader); - cached.program->addShader(cached.compositionFragShader); + cached.program->addShader(vertexShader); + cached.program->addShader(fragShader); // We have to bind the vertex attribute names before the program is linked: cached.program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); @@ -294,25 +290,11 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS error = QLatin1String("Shader program failed to link,") #if defined(QT_DEBUG) + br - + QLatin1String(" Shaders Used:\n") - + QLatin1String(" mainVertexShader = ") - + (cached.mainVertexShader ? - cached.mainVertexShader->objectName() : none) + br - + QLatin1String(" positionVertexShader = ") - + (cached.positionVertexShader ? - cached.positionVertexShader->objectName() : none) + br - + QLatin1String(" mainFragShader = ") - + (cached.mainFragShader ? - cached.mainFragShader->objectName() : none) + br - + QLatin1String(" srcPixelFragShader = ") - + (cached.srcPixelFragShader ? - cached.srcPixelFragShader->objectName() : none) + br - + QLatin1String(" maskFragShader = ") - + (cached.maskFragShader ? - cached.maskFragShader->objectName() : none) + br - + QLatin1String(" compositionFragShader = ") - + (cached.compositionFragShader ? - cached.compositionFragShader->objectName() : none) + br + + QLatin1String(" Shaders Used:") + br + + QLatin1String(" ") + vertexShader->objectName() + QLatin1String(": ") + br + + QLatin1String(vertexShader->sourceCode()) + br + + QLatin1String(" ") + fragShader->objectName() + QLatin1String(": ") + br + + QLatin1String(fragShader->sourceCode()) + br #endif + QLatin1String(" Error Log:\n") + QLatin1String(" ") + cached.program->log(); @@ -327,6 +309,20 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS } } + +void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage) +{ + // Remove any shader programs which has this as the custom shader src: + for (int i = 0; i < cachedPrograms.size(); ++i) { + if (cachedPrograms.at(i).customStageSource == stage->source()) { + delete cachedPrograms.at(i).program; + cachedPrograms.removeAt(i--); + } + } +} + + + QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) : ctx(context), shaderProgNeedsChanging(true), @@ -335,8 +331,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) maskType(NoMask), compositionMode(QPainter::CompositionMode_SourceOver), customSrcStage(0), - currentShaderProg(0), - customShader(0) + currentShaderProg(0) { sharedShaders = QGLEngineSharedShaders::shadersForContext(context); connect(sharedShaders, SIGNAL(shaderProgNeedsChanging()), this, SLOT(shaderProgNeedsChangingSlot())); @@ -345,6 +340,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) QGLEngineShaderManager::~QGLEngineShaderManager() { //### + removeCustomStage(); } uint QGLEngineShaderManager::getUniformLocation(Uniform id) @@ -436,21 +432,20 @@ void QGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode) void QGLEngineShaderManager::setCustomStage(QGLCustomShaderStage* stage) { + if (customSrcStage) + removeCustomStage(); customSrcStage = stage; - customShader = 0; // Will be compiled from 'customSrcStage' later. shaderProgNeedsChanging = true; } -void QGLEngineShaderManager::removeCustomStage(QGLCustomShaderStage* stage) +void QGLEngineShaderManager::removeCustomStage() { - Q_UNUSED(stage); // Currently we only support one at a time... - + if (customSrcStage) + customSrcStage->setInactive(); customSrcStage = 0; - customShader = 0; shaderProgNeedsChanging = true; } - QGLShaderProgram* QGLEngineShaderManager::currentProgram() { return currentShaderProg->program; @@ -488,16 +483,16 @@ bool QGLEngineShaderManager::useCorrectShaderProg() // Choose vertex shader shader position function (which typically also sets // varyings) and the source pixel (srcPixel) fragment shader function: - QGLEngineSharedShaders::ShaderName positionVertexShaderName = QGLEngineSharedShaders::InvalidShaderName; - QGLEngineSharedShaders::ShaderName srcPixelFragShaderName = QGLEngineSharedShaders::InvalidShaderName; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::InvalidShaderName; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::InvalidShaderName; bool isAffine = brushTransform.isAffine(); if ( (srcPixelType >= Qt::Dense1Pattern) && (srcPixelType <= Qt::DiagCrossPattern) ) { if (isAffine) - positionVertexShaderName = QGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader; else - positionVertexShaderName = QGLEngineSharedShaders::PositionWithPatternBrushVertexShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionWithPatternBrushVertexShader; - srcPixelFragShaderName = QGLEngineSharedShaders::PatternBrushSrcFragmentShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::PatternBrushSrcFragmentShader; } else switch (srcPixelType) { default: @@ -505,172 +500,157 @@ bool QGLEngineShaderManager::useCorrectShaderProg() qFatal("QGLEngineShaderManager::useCorrectShaderProg() - Qt::NoBrush style is set"); break; case QGLEngineShaderManager::ImageSrc: - srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; texCoords = true; break; case QGLEngineShaderManager::NonPremultipliedImageSrc: - srcPixelFragShaderName = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; texCoords = true; break; case QGLEngineShaderManager::PatternSrc: - srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; texCoords = true; break; case QGLEngineShaderManager::TextureSrcWithPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader; break; case Qt::SolidPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::SolidBrushSrcFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::SolidBrushSrcFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; break; case Qt::LinearGradientPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader : QGLEngineSharedShaders::PositionWithLinearGradientBrushVertexShader; break; case Qt::ConicalGradientPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader : QGLEngineSharedShaders::PositionWithConicalGradientBrushVertexShader; break; case Qt::RadialGradientPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader : QGLEngineSharedShaders::PositionWithRadialGradientBrushVertexShader; break; case Qt::TexturePattern: - srcPixelFragShaderName = QGLEngineSharedShaders::TextureBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader; break; }; - requiredProgram.positionVertexShader = sharedShaders->compileNamedShader(positionVertexShaderName, QGLShader::PartialVertexShader); + if (useCustomSrc) { - if (!customShader) - customShader = sharedShaders->compileCustomShader(customSrcStage, QGLShader::PartialFragmentShader); - requiredProgram.srcPixelFragShader = customShader; - } else { - requiredProgram.srcPixelFragShader = sharedShaders->compileNamedShader(srcPixelFragShaderName, QGLShader::PartialFragmentShader); + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::CustomImageSrcFragmentShader; + requiredProgram.customStageSource = customSrcStage->source(); } const bool hasCompose = compositionMode > QPainter::CompositionMode_Plus; const bool hasMask = maskType != QGLEngineShaderManager::NoMask; // Choose fragment shader main function: - QGLEngineSharedShaders::ShaderName mainFragShaderName; - if (opacityMode == AttributeOpacity) { Q_ASSERT(!hasCompose && !hasMask); - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_ImageArrays; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_ImageArrays; } else { bool useGlobalOpacity = (opacityMode == UniformOpacity); if (hasCompose && hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CMO; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CMO; if (hasCompose && hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CM; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CM; if (!hasCompose && hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_MO; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_MO; if (!hasCompose && hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_M; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_M; if (hasCompose && !hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CO; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CO; if (hasCompose && !hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_C; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_C; if (!hasCompose && !hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_O; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_O; if (!hasCompose && !hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader; } - requiredProgram.mainFragShader = sharedShaders->compileNamedShader(mainFragShaderName, QGLShader::PartialFragmentShader); - if (hasMask) { - QGLEngineSharedShaders::ShaderName maskShaderName = QGLEngineSharedShaders::InvalidShaderName; if (maskType == PixelMask) { - maskShaderName = QGLEngineSharedShaders::MaskFragmentShader; + requiredProgram.maskFragShader = QGLEngineSharedShaders::MaskFragmentShader; texCoords = true; } else if (maskType == SubPixelMaskPass1) { - maskShaderName = QGLEngineSharedShaders::RgbMaskFragmentShaderPass1; + requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass1; texCoords = true; } else if (maskType == SubPixelMaskPass2) { - maskShaderName = QGLEngineSharedShaders::RgbMaskFragmentShaderPass2; + requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass2; texCoords = true; } else if (maskType == SubPixelWithGammaMask) { - maskShaderName = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader; + requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader; texCoords = true; } else { qCritical("QGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type"); } - - requiredProgram.maskFragShader = sharedShaders->compileNamedShader(maskShaderName, QGLShader::PartialFragmentShader); } else { requiredProgram.maskFragShader = 0; } if (hasCompose) { - QGLEngineSharedShaders::ShaderName compositionShaderName = QGLEngineSharedShaders::InvalidShaderName; switch (compositionMode) { case QPainter::CompositionMode_Multiply: - compositionShaderName = QGLEngineSharedShaders::MultiplyCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::MultiplyCompositionModeFragmentShader; break; case QPainter::CompositionMode_Screen: - compositionShaderName = QGLEngineSharedShaders::ScreenCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ScreenCompositionModeFragmentShader; break; case QPainter::CompositionMode_Overlay: - compositionShaderName = QGLEngineSharedShaders::OverlayCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::OverlayCompositionModeFragmentShader; break; case QPainter::CompositionMode_Darken: - compositionShaderName = QGLEngineSharedShaders::DarkenCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::DarkenCompositionModeFragmentShader; break; case QPainter::CompositionMode_Lighten: - compositionShaderName = QGLEngineSharedShaders::LightenCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::LightenCompositionModeFragmentShader; break; case QPainter::CompositionMode_ColorDodge: - compositionShaderName = QGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader; break; case QPainter::CompositionMode_ColorBurn: - compositionShaderName = QGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader; break; case QPainter::CompositionMode_HardLight: - compositionShaderName = QGLEngineSharedShaders::HardLightCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::HardLightCompositionModeFragmentShader; break; case QPainter::CompositionMode_SoftLight: - compositionShaderName = QGLEngineSharedShaders::SoftLightCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::SoftLightCompositionModeFragmentShader; break; case QPainter::CompositionMode_Difference: - compositionShaderName = QGLEngineSharedShaders::DifferenceCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::DifferenceCompositionModeFragmentShader; break; case QPainter::CompositionMode_Exclusion: - compositionShaderName = QGLEngineSharedShaders::ExclusionCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ExclusionCompositionModeFragmentShader; break; default: qWarning("QGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode"); } - requiredProgram.compositionFragShader = sharedShaders->compileNamedShader(compositionShaderName, QGLShader::PartialFragmentShader); } else { requiredProgram.compositionFragShader = 0; } - // Choose vertex shader main function - QGLEngineSharedShaders::ShaderName mainVertexShaderName = QGLEngineSharedShaders::InvalidShaderName; + // Choose vertex shader main function if (opacityMode == AttributeOpacity) { Q_ASSERT(texCoords); - mainVertexShaderName = QGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader; + requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader; } else if (texCoords) { - mainVertexShaderName = QGLEngineSharedShaders::MainWithTexCoordsVertexShader; + requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsVertexShader; } else { - mainVertexShaderName = QGLEngineSharedShaders::MainVertexShader; + requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainVertexShader; } - requiredProgram.mainVertexShader = sharedShaders->compileNamedShader(mainVertexShaderName, QGLShader::PartialVertexShader); requiredProgram.useTextureCoords = texCoords; requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity); - // At this point, requiredProgram is fully populated so try to find the program in the cache currentShaderProg = sharedShaders->findProgramInCache(requiredProgram); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 291d24c..e4f7aa6 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -234,14 +234,16 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) + struct QGLEngineShaderProg { - QGLShader* mainVertexShader; - QGLShader* positionVertexShader; - QGLShader* mainFragShader; - QGLShader* srcPixelFragShader; - QGLShader* maskFragShader; // Can be null for no mask - QGLShader* compositionFragShader; // Can be null for GL-handled mode + int mainVertexShader; + int positionVertexShader; + int mainFragShader; + int srcPixelFragShader; + int maskFragShader; + int compositionFragShader; + QByteArray customStageSource; //TODO: Decent cache key for custom stages QGLShaderProgram* program; QVector uniformLocations; @@ -256,7 +258,8 @@ struct QGLEngineShaderProg mainFragShader == other.mainFragShader && srcPixelFragShader == other.srcPixelFragShader && maskFragShader == other.maskFragShader && - compositionFragShader == other.compositionFragShader + compositionFragShader == other.compositionFragShader && + customStageSource == other.customStageSource ); } }; @@ -344,33 +347,44 @@ public: TotalShaderCount, InvalidShaderName }; +#if defined (QT_DEBUG) + Q_ENUMS(ShaderName) +#endif - QGLEngineSharedShaders(const QGLContext *context); +/* + // These allow the ShaderName enum to be used as a cache key + const int mainVertexOffset = 0; + const int positionVertexOffset = (1<<2) - PositionOnlyVertexShader; + const int mainFragOffset = (1<<6) - MainFragmentShader_CMO; + const int srcPixelOffset = (1<<10) - ImageSrcFragmentShader; + const int maskOffset = (1<<14) - NoMaskShader; + const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader; +*/ - QGLShader *compileNamedShader(ShaderName name, QGLShader::ShaderType type); + QGLEngineSharedShaders(const QGLContext *context); QGLShaderProgram *simpleProgram() { return simpleShaderProg; } QGLShaderProgram *blitProgram() { return blitShaderProg; } // Compile the program if it's not already in the cache, return the item in the cache. QGLEngineShaderProg *findProgramInCache(const QGLEngineShaderProg &prog); // Compile the custom shader if it's not already in the cache, return the item in the cache. - QGLShader *compileCustomShader(QGLCustomShaderStage *stage, QGLShader::ShaderType type); static QGLEngineSharedShaders *shadersForContext(const QGLContext *context); + // Ideally, this would be static and cleanup all programs in all contexts which + // contain the custom code. Currently it is just a hint and we rely on deleted + // custom shaders being cleaned up by being kicked out of the cache when it's + // full. + void cleanupCustomStage(QGLCustomShaderStage* stage); + signals: void shaderProgNeedsChanging(); -private slots: - void shaderDestroyed(QObject *shader); - private: QGLSharedResourceGuard ctxGuard; QGLShaderProgram *blitShaderProg; QGLShaderProgram *simpleShaderProg; QList cachedPrograms; - QCache customShaderCache; - QGLShader* compiledShaders[TotalShaderCount]; static const char* qglEngineShaderSourceCode[TotalShaderCount]; }; @@ -426,7 +440,7 @@ public: void setMaskType(MaskType); void setCompositionMode(QPainter::CompositionMode); void setCustomStage(QGLCustomShaderStage* stage); - void removeCustomStage(QGLCustomShaderStage* stage); + void removeCustomStage(); uint getUniformLocation(Uniform id); @@ -437,19 +451,7 @@ public: QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers QGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer -/* - // These allow the ShaderName enum to be used as a cache key - const int mainVertexOffset = 0; - const int positionVertexOffset = (1<<2) - PositionOnlyVertexShader; - const int mainFragOffset = (1<<6) - MainFragmentShader_CMO; - const int srcPixelOffset = (1<<10) - ImageSrcFragmentShader; - const int maskOffset = (1<<14) - NoMaskShader; - const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader; -*/ - -#if defined (QT_DEBUG) - Q_ENUMS(ShaderName) -#endif + QGLEngineSharedShaders* sharedShaders; private slots: void shaderProgNeedsChangingSlot() { shaderProgNeedsChanging = true; } @@ -466,9 +468,7 @@ private: QPainter::CompositionMode compositionMode; QGLCustomShaderStage* customSrcStage; - QGLEngineShaderProg* currentShaderProg; - QGLEngineSharedShaders *sharedShaders; - QGLShader *customShader; + QGLEngineShaderProg* currentShaderProg; }; QT_END_NAMESPACE -- cgit v0.12 From 4e60cdcf222f607ccc49138035fb3d17140fee51 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 30 Oct 2009 13:54:24 +0200 Subject: Fixed keypad navigation in QFileDialog details view Made it possible to navigate out of QFileDialog details view using keypad navigation. Task-number: QTBUG-4793 Reviewed-by: Alessandro Portale --- src/gui/dialogs/qfiledialog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index eab842f..50823cd 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3187,7 +3187,17 @@ void QFileDialogTreeView::keyPressEvent(QKeyEvent *e) if (!d_ptr->itemViewKeyboardEvent(e)) { QTreeView::keyPressEvent(e); } +#ifdef QT_KEYPAD_NAVIGATION + else if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder + || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) + && !hasEditFocus()) { + e->ignore(); + } else { + e->accept(); + } +#else e->accept(); +#endif } QSize QFileDialogTreeView::sizeHint() const -- cgit v0.12 From 3a7804813d9dd4162e088bc19746abd20aaa7827 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 30 Oct 2009 13:23:27 +0100 Subject: Removed the margin in assistant on Mac. Change 9551b8c349ce4e15a57c24a2408ee1b73c2b7510 enabled documentMode on the tabbar in Assistant. To make it look more native we also remove the margin around the tabwidget. Reviewed-by: Prasanth --- tools/assistant/tools/assistant/centralwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 2722b2f..62b4736 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -222,8 +222,8 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent) QVBoxLayout *vboxLayout = new QVBoxLayout(this); QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); -#ifndef Q_OS_MAC vboxLayout->setMargin(0); +#ifndef Q_OS_MAC resourcePath.append(QLatin1String("win")); #else resourcePath.append(QLatin1String("mac")); -- cgit v0.12 From a8d1c0a7137b2d1f7ca74a24321cea41428ce0bd Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 26 Oct 2009 15:57:22 +0100 Subject: Rename qglEngineShaderSourceCode to qShaderSnippets This patch also adds a "snippetNameStr" helper for debugging. --- .../gl2paintengineex/qglengineshadermanager.cpp | 86 ++++++++++++---------- .../gl2paintengineex/qglengineshadermanager_p.h | 78 +++++++++++--------- 2 files changed, 93 insertions(+), 71 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 9dc2b53..be0e98a 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -66,7 +66,7 @@ QGLEngineSharedShaders *QGLEngineSharedShaders::shadersForContext(const QGLConte return p; } -const char* QGLEngineSharedShaders::qglEngineShaderSourceCode[] = { +const char* QGLEngineSharedShaders::qShaderSnippets[] = { 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, @@ -85,10 +85,10 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) around without having to change the order of the glsl strings. It is hoped this will make future hard-to-find runtime bugs more obvious and generally give more solid code. */ - static bool qglEngineShaderSourceCodePopulated = false; - if (!qglEngineShaderSourceCodePopulated) { + static bool snippetsPopulated = false; + if (!snippetsPopulated) { - const char** code = qglEngineShaderSourceCode; // shortcut + const char** code = qShaderSnippets; // shortcut code[MainVertexShader] = qglslMainVertexShader; code[MainWithTexCoordsVertexShader] = qglslMainWithTexCoordsVertexShader; @@ -130,11 +130,13 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) code[ConicalGradientBrushSrcFragmentShader] = qglslConicalGradientBrushSrcFragmentShader; code[ShockingPinkSrcFragmentShader] = qglslShockingPinkSrcFragmentShader; + code[NoMaskFragmentShader] = ""; code[MaskFragmentShader] = qglslMaskFragmentShader; code[RgbMaskFragmentShaderPass1] = qglslRgbMaskFragmentShaderPass1; code[RgbMaskFragmentShaderPass2] = qglslRgbMaskFragmentShaderPass2; code[RgbMaskWithGammaFragmentShader] = ""; //### + code[NoCompositionModeFragmentShader] = ""; code[MultiplyCompositionModeFragmentShader] = ""; //### code[ScreenCompositionModeFragmentShader] = ""; //### code[OverlayCompositionModeFragmentShader] = ""; //### @@ -149,17 +151,19 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) #if defined(QT_DEBUG) // Check that all the elements have been filled: - for (int i = 0; i < TotalShaderCount; ++i) { - if (qglEngineShaderSourceCode[i] == 0) { - int enumIndex = staticMetaObject.indexOfEnumerator("ShaderName"); - QMetaEnum m = staticMetaObject.enumerator(enumIndex); - - qCritical() << "qglEngineShaderSourceCode: Source for" << m.valueToKey(i) - << "(shader" << i << ") missing!"; + for (int i = 0; i < TotalSnippetCount; ++i) { + if (qShaderSnippets[i] == 0) { + QByteArray msg; + msg.append("Fatal: Shader Snippet for "); + msg.append(snippetNameStr(SnippetName(i))); + msg.append(" ("); + msg.append(QByteArray::number(i)); + msg.append(") is missing!"); + qFatal(msg.constData()); } } #endif - qglEngineShaderSourceCodePopulated = true; + snippetsPopulated = true; } QGLShader* fragShader; @@ -168,14 +172,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) // Compile up the simple shader: source.clear(); - source.append(qglEngineShaderSourceCode[MainVertexShader]); - source.append(qglEngineShaderSourceCode[PositionOnlyVertexShader]); + source.append(qShaderSnippets[MainVertexShader]); + source.append(qShaderSnippets[PositionOnlyVertexShader]); vertexShader = new QGLShader(QGLShader::VertexShader, context, this); vertexShader->compile(source); source.clear(); - source.append(qglEngineShaderSourceCode[MainFragmentShader]); - source.append(qglEngineShaderSourceCode[ShockingPinkSrcFragmentShader]); + source.append(qShaderSnippets[MainFragmentShader]); + source.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); fragShader = new QGLShader(QGLShader::FragmentShader, context, this); fragShader->compile(source); @@ -191,14 +195,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) // Compile the blit shader: source.clear(); - source.append(qglEngineShaderSourceCode[MainWithTexCoordsVertexShader]); - source.append(qglEngineShaderSourceCode[UntransformedPositionVertexShader]); + source.append(qShaderSnippets[MainWithTexCoordsVertexShader]); + source.append(qShaderSnippets[UntransformedPositionVertexShader]); vertexShader = new QGLShader(QGLShader::VertexShader, context, this); vertexShader->compile(source); source.clear(); - source.append(qglEngineShaderSourceCode[MainFragmentShader]); - source.append(qglEngineShaderSourceCode[ImageSrcFragmentShader]); + source.append(qShaderSnippets[MainFragmentShader]); + source.append(qShaderSnippets[ImageSrcFragmentShader]); fragShader = new QGLShader(QGLShader::FragmentShader, context, this); fragShader->compile(source); @@ -215,6 +219,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) } +#if defined (QT_DEBUG) +QByteArray QGLEngineSharedShaders::snippetNameStr(SnippetName name) +{ + QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("SnippetName")); + return QByteArray(m.valueToKey(name)); +} +#endif + // The address returned here will only be valid until next time this function is called. QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog) { @@ -225,48 +237,46 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS cachedPrograms.append(prog); QGLEngineShaderProg &cached = cachedPrograms.last(); - QByteArray source; - source.append(qglEngineShaderSourceCode[prog.mainFragShader]); - source.append(qglEngineShaderSourceCode[prog.srcPixelFragShader]); + source.append(qShaderSnippets[prog.mainFragShader]); + source.append(qShaderSnippets[prog.srcPixelFragShader]); if (prog.srcPixelFragShader == CustomImageSrcFragmentShader) source.append(prog.customStageSource); if (prog.compositionFragShader) - source.append(qglEngineShaderSourceCode[prog.compositionFragShader]); + source.append(qShaderSnippets[prog.compositionFragShader]); if (prog.maskFragShader) - source.append(qglEngineShaderSourceCode[prog.maskFragShader]); + source.append(qShaderSnippets[prog.maskFragShader]); QGLShader* fragShader = new QGLShader(QGLShader::FragmentShader, ctxGuard.context(), this); fragShader->compile(source); source.clear(); - source.append(qglEngineShaderSourceCode[prog.mainVertexShader]); - source.append(qglEngineShaderSourceCode[prog.positionVertexShader]); + source.append(qShaderSnippets[prog.mainVertexShader]); + source.append(qShaderSnippets[prog.positionVertexShader]); QGLShader* vertexShader = new QGLShader(QGLShader::VertexShader, ctxGuard.context(), this); vertexShader->compile(source); #if defined(QT_DEBUG) // Name the shaders for easier debugging - QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); QByteArray description; description.append("Fragment shader: main="); - description.append(m.valueToKey(prog.mainFragShader)); + description.append(snippetNameStr(prog.mainFragShader)); description.append(", srcPixel="); - description.append(m.valueToKey(prog.srcPixelFragShader)); + description.append(snippetNameStr(prog.srcPixelFragShader)); if (prog.compositionFragShader) { description.append(", composition="); - description.append(m.valueToKey(prog.compositionFragShader)); + description.append(snippetNameStr(prog.compositionFragShader)); } if (prog.maskFragShader) { description.append(", mask="); - description.append(m.valueToKey(prog.maskFragShader)); + description.append(snippetNameStr(prog.maskFragShader)); } fragShader->setObjectName(QString::fromLatin1(description)); description.clear(); description.append("Vertex shader: main="); - description.append(m.valueToKey(prog.mainVertexShader)); + description.append(snippetNameStr(prog.mainVertexShader)); description.append(", position="); - description.append(m.valueToKey(prog.positionVertexShader)); + description.append(snippetNameStr(prog.positionVertexShader)); vertexShader->setObjectName(QString::fromLatin1(description)); #endif @@ -483,8 +493,8 @@ bool QGLEngineShaderManager::useCorrectShaderProg() // Choose vertex shader shader position function (which typically also sets // varyings) and the source pixel (srcPixel) fragment shader function: - requiredProgram.positionVertexShader = QGLEngineSharedShaders::InvalidShaderName; - requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::InvalidShaderName; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::InvalidSnippetName; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::InvalidSnippetName; bool isAffine = brushTransform.isAffine(); if ( (srcPixelType >= Qt::Dense1Pattern) && (srcPixelType <= Qt::DiagCrossPattern) ) { if (isAffine) @@ -594,7 +604,7 @@ bool QGLEngineShaderManager::useCorrectShaderProg() qCritical("QGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type"); } } else { - requiredProgram.maskFragShader = 0; + requiredProgram.maskFragShader = QGLEngineSharedShaders::NoMaskFragmentShader; } if (hasCompose) { @@ -636,7 +646,7 @@ bool QGLEngineShaderManager::useCorrectShaderProg() qWarning("QGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode"); } } else { - requiredProgram.compositionFragShader = 0; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::NoCompositionModeFragmentShader; } // Choose vertex shader main function diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index e4f7aa6..fd73b44 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -235,35 +235,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) -struct QGLEngineShaderProg -{ - int mainVertexShader; - int positionVertexShader; - int mainFragShader; - int srcPixelFragShader; - int maskFragShader; - int compositionFragShader; - QByteArray customStageSource; //TODO: Decent cache key for custom stages - QGLShaderProgram* program; - - QVector uniformLocations; - - bool useTextureCoords; - bool useOpacityAttribute; - - bool operator==(const QGLEngineShaderProg& other) { - // We don't care about the program - return ( mainVertexShader == other.mainVertexShader && - positionVertexShader == other.positionVertexShader && - mainFragShader == other.mainFragShader && - srcPixelFragShader == other.srcPixelFragShader && - maskFragShader == other.maskFragShader && - compositionFragShader == other.compositionFragShader && - customStageSource == other.customStageSource - ); - } -}; - /* struct QGLEngineCachedShaderProg { @@ -283,15 +254,19 @@ static const GLuint QT_VERTEX_COORDS_ATTR = 0; static const GLuint QT_TEXTURE_COORDS_ATTR = 1; static const GLuint QT_OPACITY_ATTR = 2; +struct QGLEngineShaderProg; + class QGLEngineSharedShaders : public QObject { Q_OBJECT public: - enum ShaderName { + + enum SnippetName { MainVertexShader, MainWithTexCoordsVertexShader, MainWithTexCoordsAndOpacityVertexShader, + // UntransformedPositionVertexShader must be first in the list: UntransformedPositionVertexShader, PositionOnlyVertexShader, PositionWithPatternBrushVertexShader, @@ -305,6 +280,7 @@ public: AffinePositionWithRadialGradientBrushVertexShader, AffinePositionWithTextureBrushVertexShader, + // MainFragmentShader_CMO must be first in the list: MainFragmentShader_CMO, MainFragmentShader_CM, MainFragmentShader_MO, @@ -315,6 +291,7 @@ public: MainFragmentShader, MainFragmentShader_ImageArrays, + // ImageSrcFragmentShader must be first in the list:: ImageSrcFragmentShader, ImageSrcWithPatternFragmentShader, NonPremultipliedImageSrcFragmentShader, @@ -328,11 +305,15 @@ public: ConicalGradientBrushSrcFragmentShader, ShockingPinkSrcFragmentShader, + // NoMaskFragmentShader must be first in the list: + NoMaskFragmentShader, MaskFragmentShader, RgbMaskFragmentShaderPass1, RgbMaskFragmentShaderPass2, RgbMaskWithGammaFragmentShader, + // NoCompositionModeFragmentShader must be first in the list: + NoCompositionModeFragmentShader, MultiplyCompositionModeFragmentShader, ScreenCompositionModeFragmentShader, OverlayCompositionModeFragmentShader, @@ -345,10 +326,11 @@ public: DifferenceCompositionModeFragmentShader, ExclusionCompositionModeFragmentShader, - TotalShaderCount, InvalidShaderName + TotalSnippetCount, InvalidSnippetName }; #if defined (QT_DEBUG) - Q_ENUMS(ShaderName) + Q_ENUMS(SnippetName) + static QByteArray snippetNameStr(SnippetName snippetName); #endif /* @@ -386,7 +368,37 @@ private: QGLShaderProgram *simpleShaderProg; QList cachedPrograms; - static const char* qglEngineShaderSourceCode[TotalShaderCount]; + static const char* qShaderSnippets[TotalSnippetCount]; +}; + +struct QGLEngineShaderProg +{ + QGLEngineSharedShaders::SnippetName mainVertexShader; + QGLEngineSharedShaders::SnippetName positionVertexShader; + QGLEngineSharedShaders::SnippetName mainFragShader; + QGLEngineSharedShaders::SnippetName srcPixelFragShader; + QGLEngineSharedShaders::SnippetName maskFragShader; + QGLEngineSharedShaders::SnippetName compositionFragShader; + + QByteArray customStageSource; //TODO: Decent cache key for custom stages + QGLShaderProgram* program; + + QVector uniformLocations; + + bool useTextureCoords; + bool useOpacityAttribute; + + bool operator==(const QGLEngineShaderProg& other) { + // We don't care about the program + return ( mainVertexShader == other.mainVertexShader && + positionVertexShader == other.positionVertexShader && + mainFragShader == other.mainFragShader && + srcPixelFragShader == other.srcPixelFragShader && + maskFragShader == other.maskFragShader && + compositionFragShader == other.compositionFragShader && + customStageSource == other.customStageSource + ); + } }; class Q_OPENGL_EXPORT QGLEngineShaderManager : public QObject -- cgit v0.12 From 90567274b900b22ab6b1c016ee66b7915aa994c8 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 30 Oct 2009 12:38:00 +0100 Subject: Implement a simple caching algorithm for shader programs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the number of programs held in the cache exceeds a threshold, the least frequantly used programs get deleted. This also covers programs with custom snippets of code. As a conequence, when a QGLCustomShaderStage gets deleted, any programs using that code will (eventually) be freed. Reviewed-By: Samuel Rødal --- .../gl2paintengineex/qglengineshadermanager.cpp | 71 +++++++++++++--------- .../gl2paintengineex/qglengineshadermanager_p.h | 13 +++- 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index be0e98a..34c448f 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -231,12 +231,14 @@ QByteArray QGLEngineSharedShaders::snippetNameStr(SnippetName name) QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog) { for (int i = 0; i < cachedPrograms.size(); ++i) { - if (cachedPrograms[i] == prog) - return &cachedPrograms[i]; + QGLEngineShaderProg *cachedProg = cachedPrograms[i]; + if (*cachedProg == prog) { + // Move the program to the top of the list as a poor-man's cache algo + cachedPrograms.move(i, 0); + return cachedProg; + } } - cachedPrograms.append(prog); - QGLEngineShaderProg &cached = cachedPrograms.last(); QByteArray source; source.append(qShaderSnippets[prog.mainFragShader]); source.append(qShaderSnippets[prog.srcPixelFragShader]); @@ -280,20 +282,22 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS vertexShader->setObjectName(QString::fromLatin1(description)); #endif + QGLEngineShaderProg* newProg = new QGLEngineShaderProg(prog); + // If the shader program's not found in the cache, create it now. - cached.program = new QGLShaderProgram(ctxGuard.context(), this); - cached.program->addShader(vertexShader); - cached.program->addShader(fragShader); + newProg->program = new QGLShaderProgram(ctxGuard.context(), this); + newProg->program->addShader(vertexShader); + newProg->program->addShader(fragShader); // We have to bind the vertex attribute names before the program is linked: - cached.program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); - if (cached.useTextureCoords) - cached.program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); - if (cached.useOpacityAttribute) - cached.program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); - - cached.program->link(); - if (!cached.program->isLinked()) { + newProg->program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); + if (newProg->useTextureCoords) + newProg->program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); + if (newProg->useOpacityAttribute) + newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); + + newProg->program->link(); + if (!newProg->program->isLinked()) { QLatin1String none("none"); QLatin1String br("\n"); QString error; @@ -307,32 +311,42 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS + QLatin1String(fragShader->sourceCode()) + br #endif + QLatin1String(" Error Log:\n") - + QLatin1String(" ") + cached.program->log(); + + QLatin1String(" ") + newProg->program->log(); qWarning() << error; - delete cached.program; - cachedPrograms.removeLast(); - return 0; - } else { - // taking the address here is safe since - // cachePrograms isn't resized anywhere else - return &cached; + delete newProg; // Deletes the QGLShaderProgram in it's destructor + newProg = 0; } -} + else { + if (cachedPrograms.count() > 30) { + // The cache is full, so delete the last 5 programs in the list. + // These programs will be least used, as a program us bumped to + // the top of the list when it's used. + for (int i = 0; i < 5; ++i) { + delete cachedPrograms.last(); + cachedPrograms.removeLast(); + } + } + cachedPrograms.insert(0, newProg); + } + + return newProg; +} void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage) { // Remove any shader programs which has this as the custom shader src: for (int i = 0; i < cachedPrograms.size(); ++i) { - if (cachedPrograms.at(i).customStageSource == stage->source()) { - delete cachedPrograms.at(i).program; - cachedPrograms.removeAt(i--); + QGLEngineShaderProg *cachedProg = cachedPrograms[i]; + if (cachedProg->customStageSource == stage->source()) { + delete cachedProg; + cachedPrograms.removeAt(i); + i--; } } } - QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) : ctx(context), shaderProgNeedsChanging(true), @@ -487,7 +501,6 @@ bool QGLEngineShaderManager::useCorrectShaderProg() } QGLEngineShaderProg requiredProgram; - requiredProgram.program = 0; bool texCoords = false; diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index fd73b44..59e50d0 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -366,13 +366,22 @@ private: QGLSharedResourceGuard ctxGuard; QGLShaderProgram *blitShaderProg; QGLShaderProgram *simpleShaderProg; - QList cachedPrograms; + QList cachedPrograms; static const char* qShaderSnippets[TotalSnippetCount]; }; -struct QGLEngineShaderProg + +class QGLEngineShaderProg { +public: + QGLEngineShaderProg() : program(0) {} + + ~QGLEngineShaderProg() { + if (program) + delete program; + } + QGLEngineSharedShaders::SnippetName mainVertexShader; QGLEngineSharedShaders::SnippetName positionVertexShader; QGLEngineSharedShaders::SnippetName mainFragShader; -- cgit v0.12 From 1c44377d84976afa10b5ebae7d6ede5f226a2b3e Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 30 Oct 2009 11:55:56 +0100 Subject: Fixed namespacing in qatomic_symbian.h The namespace needs to be there, even if empty, to avoid warnings. Also, the header declaration was moved to avoid nested header declarations. RevBy: hjk --- src/corelib/arch/qatomic_symbian.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h index 5880120..3721aca 100644 --- a/src/corelib/arch/qatomic_symbian.h +++ b/src/corelib/arch/qatomic_symbian.h @@ -42,8 +42,6 @@ #ifndef QATOMIC_SYMBIAN_H #define QATOMIC_SYMBIAN_H -QT_BEGIN_HEADER - #if defined(Q_CC_RVCT) # define QT_NO_ARM_EABI # include @@ -51,6 +49,16 @@ QT_BEGIN_HEADER # include #endif +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +// Empty, but needed to avoid warnings + +QT_END_NAMESPACE + QT_END_HEADER #endif // QATOMIC_SYMBIAN_H -- cgit v0.12 From fab1697ff467e6c9ec02ffe6eccf65a6e779fd6b Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 30 Oct 2009 13:50:04 +0100 Subject: Moved a resource file from the static wrapper app to QtGui. It's more appropriate to have it in QtGui after the framework classes were moved there. This also means that the rsgfix needed earlier is not necessary anymore, since QtGui is not a static library. RevBy: Janne Anttila --- src/gui/s60framework/s60framework.pri | 11 +++++ src/gui/s60framework/s60main.rss | 85 +++++++++++++++++++++++++++++++++++ src/s60main/s60main.pro | 20 --------- src/s60main/s60main.rss | 85 ----------------------------------- 4 files changed, 96 insertions(+), 105 deletions(-) create mode 100644 src/gui/s60framework/s60main.rss delete mode 100644 src/s60main/s60main.rss diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index fea74fe..5884b68 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -1,3 +1,14 @@ +# This block serves the minimalistic resource file for S60 3.1 platforms. +# Note there is no way to ifdef S60 version in mmp file, that is why the resource +# file is always compiled for WINSCW +minimalAppResource31 = \ + "SOURCEPATH s60framework" \ + "START RESOURCE s60main.rss" \ + "HEADER" \ + "TARGETPATH resource\apps" \ + "END" +MMP_RULES += minimalAppResource31 + SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60mainappui.cpp \ s60framework/qs60maindocument.cpp diff --git a/src/gui/s60framework/s60main.rss b/src/gui/s60framework/s60main.rss new file mode 100644 index 0000000..07dc6a1 --- /dev/null +++ b/src/gui/s60framework/s60main.rss @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** 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 Symbian application wrapper 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$ +** +****************************************************************************/ + +// Even S60 application have ENoAppResourceFile and ENonStandardResourceFile +// flags set, the S60 3rd Edition FP1 emulator requires applications to have +// very minimalistic application resource file, otherwise apps refures to start +// This file serves the minimalistic resource file for S60 3.1 platforms. + +// RESOURCE IDENTIFIER +NAME QTMA // 4 letter ID + +// INCLUDES +//#include +#include +#include +#include +#include +#include + +// RESOURCE DEFINITIONS +RESOURCE RSS_SIGNATURE + { + } + +RESOURCE TBUF r_default_document_name + { + buf="QTMA"; + } + +RESOURCE EIK_APP_INFO + { + menubar = r_qt_wrapperapp_menubar; + cba = R_AVKON_SOFTKEYS_EXIT; + } + +RESOURCE MENU_BAR r_qt_wrapperapp_menubar + { + titles = + { + MENU_TITLE { menu_pane = r_qt_wrapperapp_menu; } + }; + } + +RESOURCE MENU_PANE r_qt_wrapperapp_menu + { + } +// End of File diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro index cc3c547..47cf020 100644 --- a/src/s60main/s60main.pro +++ b/src/s60main/s60main.pro @@ -16,16 +16,6 @@ symbian { SOURCES = qts60main.cpp \ qts60main_mcrt0.cpp - # This block serves the minimalistic resource file for S60 3.1 platforms. - # Note there is no way to ifdef S60 version in mmp file, that is why the resource - # file is always compiled for WINSCW - minimalAppResource31 = \ - "START RESOURCE s60main.rss" \ - "HEADER" \ - "TARGETPATH resource\apps" \ - "END" - MMP_RULES += minimalAppResource31 - # s60main needs to be built in ARM mode for GCCE to work. MMP_RULES+="ALWAYS_BUILD_AS_ARM" @@ -36,14 +26,4 @@ symbian { error("$$_FILE_ is intended only for Symbian!") } -symbian-abld: { - # abld build commands generated resources after the static library is built, and - # we have dependency to resource from static lib -> resources need to be generated - # explicitly before library - rsgFix2.commands = "-$(DEL_FILE) $(EPOCROOT)Epoc32\Data\z\resource\apps\s60main.rsc >NUL 2>&1" - rsgFix.commands = "-$(ABLD) resource $(PLATFORM) $(CFG) 2>NUL" - QMAKE_EXTRA_TARGETS += rsgFix rsgFix2 - PRE_TARGETDEPS += rsgFix rsgFix2 -} - include(../qbase.pri) diff --git a/src/s60main/s60main.rss b/src/s60main/s60main.rss deleted file mode 100644 index 07dc6a1..0000000 --- a/src/s60main/s60main.rss +++ /dev/null @@ -1,85 +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 Symbian application wrapper 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$ -** -****************************************************************************/ - -// Even S60 application have ENoAppResourceFile and ENonStandardResourceFile -// flags set, the S60 3rd Edition FP1 emulator requires applications to have -// very minimalistic application resource file, otherwise apps refures to start -// This file serves the minimalistic resource file for S60 3.1 platforms. - -// RESOURCE IDENTIFIER -NAME QTMA // 4 letter ID - -// INCLUDES -//#include -#include -#include -#include -#include -#include - -// RESOURCE DEFINITIONS -RESOURCE RSS_SIGNATURE - { - } - -RESOURCE TBUF r_default_document_name - { - buf="QTMA"; - } - -RESOURCE EIK_APP_INFO - { - menubar = r_qt_wrapperapp_menubar; - cba = R_AVKON_SOFTKEYS_EXIT; - } - -RESOURCE MENU_BAR r_qt_wrapperapp_menubar - { - titles = - { - MENU_TITLE { menu_pane = r_qt_wrapperapp_menu; } - }; - } - -RESOURCE MENU_PANE r_qt_wrapperapp_menu - { - } -// End of File -- cgit v0.12 From 17a254a1b231393ada1f80f29d989ee71ff8fff4 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 30 Oct 2009 14:30:59 +0100 Subject: QTreeView navigation now inverts left and right in RTL Task-number: QTBUG-5007 Reviewed-by: ogoffart --- src/gui/itemviews/qtreeview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 3856293..a3cbc0d 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2113,6 +2113,12 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie if (vi < 0) vi = qMax(0, d->viewIndex(current)); + if (isRightToLeft()) { + if (cursorAction == MoveRight) + cursorAction = MoveLeft; + else if (cursorAction == MoveLeft) + cursorAction = MoveRight; + } switch (cursorAction) { case MoveNext: case MoveDown: -- cgit v0.12 From fad40eb6261ca72cda438c06dccebfc49e8d0a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 30 Oct 2009 14:34:18 +0100 Subject: Fix some test failures in the qgl test on 16 bit servers. These tests are designed to run in 24 or 32 bit mode, and won't work unless they do.. Reviewed-by: Samuel --- tests/auto/qgl/tst_qgl.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index e036e4b..e9f0476 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -118,6 +118,16 @@ public: void setAutoBufferSwap(bool on) { QGLWidget::setAutoBufferSwap(on); } }; +static int appDefaultDepth() +{ + static int depth = 0; + if (depth == 0) { + QPixmap pm(1, 1); + depth = pm.depth(); + } + return depth; +} + // Using INT_MIN and INT_MAX will cause failures on systems // where "int" is 64-bit, so use the explicit values instead. #define TEST_INT_MIN (-2147483647 - 1) @@ -714,6 +724,8 @@ public: void tst_QGL::graphicsViewClipping() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); const int size = 64; UnclippedWidget *widget = new UnclippedWidget; widget->setFixedSize(size, size); @@ -866,6 +878,8 @@ public: void tst_QGL::glWidgetRendering() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); GLWidget w; w.show(); @@ -1089,6 +1103,8 @@ protected: void tst_QGL::glFBOUseInGLWidget() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle); @@ -1116,6 +1132,8 @@ void tst_QGL::glFBOUseInGLWidget() void tst_QGL::glWidgetReparent() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); // Try it as a top-level first: GLWidget *widget = new GLWidget; widget->setGeometry(0, 0, 200, 30); @@ -1582,6 +1600,8 @@ protected: void tst_QGL::replaceClipping() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); ReplaceClippingGLWidget glw; glw.resize(300, 300); glw.show(); @@ -1707,6 +1727,8 @@ protected: void tst_QGL::clipTest() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); ClipTestGLWidget glw; glw.resize(220, 220); glw.show(); -- cgit v0.12 From acb10eefab985a32a619e2a1d590c93659732c00 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Fri, 30 Oct 2009 12:42:23 +0100 Subject: Fix unit test and add autoCancel test for graphicsview --- tests/auto/gestures/tst_gestures.cpp | 98 ++++++++++++++++++++++++++---------- 1 file changed, 72 insertions(+), 26 deletions(-) diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 02c8232..79de823 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -116,7 +116,7 @@ public: return new CustomGesture; } - QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event) + QGestureRecognizer::Result filterEvent(QGesture *state, QObject*o , QEvent *event) { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result = 0; @@ -332,6 +332,7 @@ private slots: void consumeEventHint(); void unregisterRecognizer(); void autoCancelGestures(); + void autoCancelGestures2(); }; tst_Gestures::tst_Gestures() @@ -1295,20 +1296,6 @@ void tst_Gestures::unregisterRecognizer() // a method on QApplication void tst_Gestures::autoCancelGestures() { - class MockRecognizer : public QGestureRecognizer { - public: - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event) - { - Q_UNUSED(gesture); - Q_UNUSED(watched); - if (event->type() == QEvent::MouseButtonPress) - return QGestureRecognizer::GestureTriggered; - if (event->type() == QEvent::MouseButtonRelease) - return QGestureRecognizer::GestureFinished; - return QGestureRecognizer::Ignore; - } - }; - class MockWidget : public GestureWidget { public: MockWidget(const char *name) : GestureWidget(name) { } @@ -1324,14 +1311,18 @@ void tst_Gestures::autoCancelGestures() } }; + const Qt::GestureType secondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + MockWidget parent("parent"); // this one sets the cancel policy to CancelAllInContext parent.resize(300, 100); + parent.setWindowFlags(Qt::X11BypassWindowManagerHint); GestureWidget *child = new GestureWidget("child", &parent); child->setGeometry(10, 10, 100, 80); - Qt::GestureType type = QApplication::registerGestureRecognizer(new MockRecognizer()); - parent.grabGesture(type, Qt::WidgetWithChildrenGesture); - child->grabGesture(type, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + child->grabGesture(secondGesture, Qt::WidgetWithChildrenGesture); + parent.show(); + QTest::qWaitForWindowShown(&parent); /* An event is send to both the child and the parent, when the child gets it a gesture is triggered @@ -1340,18 +1331,73 @@ void tst_Gestures::autoCancelGestures() parent gets it he accepts it and that causes the cancel policy to activate. The cause of that is the gesture for the child is cancelled and send to the child as such. */ - QMouseEvent event(QEvent::MouseButtonPress, QPoint(20,20), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + CustomEvent event; + event.serial = CustomGesture::SerialStartedThreshold; QApplication::sendEvent(child, &event); + QCOMPARE(child->events.all.count(), 2); QCOMPARE(child->events.started.count(), 1); - QCOMPARE(child->events.all.count(), 1); - QCOMPARE(parent.events.all.count(), 0); - child->reset(); - QApplication::sendEvent(&parent, &event); + QCOMPARE(child->events.canceled.count(), 1); QCOMPARE(parent.events.all.count(), 1); - QCOMPARE(parent.events.started.count(), 1); - QCOMPARE(child->events.started.count(), 0); - QCOMPARE(child->events.all.count(), 1); + + // clean up, make the parent gesture finish + event.serial = CustomGesture::SerialFinishedThreshold; + QApplication::sendEvent(child, &event); + QCOMPARE(parent.events.all.count(), 2); +} + +void tst_Gestures::autoCancelGestures2() +{ + class MockItem : public GestureItem { + public: + MockItem(const char *name) : GestureItem(name) { } + + bool event(QEvent *event) { + if (event->type() == QEvent::Gesture) { + QGestureEvent *ge = static_cast(event); + Q_ASSERT(ge->allGestures().count() == 1); // can't use QCOMPARE here... + ge->allGestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); + } + return GestureItem::event(event); + } + }; + + const Qt::GestureType secondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + MockItem *parent = new MockItem("parent"); + GestureItem *child = new GestureItem("child"); + child->setParentItem(parent); + parent->setPos(0, 0); + child->setPos(10, 10); + scene.addItem(parent); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(secondGesture, Qt::WidgetGesture); + parent->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + child->grabGesture(secondGesture, Qt::WidgetWithChildrenGesture); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + CustomEvent event; + event.serial = CustomGesture::SerialStartedThreshold; + event.hasHotSpot = true; + event.hotSpot = mapToGlobal(QPointF(5, 5), child, &view); + // qDebug() << event.hotSpot; + scene.sendEvent(child, &event); + //QEventLoop().exec(); + QCOMPARE(parent->events.all.count(), 1); + QCOMPARE(child->events.started.count(), 1); QCOMPARE(child->events.canceled.count(), 1); + QCOMPARE(child->events.all.count(), 2); + + // clean up, make the parent gesture finish + event.serial = CustomGesture::SerialFinishedThreshold; + scene.sendEvent(child, &event); + QCOMPARE(parent->events.all.count(), 2); } QTEST_MAIN(tst_Gestures) -- cgit v0.12 From da83365fbf7ff393f7dc99d28eda61b902081bb2 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Fri, 30 Oct 2009 12:42:49 +0100 Subject: Make GestureCancelPolicy work for graphicsview Reviewed-By: Denis --- src/gui/graphicsview/qgraphicsscene.cpp | 90 +++++++++++++++++++++++++++++++++ src/gui/graphicsview/qgraphicsscene_p.h | 1 + src/gui/kernel/qgesture.h | 1 + src/gui/kernel/qgesturemanager.cpp | 37 ++++++-------- src/gui/kernel/qgesturemanager_p.h | 2 + 5 files changed, 109 insertions(+), 22 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index c459d21..9279fe3 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5941,6 +5941,13 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) continue; } } + foreach (QGesture *g, startedGestures) { + if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) { + DEBUG() << "lets try to cancel some"; + // find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them + cancelGesturesForChildren(g, event->widget()); + } + } // forget about targets for gestures that have ended foreach (QGesture *g, allGestures) { @@ -5955,6 +5962,89 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) } } +void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidget *viewport) +{ + Q_ASSERT(original); + QGraphicsItem *originalItem = gestureTargets.value(original); + Q_ASSERT(originalItem); + + // iterate over all active gestures and for each find the owner + // if the owner is part of our sub-hierarchy, cancel it. + + QSet canceledGestures; + QHash::Iterator iter = gestureTargets.begin(); + while (iter != gestureTargets.end()) { + QGraphicsObject *item = iter.value(); + // note that we don't touch the gestures for our originalItem + if (item != originalItem && originalItem->isAncestorOf(item)) { + DEBUG() << " found a gesture to cancel" << iter.key(); + iter.key()->d_func()->state = Qt::GestureCanceled; + canceledGestures << iter.key(); + } + ++iter; + } + + // sort them per target item by cherry picking from almostCanceledGestures and delivering + QSet almostCanceledGestures = canceledGestures; + QSet::Iterator setIter; + while (!almostCanceledGestures.isEmpty()) { + QGraphicsObject *target = 0; + QSet gestures; + setIter = almostCanceledGestures.begin(); + // sort per target item + while (setIter != almostCanceledGestures.end()) { + QGraphicsObject *item = gestureTargets.value(*setIter); + if (target == 0) + target = item; + if (target == item) { + gestures << *setIter; + setIter = almostCanceledGestures.erase(setIter); + } else { + ++setIter; + } + } + Q_ASSERT(target); + + QList list = gestures.toList(); + QGestureEvent ev(list); + sendEvent(target, &ev); + + foreach (QGesture *g, list) { + if (ev.isAccepted() || ev.isAccepted(g)) + gestures.remove(g); + } + + foreach (QGesture *g, gestures) { + if (!g->hasHotSpot()) + continue; + + QPoint screenPos = g->hotSpot().toPoint(); + QList items = itemsAtPosition(screenPos, QPointF(), viewport); + for (int j = 0; j < items.size(); ++j) { + QGraphicsObject *item = items.at(j)->toGraphicsObject(); + if (!item) + continue; + QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); + if (d->gestureContext.contains(g->gestureType())) { + QList list; + list << g; + QGestureEvent ev(list); + sendEvent(item, &ev); + if (ev.isAccepted() || ev.isAccepted(g)) + break; // successfully delivered + } + } + } + } + + QGestureManager *gm = QApplicationPrivate::instance()->gestureManager; + Q_ASSERT(gm); // it would be very odd if we got called without a manager. + for (setIter = canceledGestures.begin(); setIter != canceledGestures.end(); ++setIter) { + gm->recycle(*setIter); + gestureTargets.remove(*setIter); + } +} + QT_END_NAMESPACE #include "moc_qgraphicsscene.cpp" diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index cd20fd0..f8db084 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -288,6 +288,7 @@ public: QMap *conflictedGestures, QList > *conflictedItems, QHash *normalGestures); + void cancelGesturesForChildren(QGesture *original, QWidget *viewport); void updateInputMethodSensitivityInViews(); diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 524d26e..8614ecb 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -97,6 +97,7 @@ private: friend class QGestureEvent; friend class QGestureRecognizer; friend class QGestureManager; + friend class QGraphicsScenePrivate; }; class QPanGesturePrivate; diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index f1abc89..1d33c84 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -346,12 +346,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash endedGestures = finishedGestures + canceledGestures + undeliveredGestures; foreach (QGesture *gesture, endedGestures) { - if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0)) { - gesture->setGestureCancelPolicy(QGesture::CancelNone); - recognizer->reset(gesture); - } else { - cleanupGesturesForRemovedRecognizer(gesture); - } + recycle(gesture); m_gestureTargets.remove(gesture); } return ret; @@ -409,15 +404,8 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original) deliverEvents(gestures, &undeliveredGestures); } - for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter) { - QGestureRecognizer *recognizer = m_gestureToRecognizer.value(*iter, 0); - if (recognizer) { - (*iter)->setGestureCancelPolicy(QGesture::CancelNone); - recognizer->reset(*iter); - } else { - cleanupGesturesForRemovedRecognizer(*iter); - } - } + for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter) + recycle(*iter); } void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture) @@ -667,19 +655,24 @@ void QGestureManager::timerEvent(QTimerEvent *event) it = m_maybeGestures.erase(it); DEBUG() << "QGestureManager::timerEvent: gesture stopped due to timeout:" << gesture; - QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0); - if (recognizer) { - gesture->setGestureCancelPolicy(QGesture::CancelNone); - recognizer->reset(gesture); - } else { - cleanupGesturesForRemovedRecognizer(gesture); - } + recycle(gesture); } else { ++it; } } } +void QGestureManager::recycle(QGesture *gesture) +{ + QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0); + if (recognizer) { + gesture->setGestureCancelPolicy(QGesture::CancelNone); + recognizer->reset(gesture); + } else { + cleanupGesturesForRemovedRecognizer(gesture); + } +} + QT_END_NAMESPACE #include "moc_qgesturemanager_p.cpp" diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index 4958cdb..d60aedc 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -81,6 +81,8 @@ public: void cleanupCachedGestures(QObject *target, Qt::GestureType type); + void recycle(QGesture *gesture); + protected: void timerEvent(QTimerEvent *event); bool filterEventThroughContexts(const QMultiHash &contexts, -- cgit v0.12 From 6584d601f9569ce7bfc704cb604472d324dfd253 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 30 Oct 2009 14:48:24 +0100 Subject: One signal/slot connection is enough, when exporting N signals to DBus When exporting an object to DBus, and the object has N signals, this code was connecting the QDBusConnectionPrivate multiple times to the destroyed signal of the object. Merge-request: 1961 Reviewed-by: Olivier Goffart --- src/dbus/qdbusintegrator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index fb2dd77..686b56f 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1937,7 +1937,7 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook { signalHooks.insertMulti(key, hook); connect(hook.obj, SIGNAL(destroyed(QObject*)), SLOT(objectDestroyed(QObject*)), - Qt::DirectConnection); + Qt::ConnectionType(Qt::DirectConnection | Qt::UniqueConnection)); MatchRefCountHash::iterator it = matchRefCounts.find(hook.matchRule); -- cgit v0.12 From 157e218d90ba832b2846889e9f7c94c95ed2cfbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 30 Oct 2009 14:18:43 +0100 Subject: Fix issue with wrong QMessagebox icons on Mac. Task: QTBUG-4988 68c0e6a8ba1e92bf0152adcaa86eebb83dcfd1d8 introduced a regression preventing the mac-spesific standardIcon code form being called. Call the Mac code if desktopSettingsAware is set. (QIcon::themeName() is only set on X11) --- src/gui/styles/qcommonstyle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 70d130a..1564a3f 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5657,10 +5657,11 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons default: break; } - + } // if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) if (!icon.isNull()) return icon; #if defined(Q_WS_MAC) + if (QApplication::desktopSettingsAware()) { OSType iconType = 0; switch (standardIcon) { case QStyle::SP_MessageBoxQuestion: @@ -5751,8 +5752,8 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons ReleaseIconRef(overlayIcon); return retIcon; } + } // if (QApplication::desktopSettingsAware()) #endif // Q_WS_MAC - } switch (standardIcon) { #ifndef QT_NO_IMAGEFORMAT_PNG -- cgit v0.12 From 5cca60ad593cc5b8778d7be0b8137ffecd34b247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 30 Oct 2009 14:22:06 +0100 Subject: Fix indentation. --- src/gui/styles/qcommonstyle.cpp | 178 ++++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 1564a3f..84e046f 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5662,96 +5662,96 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons return icon; #if defined(Q_WS_MAC) if (QApplication::desktopSettingsAware()) { - OSType iconType = 0; - switch (standardIcon) { - case QStyle::SP_MessageBoxQuestion: - case QStyle::SP_MessageBoxInformation: - case QStyle::SP_MessageBoxWarning: - case QStyle::SP_MessageBoxCritical: - iconType = kGenericApplicationIcon; - break; - case SP_DesktopIcon: - iconType = kDesktopIcon; - break; - case SP_TrashIcon: - iconType = kTrashIcon; - break; - case SP_ComputerIcon: - iconType = kComputerIcon; - break; - case SP_DriveFDIcon: - iconType = kGenericFloppyIcon; - break; - case SP_DriveHDIcon: - iconType = kGenericHardDiskIcon; - break; - case SP_DriveCDIcon: - case SP_DriveDVDIcon: - iconType = kGenericCDROMIcon; - break; - case SP_DriveNetIcon: - iconType = kGenericNetworkIcon; - break; - case SP_DirOpenIcon: - iconType = kOpenFolderIcon; - break; - case SP_DirClosedIcon: - case SP_DirLinkIcon: - iconType = kGenericFolderIcon; - break; - case SP_FileLinkIcon: - case SP_FileIcon: - iconType = kGenericDocumentIcon; - break; - case SP_DirIcon: { - // A rather special case - QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget); - QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget); - closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On); - closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On); - closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On); - closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On); - return closeIcon; - } - case SP_TitleBarNormalButton: - case SP_TitleBarCloseButton: { - QIcon titleBarIcon; - if (standardIcon == SP_TitleBarCloseButton) { - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png")); - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); - } else { - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png")); - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); + OSType iconType = 0; + switch (standardIcon) { + case QStyle::SP_MessageBoxQuestion: + case QStyle::SP_MessageBoxInformation: + case QStyle::SP_MessageBoxWarning: + case QStyle::SP_MessageBoxCritical: + iconType = kGenericApplicationIcon; + break; + case SP_DesktopIcon: + iconType = kDesktopIcon; + break; + case SP_TrashIcon: + iconType = kTrashIcon; + break; + case SP_ComputerIcon: + iconType = kComputerIcon; + break; + case SP_DriveFDIcon: + iconType = kGenericFloppyIcon; + break; + case SP_DriveHDIcon: + iconType = kGenericHardDiskIcon; + break; + case SP_DriveCDIcon: + case SP_DriveDVDIcon: + iconType = kGenericCDROMIcon; + break; + case SP_DriveNetIcon: + iconType = kGenericNetworkIcon; + break; + case SP_DirOpenIcon: + iconType = kOpenFolderIcon; + break; + case SP_DirClosedIcon: + case SP_DirLinkIcon: + iconType = kGenericFolderIcon; + break; + case SP_FileLinkIcon: + case SP_FileIcon: + iconType = kGenericDocumentIcon; + break; + case SP_DirIcon: { + // A rather special case + QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget); + QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget); + closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On); + closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On); + closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On); + closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On); + return closeIcon; + } + case SP_TitleBarNormalButton: + case SP_TitleBarCloseButton: { + QIcon titleBarIcon; + if (standardIcon == SP_TitleBarCloseButton) { + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png")); + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); + } else { + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png")); + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); + } + return titleBarIcon; + } + default: + break; + } + if (iconType != 0) { + QIcon retIcon; + IconRef icon; + IconRef overlayIcon = 0; + if (iconType != kGenericApplicationIcon) { + GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon); + } else { + FSRef fsRef; + ProcessSerialNumber psn = { 0, kCurrentProcess }; + GetProcessBundleLocation(&psn, &fsRef); + GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0); + if (standardIcon == SP_MessageBoxCritical) { + overlayIcon = icon; + GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon); + } + } + if (icon) { + qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon); + ReleaseIconRef(icon); + } + if (overlayIcon) + ReleaseIconRef(overlayIcon); + return retIcon; } - return titleBarIcon; - } - default: - break; - } - if (iconType != 0) { - QIcon retIcon; - IconRef icon; - IconRef overlayIcon = 0; - if (iconType != kGenericApplicationIcon) { - GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon); - } else { - FSRef fsRef; - ProcessSerialNumber psn = { 0, kCurrentProcess }; - GetProcessBundleLocation(&psn, &fsRef); - GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0); - if (standardIcon == SP_MessageBoxCritical) { - overlayIcon = icon; - GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon); - } - } - if (icon) { - qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon); - ReleaseIconRef(icon); - } - if (overlayIcon) - ReleaseIconRef(overlayIcon); - return retIcon; - } } // if (QApplication::desktopSettingsAware()) #endif // Q_WS_MAC -- cgit v0.12 From 4510c18ed3ffd2c01d11159fc2d2ec7f0eb48e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 30 Oct 2009 14:49:05 +0100 Subject: Fix QDesktopServices::DataLocation on Mac. DataLocation now behaves as on the other platforms, QCoreApplication::organizationName() and applicationName() is included in the returned path. --- dist/changes-4.6.0 | 4 ++++ src/gui/util/qdesktopservices.cpp | 9 --------- src/gui/util/qdesktopservices_mac.cpp | 9 ++++++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 7f723da..abe4427 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -143,3 +143,7 @@ information about a particular change. function setFloatingPointPrecision(). Set Qt_4_5 as the version of the QDataStream to get the behavior of previous versions. + - On Mac OS X, QDesktopServices::storageLocation(DataLocation) now includes + QCoreApplication::organizationName() and QCoreApplication::applicationName() + if those are set. This matches the behavior on the other platforms. + \ No newline at end of file diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 1690d87..85b539f 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -294,15 +294,6 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) Rest of the standard locations point to folder on same drive with executable, except that if executable is in ROM the folder from C drive is returned. - \note On Mac OS X, DataLocation does not include QCoreApplication::organizationName. - Use code like this to add it: - - \code - QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - #ifdef Q_WS_MAC - location.insert(location.count() - QCoreApplication::applicationName().count(), - QCoreApplication::organizationName() + "/"); - #endif \endcode */ diff --git a/src/gui/util/qdesktopservices_mac.cpp b/src/gui/util/qdesktopservices_mac.cpp index 0626e0a..23f9e60 100644 --- a/src/gui/util/qdesktopservices_mac.cpp +++ b/src/gui/util/qdesktopservices_mac.cpp @@ -153,9 +153,12 @@ QString QDesktopServices::storageLocation(StandardLocation type) QString path = getFullPath(ref); - QString appName = QCoreApplication::applicationName(); - if (!appName.isEmpty() && (type == DataLocation || type == CacheLocation)) - path += QLatin1Char('/') + appName; + if (type == DataLocation || type == CacheLocation) { + if (QCoreApplication::organizationName().isEmpty() == false) + path += QLatin1Char('/') + QCoreApplication::organizationName(); + if (QCoreApplication::applicationName().isEmpty() == false) + path += QLatin1Char('/') + QCoreApplication::applicationName(); + } return path; } -- cgit v0.12 From 4f10520a2a931ed0cccba3d36d9c196902049282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Fri, 30 Oct 2009 15:53:28 +0200 Subject: S60Style: User set header view palettes are ignored QS60Style ignores user defined palettes for QHeaderViews. With this fix, style takes palette changes into account and also draws QTableCornerButton correctly. Task-number: QTBUG-4522 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index dc38397..10a63a8 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1752,7 +1752,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, #endif //QT_NO_MENUBAR case CE_HeaderSection: - if ( const QStyleOptionHeader *header = qstyleoption_cast(option)) { + if (const QStyleOptionHeader *header = qstyleoption_cast(option)) { painter->save(); QPen linePen = QPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 1, header)); const int penWidth = (header->orientation == Qt::Horizontal) ? @@ -1770,6 +1770,25 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } } painter->restore(); + + //Draw corner button as normal pushButton. + if (qobject_cast(widget)) { + //Make cornerButton slightly smaller so that it is not on top of table border graphic. + QStyleOptionHeader subopt = *header; + const int borderTweak = + QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1; + if (subopt.direction == Qt::LeftToRight) + subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak); + else + subopt.rect.adjust(0, borderTweak, -borderTweak, -borderTweak); + drawPrimitive(PE_PanelButtonBevel, &subopt, painter, widget); + } else if ((header->palette.brush(QPalette::Button) != Qt::transparent)) { + //Draw non-themed background. Background for theme is drawn in CE_ShapedFrame + //to get continuous theme graphic across all the header cells. + qDrawShadePanel(painter, header->rect, header->palette, + header->state & (State_Sunken | State_On), penWidth, + &header->palette.brush(QPalette::Button)); + } } break; case CE_HeaderEmptyArea: // no need to draw this @@ -1840,15 +1859,24 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else if (qobject_cast(widget)) { QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableItem, painter, option->rect, flags); } else if (const QHeaderView *header = qobject_cast(widget)) { - if (header->orientation() == Qt::Horizontal) { - QRect headerRect = option->rect; - const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); - headerRect.adjust(0,frameWidth,-2*frameWidth,0); - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, flags); - } else { + //QS60style draws header background here instead of in each headersection, to get + //continuous graphic from section to section. + QS60StylePrivate::SkinElementFlags adjustableFlags = flags; + QRect headerRect = option->rect; + if (header->orientation() != Qt::Horizontal) { //todo: update to horizontal table graphic - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, option->rect, flags | QS60StylePrivate::SF_PointWest); + adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest); + } else { + const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + if (option->direction == Qt::LeftToRight) + headerRect.adjust(-2*frameWidth, 0, 0, 0); + else + headerRect.adjust(0, 0, 2*frameWidth, 0); } + if (option->palette.brush(QPalette::Button).color() == Qt::transparent) + QS60StylePrivate::drawSkinElement( + QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, adjustableFlags); + } else if (qobject_cast(widget)) { QCommonStyle::drawControl(element, option, painter, widget); } -- cgit v0.12 From a3dbe4c00062ad78c924162841cc2d83709b1ea4 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 30 Oct 2009 15:07:47 +0100 Subject: Animations in mainwindow could sometimes misplace the tabbar We used to not start an animation of the current geometry was already set. The problem is that starting this animation might stop another animation. This has to happen. Otherwise subsequent calls to animate a widget might or might not be executed. Reviewed-by: ogoffart --- src/gui/widgets/qwidgetanimator.cpp | 7 ------- src/gui/widgets/qwidgetanimator_p.h | 1 - 2 files changed, 8 deletions(-) diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp index f440961..4a7ae00 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/gui/widgets/qwidgetanimator.cpp @@ -88,8 +88,6 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry : QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size()); - if (r == final_geometry) - return; //the widget is already where it should be #ifndef QT_NO_ANIMATION AnimationMap::const_iterator it = m_animation_map.constFind(widget); if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry) @@ -114,9 +112,4 @@ bool QWidgetAnimator::animating() const return !m_animation_map.isEmpty(); } -bool QWidgetAnimator::animating(QWidget *widget) const -{ - return m_animation_map.contains(widget); -} - QT_END_NAMESPACE diff --git a/src/gui/widgets/qwidgetanimator_p.h b/src/gui/widgets/qwidgetanimator_p.h index 68d9344..095380f 100644 --- a/src/gui/widgets/qwidgetanimator_p.h +++ b/src/gui/widgets/qwidgetanimator_p.h @@ -70,7 +70,6 @@ public: QWidgetAnimator(QMainWindowLayout *layout); void animate(QWidget *widget, const QRect &final_geometry, bool animate); bool animating() const; - bool animating(QWidget *widget) const; void abort(QWidget *widget); -- cgit v0.12 From 8910b449dafcb3475ab8c6f90213cd632412da68 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 30 Oct 2009 16:08:46 +0200 Subject: Fixed statuspane visibility after dialog closed from fullsreen widget. - Comparing TBool == bool did not work correctly since TBool is effectively int. For example statusPane->IsVisible() in this particular case returns 2, which compared to true as an int fails. Casting to bool seems to solve the problem. Another possibility would be to use Symbian COMPARE_BOOLS macro. - Changing statuspane visibility now affects to widget size also - Some tab/space fixes Task-number: QTBUG-4876 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_s60.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 30bf99a..e5ee2f1 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -836,7 +836,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const if (qwidget->d_func()->isOpaque) gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect); - } + } } else { surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint()); } @@ -910,9 +910,9 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) CEikStatusPane* statusPane = S60->statusPane(); CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; - if (statusPane && (statusPane->IsVisible() == isFullscreen)) + if (statusPane && (bool)statusPane->IsVisible() == isFullscreen) statusPane->MakeVisible(!isFullscreen); - if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen)) + if (buttonGroup && (bool)buttonGroup->IsVisible() == isFullscreen) buttonGroup->MakeVisible(!isFullscreen); #endif } else if (QApplication::activeWindow() == qwidget->window()) { @@ -925,6 +925,12 @@ void QSymbianControl::HandleResourceChange(int resourceType) { switch (resourceType) { case KInternalStatusPaneChange: + if (qwidget->isFullScreen()) { + SetExtentToWholeScreen(); + } else if (qwidget->isMaximized()) { + TRect r = static_cast(S60->appUi())->ClientRect(); + SetExtent(r.iTl, r.Size()); + } qwidget->d_func()->setWindowIcon_sys(true); break; case KUidValueCoeFontChangeEvent: @@ -1080,9 +1086,9 @@ void qt_init(QApplicationPrivate * /* priv */, int) // enable focus events - used to re-enable mouse after focus changed between mouse and non mouse app, // and for dimming behind modal windows - S60->windowGroup().EnableFocusChangeEvents(); + S60->windowGroup().EnableFocusChangeEvents(); - //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this) + //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this) const TInt KMachineUidSamsungI8510 = 0x2000C51E; // HAL::Get(HALData::EPen, TInt& result) may set 'result' to 1 on some 3.1 systems (e.g. N95). // But we know that S60 systems below 5.0 did not support touch. @@ -1560,7 +1566,7 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event) } #endif break; - default: + default: break; } -- cgit v0.12 From 0e02c54e7e56ee091aeeb6342faa2df163fbbd74 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 07:51:09 +1000 Subject: Remove partial shader support from QGLShader/QGLShaderProgram Reviewed-by: trustme --- src/opengl/qglshaderprogram.cpp | 182 ++-------------------------------------- src/opengl/qglshaderprogram.h | 9 +- 2 files changed, 6 insertions(+), 185 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 90b496e..080c3b2 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -106,30 +106,6 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 2 - \section1 Partial shaders - - Desktop GLSL can attach an arbitrary number of vertex and fragment - shaders to a shader program. Embedded GLSL/ES on the other hand - supports only a single shader of each type on a shader program. - - Multiple shaders of the same type can be useful when large libraries - of shaders are needed. Common functions can be factored out into - library shaders that can be reused in multiple shader programs. - - To support this use of shaders, the application programmer can - create shaders with the QGLShader::PartialVertexShader and - QGLShader::PartialFragmentShader types. These types direct - QGLShader and QGLShaderProgram to delay shader compilation until - link time. - - When link() is called, the sources for the partial shaders are - concatenated, and a single vertex or fragment shader is compiled - and linked into the shader program. - - It is more efficient to use the QGLShader::VertexShader and - QGLShader::FragmentShader when there is only one shader of that - type in the program. - \sa QGLShader */ @@ -154,11 +130,6 @@ QT_BEGIN_NAMESPACE \value VertexShader Vertex shader written in the OpenGL Shading Language (GLSL). \value FragmentShader Fragment shader written in the OpenGL Shading Language (GLSL). - - \value PartialVertexShader Partial vertex shader that will be concatenated with all other partial vertex shaders at link time. - \value PartialFragmentShader Partial fragment shader that will be concatenated with all other partial fragment shaders at link time. - - \omitvalue PartialShader */ #ifndef GL_FRAGMENT_SHADER @@ -209,8 +180,6 @@ public: : shaderGuard(context) , shaderType(type) , compiled(false) - , isPartial((type & QGLShader::PartialShader) != 0) - , hasPartialSource(false) { } ~QGLShaderPrivate(); @@ -218,10 +187,7 @@ public: QGLSharedResourceGuard shaderGuard; QGLShader::ShaderType shaderType; bool compiled; - bool isPartial; - bool hasPartialSource; QString log; - QByteArray partialSource; bool create(); bool compile(QGLShader *q); @@ -243,8 +209,6 @@ bool QGLShaderPrivate::create() const QGLContext *context = shaderGuard.context(); if (!context) return false; - if (isPartial) - return true; if (qt_resolve_glsl_extensions(const_cast(context))) { GLuint shader; if (shaderType == QGLShader::VertexShader) @@ -264,11 +228,6 @@ bool QGLShaderPrivate::create() bool QGLShaderPrivate::compile(QGLShader *q) { - // Partial shaders are compiled during QGLShaderProgram::link(). - if (isPartial && hasPartialSource) { - compiled = true; - return true; - } GLuint shader = shaderGuard.id(); if (!shader) return false; @@ -441,21 +400,12 @@ static const char redefineHighp[] = Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compileFile() */ bool QGLShader::compile(const char *source) { Q_D(QGLShader); - if (d->isPartial) { - d->partialSource = QByteArray(source); - d->hasPartialSource = true; - return d->compile(this); - } else if (d->shaderGuard.id()) { + if (d->shaderGuard.id()) { QVarLengthArray src; QVarLengthArray srclen; int headerLen = 0; @@ -481,8 +431,7 @@ bool QGLShader::compile(const char *source) srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP - if (d->shaderType == FragmentShader || - d->shaderType == PartialFragmentShader) { + if (d->shaderType == FragmentShader) { src.append(redefineHighp); srclen.append(GLint(sizeof(redefineHighp) - 1)); } @@ -497,71 +446,11 @@ bool QGLShader::compile(const char *source) } /*! - \internal -*/ -bool QGLShader::compile - (const QList& shaders, QGLShader::ShaderType type) -{ - Q_D(QGLShader); - QVarLengthArray src; - QVarLengthArray srclen; - if (!d->shaderGuard.id()) - return false; - foreach (QGLShader *shader, shaders) { - if (shader->shaderType() != type) - continue; - const char *source = shader->d_func()->partialSource.constData(); - int headerLen = 0; - if (src.isEmpty()) { - // First shader: handle the #version and #extension tags - // plus the precision qualifiers. - while (source && source[headerLen] == '#') { - // Skip #version and #extension directives at the start of - // the shader code. We need to insert the qualifierDefines - // and redefineHighp just after them. - if (qstrncmp(source + headerLen, "#version", 8) != 0 && - qstrncmp(source + headerLen, "#extension", 10) != 0) { - break; - } - while (source[headerLen] != '\0' && source[headerLen] != '\n') - ++headerLen; - if (source[headerLen] == '\n') - ++headerLen; - } - if (headerLen > 0) { - src.append(source); - srclen.append(GLint(headerLen)); - } -#ifdef QGL_DEFINE_QUALIFIERS - src.append(qualifierDefines); - srclen.append(GLint(sizeof(qualifierDefines) - 1)); -#endif -#ifdef QGL_REDEFINE_HIGHP - if (d->shaderType == FragmentShader || - d->shaderType == PartialFragmentShader) { - src.append(redefineHighp); - srclen.append(GLint(sizeof(redefineHighp) - 1)); - } -#endif - } - src.append(source + headerLen); - srclen.append(GLint(qstrlen(source + headerLen))); - } - glShaderSource(d->shaderGuard.id(), src.size(), src.data(), srclen.data()); - return d->compile(this); -} - -/*! \overload Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compileFile() */ bool QGLShader::compile(const QByteArray& source) @@ -575,11 +464,6 @@ bool QGLShader::compile(const QByteArray& source) Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compileFile() */ bool QGLShader::compile(const QString& source) @@ -592,11 +476,6 @@ bool QGLShader::compile(const QString& source) and compiles it. Returns true if the file could be opened and the source compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compile() */ bool QGLShader::compileFile(const QString& fileName) @@ -619,8 +498,6 @@ bool QGLShader::compileFile(const QString& fileName) QByteArray QGLShader::sourceCode() const { Q_D(const QGLShader); - if (d->isPartial) - return d->partialSource; GLuint shader = d->shaderGuard.id(); if (!shader) return QByteArray(); @@ -661,10 +538,6 @@ QString QGLShader::log() const /*! Returns the OpenGL identifier associated with this shader. - If shaderType() is PartialVertexShader or PartialFragmentShader, - this function will always return zero. Partial shaders are - created and compiled when QGLShaderProgram::link() is called. - \sa QGLShaderProgram::programId() */ GLuint QGLShader::shaderId() const @@ -684,7 +557,6 @@ public: : programGuard(context) , linked(false) , inited(false) - , hasPartialShaders(false) , removingShaders(false) , vertexShader(0) , fragmentShader(0) @@ -695,7 +567,6 @@ public: QGLSharedResourceGuard programGuard; bool linked; bool inited; - bool hasPartialShaders; bool removingShaders; QString log; QList shaders; @@ -812,13 +683,9 @@ bool QGLShaderProgram::addShader(QGLShader *shader) } if (!shader->d_func()->compiled) return false; - if (!shader->d_func()->isPartial) { - if (!shader->d_func()->shaderGuard.id()) - return false; - glAttachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); - } else { - d->hasPartialShaders = true; - } + if (!shader->d_func()->shaderGuard.id()) + return false; + glAttachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); d->linked = false; // Program needs to be relinked. d->shaders.append(shader); connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); @@ -999,45 +866,6 @@ bool QGLShaderProgram::link() GLuint program = d->programGuard.id(); if (!program) return false; - if (d->hasPartialShaders) { - // Compile the partial vertex and fragment shaders. - if (d->hasShader(QGLShader::PartialVertexShader)) { - if (!d->vertexShader) { - d->vertexShader = - new QGLShader(QGLShader::VertexShader, this); - } - if (!d->vertexShader->compile - (d->shaders, QGLShader::PartialVertexShader)) { - d->log = d->vertexShader->log(); - return false; - } - glAttachShader(program, d->vertexShader->d_func()->shaderGuard.id()); - } else { - if (d->vertexShader) { - glDetachShader(program, d->vertexShader->d_func()->shaderGuard.id()); - delete d->vertexShader; - d->vertexShader = 0; - } - } - if (d->hasShader(QGLShader::PartialFragmentShader)) { - if (!d->fragmentShader) { - d->fragmentShader = - new QGLShader(QGLShader::FragmentShader, this); - } - if (!d->fragmentShader->compile - (d->shaders, QGLShader::PartialFragmentShader)) { - d->log = d->fragmentShader->log(); - return false; - } - glAttachShader(program, d->fragmentShader->d_func()->shaderGuard.id()); - } else { - if (d->fragmentShader) { - glDetachShader(program, d->fragmentShader->d_func()->shaderGuard.id()); - delete d->fragmentShader; - d->fragmentShader = 0; - } - } - } glLinkProgram(program); GLint value = 0; glGetProgramiv(program, GL_LINK_STATUS, &value); diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index 708cf09..b7bd2d7 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -66,12 +66,7 @@ public: enum ShaderTypeBits { VertexShader = 0x0001, - FragmentShader = 0x0002, - - PartialShader = 0x1000, - - PartialVertexShader = PartialShader | VertexShader, - PartialFragmentShader = PartialShader | FragmentShader + FragmentShader = 0x0002 }; Q_DECLARE_FLAGS(ShaderType, ShaderTypeBits) @@ -100,8 +95,6 @@ private: Q_DISABLE_COPY(QGLShader) Q_DECLARE_PRIVATE(QGLShader) - - bool compile(const QList& shaders, QGLShader::ShaderType type); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGLShader::ShaderType) -- cgit v0.12 From acde9118f87ebd5aba5904072e40997a2a155d13 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 09:09:06 +1000 Subject: Make screen rotation work properly with the PowerVR screen driver Task-number: QT-2261 Reviewed-by: Tom Back port of 75719e4e06882825fe056935d782b4153bf0ac5b --- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c | 10 ++++ .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h | 3 + .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h | 1 + .../gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c | 14 ++++- src/plugins/gfxdrivers/powervr/README | 5 ++ .../powervr/pvreglscreen/pvreglscreen.cpp | 67 +++++++++++++++++++++- .../gfxdrivers/powervr/pvreglscreen/pvreglscreen.h | 9 ++- .../powervr/pvreglscreen/pvreglwindowsurface.cpp | 54 ++++++++++++++++- .../powervr/pvreglscreen/pvreglwindowsurface.h | 8 ++- 9 files changed, 162 insertions(+), 9 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index ac9dc8d..c1b655a 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -617,6 +617,16 @@ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect) *rect = drawable->rect; } +void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle) +{ + if (drawable->rotationAngle != angle) { + drawable->rotationAngle = angle; + + /* Force the buffers to be recreated if the rotation angle changes */ + pvrQwsInvalidateBuffers(drawable); + } +} + int pvrQwsGetStride(PvrQwsDrawable *drawable) { if (drawable->backBuffersValid) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h index 952ff6f..b9e035f 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h @@ -126,6 +126,9 @@ void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect); /* Get the current geometry for a drawable */ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect); +/* Set the rotation angle in degrees */ +void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle); + /* Get the line stride for a drawable. Returns zero if the buffers are not allocated or have been invalidated */ int pvrQwsGetStride(PvrQwsDrawable *drawable); diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h index cf80a90..dcd4e4f 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h @@ -114,6 +114,7 @@ struct _PvrQwsDrawable int isFullScreen; int strideBytes; int stridePixels; + int rotationAngle; PvrQwsSwapFunction swapFunction; void *userData; PvrQwsDrawable *nextWinId; diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c index 253f39f..28b2251 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c @@ -132,6 +132,16 @@ static WSEGLError wseglCloseDisplay(WSEGLDisplayHandle display) return WSEGL_SUCCESS; } +static WSEGLRotationAngle wseglRotationValue(int degrees) +{ + switch (degrees) { + case 90: return WSEGL_ROTATE_90; + case 180: return WSEGL_ROTATE_180; + case 270: return WSEGL_ROTATE_270; + default: return WSEGL_ROTATE_0; + } +} + /* Create the WSEGL drawable version of a native window */ static WSEGLError wseglCreateWindowDrawable (WSEGLDisplayHandle display, WSEGLConfig *config, @@ -152,7 +162,7 @@ static WSEGLError wseglCreateWindowDrawable *drawable = (WSEGLDrawableHandle)screen; if (!pvrQwsAllocBuffers(screen)) return WSEGL_OUT_OF_MEMORY; - *rotationAngle = WSEGL_ROTATE_0; + *rotationAngle = wseglRotationValue(screen->rotationAngle); return WSEGL_SUCCESS; } @@ -163,7 +173,7 @@ static WSEGLError wseglCreateWindowDrawable /* The drawable is ready to go */ *drawable = (WSEGLDrawableHandle)draw; - *rotationAngle = WSEGL_ROTATE_0; + *rotationAngle = wseglRotationValue(draw->rotationAngle); if (!pvrQwsAllocBuffers(draw)) return WSEGL_OUT_OF_MEMORY; return WSEGL_SUCCESS; diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README index 4dce87f..322a6b2 100644 --- a/src/plugins/gfxdrivers/powervr/README +++ b/src/plugins/gfxdrivers/powervr/README @@ -51,6 +51,11 @@ on the device with: hellogl_es -qws +The driver also supports screen rotation if Qt is configured with the +-qt-gfx-transformed option and the QWS_DISPLAY variable is wrapped in a +"Transformed" declaration: + + Transformed:powervr:mmWidth40:mmHeight54:Rot90:0 Know Issues: * A QGLWidget may not have window decorations if it is a top-level window. diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index 6696672..2e4c6d1 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -44,6 +44,9 @@ #include "pvrqwsdrawable_p.h" #include #include +#ifndef QT_NO_QWS_TRANSFORMED +#include +#endif #include #include #include @@ -60,6 +63,7 @@ PvrEglScreen::PvrEglScreen(int displayId) ttyfd = -1; doGraphicsMode = true; oldKdMode = KD_TEXT; + parent = 0; // Make sure that the EGL layer is initialized and the drivers loaded. EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); @@ -189,7 +193,7 @@ bool PvrEglScreen::hasOpenGL() QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const { if (qobject_cast(widget)) - return new PvrEglWindowSurface(widget, (QScreen *)this, displayId); + return new PvrEglWindowSurface(widget, (PvrEglScreen *)this, displayId); return QScreen::createSurface(widget); } @@ -202,6 +206,67 @@ QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const return QScreen::createSurface(key); } +#ifndef QT_NO_QWS_TRANSFORMED + +static const QScreen *parentScreen + (const QScreen *current, const QScreen *lookingFor) +{ + if (!current) + return 0; + switch (current->classId()) { + case QScreen::ProxyClass: + case QScreen::TransformedClass: { + const QScreen *child = + static_cast(current)->screen(); + if (child == lookingFor) + return current; + else + return parentScreen(child, lookingFor); + } + // Not reached. + + case QScreen::MultiClass: { + QList screens = current->subScreens(); + foreach (QScreen *screen, screens) { + if (screen == lookingFor) + return current; + const QScreen *parent = parentScreen(screen, lookingFor); + if (parent) + return parent; + } + } + break; + + default: break; + } + return 0; +} + +int PvrEglScreen::transformation() const +{ + // We need to search for our parent screen, which is assumed to be + // "Transformed". If it isn't, then there is no transformation. + // There is no direct method to get the parent screen so we need + // to search every screen until we find ourselves. + if (!parent && qt_screen != this) + parent = parentScreen(qt_screen, this); + if (!parent) + return 0; + if (parent->classId() != QScreen::TransformedClass) + return 0; + return 90 * static_cast(parent) + ->transformation(); +} + +#else + +int PvrEglScreen::transformation() const +{ + return 0; +} + +#endif + void PvrEglScreen::sync() { // Put code here to synchronize 2D and 3D operations if necessary. diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h index 8bf42c7..5769e70 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h @@ -46,16 +46,18 @@ #include #include "pvrqwsdrawable.h" +class PvrEglScreen; + class PvrEglScreenSurfaceFunctions : public QGLScreenSurfaceFunctions { public: - PvrEglScreenSurfaceFunctions(QScreen *s, int screenNum) + PvrEglScreenSurfaceFunctions(PvrEglScreen *s, int screenNum) : screen(s), displayId(screenNum) {} bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native); private: - QScreen *screen; + PvrEglScreen *screen; int displayId; }; @@ -80,6 +82,8 @@ public: QWSWindowSurface* createSurface(QWidget *widget) const; QWSWindowSurface* createSurface(const QString &key) const; + int transformation() const; + private: void sync(); void openTty(); @@ -89,6 +93,7 @@ private: int ttyfd, oldKdMode; QString ttyDevice; bool doGraphicsMode; + mutable const QScreen *parent; }; #endif diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index 2c5ac21..4a3787f 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -46,7 +46,7 @@ #include PvrEglWindowSurface::PvrEglWindowSurface - (QWidget *widget, QScreen *screen, int screenNum) + (QWidget *widget, PvrEglScreen *screen, int screenNum) : QWSGLWindowSurface(widget) { setSurfaceFlags(QWSWindowSurface::Opaque); @@ -63,6 +63,7 @@ PvrEglWindowSurface::PvrEglWindowSurface pvrRect.y = pos.y(); pvrRect.width = size.width(); pvrRect.height = size.height(); + transformRects(&pvrRect, 1); // Try to recover a previous PvrQwsDrawable object for the widget // if there is one. This can happen when a PvrEglWindowSurface @@ -75,6 +76,7 @@ PvrEglWindowSurface::PvrEglWindowSurface pvrQwsSetGeometry(drawable, &pvrRect); else drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } PvrEglWindowSurface::PvrEglWindowSurface() @@ -113,7 +115,9 @@ void PvrEglWindowSurface::setGeometry(const QRect &rect) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetGeometry(drawable, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } QWSGLWindowSurface::setGeometry(rect); } @@ -127,7 +131,9 @@ bool PvrEglWindowSurface::move(const QPoint &offset) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetGeometry(drawable, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } return QWSGLWindowSurface::move(offset); } @@ -200,7 +206,9 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetVisibleRegion(drawable, &pvrRect, 1); + pvrQwsSetRotation(drawable, screen->transformation()); if (!pvrQwsSwapBuffers(drawable, 1)) screen->solidFill(QColor(0, 0, 0), region); } else { @@ -213,9 +221,53 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) pvrRects[index].width = rect.width(); pvrRects[index].height = rect.height(); } + transformRects(pvrRects, rects.size()); pvrQwsSetVisibleRegion(drawable, pvrRects, rects.size()); + pvrQwsSetRotation(drawable, screen->transformation()); if (!pvrQwsSwapBuffers(drawable, 1)) screen->solidFill(QColor(0, 0, 0), region); delete [] pvrRects; } } + +void PvrEglWindowSurface::transformRects(PvrQwsRect *rects, int count) const +{ + switch (screen->transformation()) { + case 0: break; + + case 90: + { + for (int index = 0; index < count; ++index) { + int x = rects[index].y; + int y = screen->height() - (rects[index].x + rects[index].width); + rects[index].x = x; + rects[index].y = y; + qSwap(rects[index].width, rects[index].height); + } + } + break; + + case 180: + { + for (int index = 0; index < count; ++index) { + int x = screen->width() - (rects[index].x + rects[index].width); + int y = screen->height() - (rects[index].y + rects[index].height); + rects[index].x = x; + rects[index].y = y; + } + } + break; + + case 270: + { + for (int index = 0; index < count; ++index) { + int x = screen->width() - (rects[index].y + rects[index].height); + int y = rects[index].x; + rects[index].x = x; + rects[index].y = y; + qSwap(rects[index].width, rects[index].height); + } + } + break; + } +} diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h index 58a5fb2..b0a161c 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h @@ -45,12 +45,12 @@ #include #include "pvrqwsdrawable.h" -class QScreen; +class PvrEglScreen; class PvrEglWindowSurface : public QWSGLWindowSurface { public: - PvrEglWindowSurface(QWidget *widget, QScreen *screen, int screenNum); + PvrEglWindowSurface(QWidget *widget, PvrEglScreen *screen, int screenNum); PvrEglWindowSurface(); ~PvrEglWindowSurface(); @@ -76,8 +76,10 @@ public: private: QWidget *widget; PvrQwsDrawable *drawable; - QScreen *screen; + PvrEglScreen *screen; QPaintDevice *pdevice; + + void transformRects(PvrQwsRect *rects, int count) const; }; #endif -- cgit v0.12 From 24c05a4db9ad398139de8d660347513b301aa911 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 09:09:34 +1000 Subject: Remove unnecessary PowerVR helper functions The cross-process memory sharing code never really worked in the way we needed it to - so remove it until something better comes along. Reviewed-by: trustme Back port of 04648b44f0784223122a782320d0b09b5c1e9497 --- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c | 60 ---------------------- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h | 15 ------ 2 files changed, 75 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index c1b655a..17345a9 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -828,63 +828,3 @@ void pvrQwsSetSwapFunction drawable->swapFunction = func; drawable->userData = userData; } - -unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable) -{ - unsigned long addr; - unsigned long start; - unsigned long end; - unsigned long off; - unsigned long offset; - FILE *file; - char buffer[BUFSIZ]; - char flags[16]; - - if (!drawable->backBuffersValid) - return 0; - addr = (unsigned long) - (drawable->backBuffers[drawable->currentBackBuffer]->pBase); - - /* Search /proc/self/maps for the memory region that contains "addr". - The file offset for that memory region is the identifier we need */ - file = fopen("/proc/self/maps", "r"); - if (!file) { - perror("/proc/self/maps"); - return 0; - } - offset = 0; - while (fgets(buffer, sizeof(buffer), file)) { - if (sscanf(buffer, "%lx-%lx %s %lx", - &start, &end, flags, &off) < 4) - continue; - if (start <= addr && addr < end) { - offset = off; - break; - } - } - fclose(file); - return offset; -} - -void *pvrQwsMapMemory(unsigned long id, int size) -{ - void *addr; - int fd = open("/dev/pvrsrv", O_RDWR, 0); - if (fd < 0) { - perror("/dev/pvrsrv"); - return 0; - } - addr = mmap(0, (size_t)size, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, (off_t)id); - if (addr == (void *)(-1)) { - perror("mmap pvr memory region"); - addr = 0; - } - close(fd); - return addr; -} - -void pvrQwsUnmapMemory(void *addr, int size) -{ - munmap(addr, size); -} diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h index b9e035f..55e0310 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h @@ -162,21 +162,6 @@ int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly); void pvrQwsSetSwapFunction (PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData); -/* Get a memory identifier for the indicated drawable's buffer. - The identifier can be passed to another process and then - passed to pvrQwsMapMemory() to map the drawable's buffer into - the other process's address space. Returns zero if the - memory identifier could not be determined. This should only - be used for pixmap drawables */ -unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable); - -/* Map the memory buffer of a foreign application's drawable, as - indicated by "id" and "size". Returns null if the map failed */ -void *pvrQwsMapMemory(unsigned long id, int size); - -/* Unmap the memory obtained from pvrQwsMapMemory() */ -void pvrQwsUnmapMemory(void *addr, int size); - #ifdef __cplusplus }; #endif -- cgit v0.12 From 49134383c2fd81b9253207b70aaf2530526b044d Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 09:09:51 +1000 Subject: The shipped pvr2d.h/wsegl.h for PowerVR do not work with MBX Reviewed-by: trustme Back port of 4ae09215de36fcfd17dc6875aca102d784d65012 --- src/plugins/gfxdrivers/powervr/README | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README index 322a6b2..513e7f5 100644 --- a/src/plugins/gfxdrivers/powervr/README +++ b/src/plugins/gfxdrivers/powervr/README @@ -31,9 +31,10 @@ strictly Unix-style markers. * IMPORTANT: To build the QScreen plugin and the WSEGL library it depends * * on, the pvr2d.h, wsegl.h headers for your platform are required. You * * can find a copy of these headers in src/3rdparty/powervr for SGX based * -* platforms like the TI OMAP3xxx. They may also work on MBX platforms too * -* depending on how old your libEGL is. You can tell Qt where to find * -* these headers by setting QMAKE_INCDIR_POWERVR in the mkspec. * +* platforms like the TI OMAP3xxx. They probably will not work on MBX * +* because of differences in the layout of certain PVR2D structures. * +* You can tell Qt where to find the actual headers for your system by * +* setting QMAKE_INCDIR_POWERVR in the mkspec. * *************************************************************************** When you start a Qt/Embedded application, you should modify the QWS_DISPLAY -- cgit v0.12 From 0dc3e7f6b482d359b10bfe4e0a3032644b77c94b Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 09:10:09 +1000 Subject: Increase PowerVR memory alignment from 8 to 32 for SGX systems. Increasing the alignment does not seem to affect MBX. Back port of 7997279bc22d30bf1d1a30a567bda33ecc9aeb2d --- src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index 17345a9..a9c22ef 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -662,7 +662,7 @@ int pvrQwsAllocBuffers(PvrQwsDrawable *drawable) PVR2DMemFree(pvrQwsDisplay.context, drawable->backBuffers[index]); } } - drawable->stridePixels = (drawable->rect.width + 7) & ~7; + drawable->stridePixels = (drawable->rect.width + 31) & ~31; drawable->strideBytes = drawable->stridePixels * pvrQwsDisplay.screens[drawable->screen].bytesPerPixel; -- cgit v0.12 From fc6822cb2c1a09b018189168965a8ade23cf1074 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 2 Nov 2009 10:23:12 +0200 Subject: Fix for static QSound::play in Symbian and code style fixes. Static QSound::play(const QString& filename) API did work for Symbian, since local stack variable was deleted before asynchronous play completed. This happened with the following seqeunce: - void QAuServer::play() is called and creates a QSound on the stack - QAuBucketS60::play() is called - m_prepared is false, so the actual play will happen a bit later - The QSound created on the stack is deleted -> Silence This scenario is now fixed by making copy of QSound object to internal list, and temp object is being deleted when play is completed either successfully or unsuccessfully. Added also manual test case for static play. Task-number: QTBUG-5217 Reviewed-by: Miikka Heikkinen --- src/gui/kernel/qsound_s60.cpp | 94 ++++++++++++++++++++++++---------------- tests/auto/qsound/tst_qsound.cpp | 26 ++++++++--- 2 files changed, 75 insertions(+), 45 deletions(-) diff --git a/src/gui/kernel/qsound_s60.cpp b/src/gui/kernel/qsound_s60.cpp index 352580e..e4b7cec 100644 --- a/src/gui/kernel/qsound_s60.cpp +++ b/src/gui/kernel/qsound_s60.cpp @@ -60,13 +60,13 @@ class QAuServerS60; class QAuBucketS60 : public QAuBucket, public MMdaAudioPlayerCallback { public: - QAuBucketS60( QAuServerS60 *server, QSound *sound); + QAuBucketS60(QAuServerS60 *server, QSound *sound); ~QAuBucketS60(); void play(); void stop(); - inline QSound* sound() const { return m_sound; } + inline QSound *sound() const { return m_sound; } public: // from MMdaAudioPlayerCallback void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); @@ -77,88 +77,106 @@ private: QAuServerS60 *m_server; bool m_prepared; bool m_playCalled; - CMdaAudioPlayerUtility* m_playUtility; + CMdaAudioPlayerUtility *m_playUtility; }; class QAuServerS60 : public QAuServer { public: - QAuServerS60( QObject* parent ); + QAuServerS60(QObject *parent); - void init( QSound* s ) + void init(QSound *s) { - QAuBucketS60 *bucket = new QAuBucketS60( this, s ); - setBucket( s, bucket ); + QAuBucketS60 *bucket = new QAuBucketS60(this, s); + setBucket(s, bucket); } - void play( QSound* s ) + void play(QSound *s) { - bucket( s )->play(); + bucket(s)->play(); } - void stop( QSound* s ) + void stop(QSound *s) { - bucket( s )->stop(); + bucket(s)->stop(); } bool okay() { return true; } + void play(const QString& filename); + protected: - void playCompleted(QAuBucketS60* bucket, int error) - { - QSound *sound = bucket->sound(); - if(!error) { - // We need to handle repeats by ourselves, since with Symbian API we don't - // know how many loops have been played when user asks it - if( decLoop( sound ) ) { - play( sound ); - } - } else { - // We don't have a way to inform about errors -> just decrement loops - // in order that QSound::isFinished will return true; - while(decLoop(sound)) {} - } - } + void playCompleted(QAuBucketS60 *bucket, int error); protected: - QAuBucketS60* bucket( QSound *s ) + QAuBucketS60 *bucket(QSound *s) { - return (QAuBucketS60*)QAuServer::bucket( s ); + return (QAuBucketS60 *)QAuServer::bucket( s ); } friend class QAuBucketS60; + // static QSound::play(filename) cannot be stopped, meaning that playCompleted + // will get always called and QSound gets removed form this list. + QList staticPlayingSounds; }; -QAuServerS60::QAuServerS60(QObject* parent) : +QAuServerS60::QAuServerS60(QObject *parent) : QAuServer(parent) { setObjectName(QLatin1String("QAuServerS60")); } +void QAuServerS60::play(const QString& filename) +{ + QSound *s = new QSound(filename); + staticPlayingSounds.append(s); + play(s); +} + +void QAuServerS60::playCompleted(QAuBucketS60 *bucket, int error) +{ + QSound *sound = bucket->sound(); + if (!error) { + // We need to handle repeats by ourselves, since with Symbian API we don't + // know how many loops have been played when user asks it + if (decLoop(sound)) { + play(sound); + } else { + if (staticPlayingSounds.removeAll(sound)) + delete sound; + } + } else { + // We don't have a way to inform about errors -> just decrement loops + // in order that QSound::isFinished will return true; + while (decLoop(sound)) {} + if (staticPlayingSounds.removeAll(sound)) + delete sound; + } +} -QAuServer* qt_new_audio_server() +QAuServer *qt_new_audio_server() { return new QAuServerS60(qApp); } -QAuBucketS60::QAuBucketS60( QAuServerS60 *server, QSound *sound ) - : m_sound( sound ), m_server( server ), m_prepared(false), m_playCalled(false) +QAuBucketS60::QAuBucketS60(QAuServerS60 *server, QSound *sound) + : m_sound(sound), m_server(server), m_prepared(false), m_playCalled(false) { - QString filepath = QFileInfo( m_sound->fileName() ).absoluteFilePath(); + QString filepath = QFileInfo(m_sound->fileName()).absoluteFilePath(); filepath = QDir::toNativeSeparators(filepath); TPtrC filepathPtr(qt_QString2TPtrC(filepath)); TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this); m_playUtility->OpenFileL(filepathPtr)); - if(err){ + if (err) { m_server->playCompleted(this, err); } } void QAuBucketS60::play() { - if(m_prepared) { + if (m_prepared) { // OpenFileL call is completed we can start playing immediately m_playUtility->Play(); } else { @@ -180,11 +198,11 @@ void QAuBucketS60::MapcPlayComplete(TInt aError) void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) { - if(aError) { + if (aError) { m_server->playCompleted(this, aError); } else { m_prepared = true; - if(m_playCalled){ + if (m_playCalled){ play(); } } @@ -192,7 +210,7 @@ void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds QAuBucketS60::~QAuBucketS60() { - if(m_playUtility){ + if (m_playUtility){ m_playUtility->Stop(); m_playUtility->Close(); } diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index 56a330b..73eca98 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -55,20 +55,32 @@ public: tst_QSound( QObject* parent=0) : QObject(parent) {} private slots: - void checkFinished(); + void checkFinished(); + + // Manual tests + void staticPlay(); }; void tst_QSound::checkFinished() { - QSound sound(SRCDIR"4.wav"); - sound.setLoops(3); - sound.play(); - QTest::qWait(5000); + QSound sound(SRCDIR"4.wav"); + sound.setLoops(3); + sound.play(); + QTest::qWait(5000); #if defined(Q_WS_QWS) - QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort); + QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort); #endif - QVERIFY(sound.isFinished() ); + QVERIFY(sound.isFinished() ); +} + +void tst_QSound::staticPlay() +{ + QSKIP("Test disabled -- only for manual purposes", SkipAll); + + // Check that you hear sound with static play also. + QSound::play(SRCDIR"4.wav"); + QTest::qWait(2000); } QTEST_MAIN(tst_QSound); -- cgit v0.12 From 17cda5c55273813cbedcced3a511f1c222978182 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 2 Nov 2009 10:51:08 +0100 Subject: Check for null pixmap Reviewed-by: Trond --- src/gui/painting/qwindowsurface_x11.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index 46c4c42..77e019c 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -94,6 +94,8 @@ QPaintDevice *QX11WindowSurface::paintDevice() void QX11WindowSurface::beginPaint(const QRegion &rgn) { #ifndef QT_NO_XRENDER + Q_ASSERT(!d_ptr->device.isNull()); + if (d_ptr->translucentBackground) { if (d_ptr->device.depth() != 32) static_cast(d_ptr->device.data_ptr().data())->convertToARGB32(); @@ -157,8 +159,8 @@ void QX11WindowSurface::setGeometry(const QRect &rect) QPixmap::x11SetDefaultScreen(d_ptr->widget->x11Info().screen()); QX11PixmapData *oldData = static_cast(d_ptr->device.pixmapData()); - Q_ASSERT(oldData); - if (!(oldData->flags & QX11PixmapData::Uninitialized) && hasStaticContents()) { + + if (oldData && !(oldData->flags & QX11PixmapData::Uninitialized) && hasStaticContents()) { // Copy the content of the old pixmap into the new one. QX11PixmapData *newData = new QX11PixmapData(QPixmapData::PixmapType); newData->resize(size.width(), size.height()); -- cgit v0.12 From e1a08048f29174c01e289a4f608aaa283819c5d5 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 2 Nov 2009 10:51:47 +0100 Subject: QStyleSheetStyle: fixes QPushButton { text-alignement:top } The vertial alignement was correctly set later in the function but Qt::AlignVCenter was always set, conflicting with the flags from textAlignment Reviewed-by: Gabriel Task-number: QTBUG-5110 Task-number: 240367 --- src/gui/styles/qstylesheetstyle.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 2d90aa1..2ae9f6a 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3370,7 +3370,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if (rule.hasPosition() && rule.position()->textAlignment != 0) { Qt::Alignment textAlignment = rule.position()->textAlignment; QRect textRect = button->rect; - uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; + uint tf = Qt::TextShowMnemonic; + const uint verticalAlignMask = Qt::AlignVCenter | Qt::AlignTop | Qt::AlignLeft; + tf |= (textAlignment & verticalAlignMask) ? (textAlignment & verticalAlignMask) : Qt::AlignVCenter; if (!styleHint(SH_UnderlineShortcut, button, w)) tf |= Qt::TextHideMnemonic; if (!button->icon.isNull()) { -- cgit v0.12 From a80e58335e69c8ce96d1596e0ed2d14e424a0d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Mon, 2 Nov 2009 12:03:52 +0200 Subject: Style's theme palette hash is lost after orientation switch Currently, after orientation switch when new theme background is applied, it is done using QApplication::setPalette(). This unfortunately tosses away the palette hash. So instead directly calling QApplication::setPalette(), the fix is to call the style's internal setThemePalette(), which copies the hash also to QApplication palette. This is related to bug QT-1478 in Private JIRA. Task-number: QT-1478 Reviewed-by: Shane Kearns --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 10a63a8..48f7042 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -499,7 +499,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const Q_UNUSED(app) QPalette applicationPalette = QApplication::palette(); applicationPalette.setBrush(QPalette::Window, backgroundTexture()); - QApplication::setPalette(applicationPalette); + setThemePalette(app); } void QS60StylePrivate::deleteBackground() -- cgit v0.12 From be651bb65e952743f4bc31a970750be501bcf978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Mon, 2 Nov 2009 11:31:01 +0100 Subject: Enable the RightToLeft (mirrored) test for basic layout tests. --- tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 1c7a159..1a19162 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -1715,8 +1715,6 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() QCOMPARE(widgets[item.index]->geometry(), item.rect); } - // ###: not supported yet -/* // Test mirrored mode widget->setLayoutDirection(Qt::RightToLeft); layout->activate(); @@ -1731,7 +1729,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() QCOMPARE(widgets[item.index]->geometry(), mirroredRect); delete widgets[item.index]; } -*/ + delete widget; } -- cgit v0.12 From 85e41590732f15cec16909bf1121d944ae684373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 13:37:05 +0100 Subject: Optimized graphics effects to not needlessly invalidate cache. When the effect rect changes we only need to invalidate the cache if the mode is ExpandToEffectRectPadMode. Reviewed-by: Gunnar Sletta --- src/gui/effects/qgraphicseffect.cpp | 9 ++++++++- src/gui/effects/qgraphicseffect_p.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 3a6bab5..c8e39da 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -279,6 +279,13 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse return pm; } +void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const +{ + if (effectRectChanged && m_cachedMode != QGraphicsEffectSource::ExpandToEffectRectPadMode) + return; + QPixmapCache::remove(m_cacheKey); +} + /*! Constructs a new QGraphicsEffect instance having the specified \a parent. @@ -418,7 +425,7 @@ void QGraphicsEffect::updateBoundingRect() Q_D(QGraphicsEffect); if (d->source) { d->source->d_func()->effectBoundingRectChanged(); - d->source->d_func()->invalidateCache(); + d->source->d_func()->invalidateCache(true); } } diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 1ed7103..0ff5794 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -85,7 +85,7 @@ public: virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0, QGraphicsEffectSource::PixmapPadMode mode = QGraphicsEffectSource::ExpandToTransparentBorderPadMode) const = 0; virtual void effectBoundingRectChanged() = 0; - void invalidateCache() const { QPixmapCache::remove(m_cacheKey); } + void invalidateCache(bool effectRectChanged = false) const; friend class QGraphicsScenePrivate; friend class QGraphicsItem; -- cgit v0.12 From 70b7f26c3155e83d59cae7b89ed1af3b57797a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 13:59:41 +0100 Subject: Added strict size parameter to QGLFramebufferObject pool. The strict size parameter can be used when it's critical that we get the exact size we ask for. Reviewed-by: Gunnar Sletta --- src/opengl/qpixmapdata_gl.cpp | 19 ++++++++++++++++--- src/opengl/qpixmapdata_gl_p.h | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index c965947..5ca37ef 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -89,13 +89,22 @@ static inline QSize maybeRoundToNextPowerOfTwo(const QSize &sz) } -QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat) +QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat, bool strictSize) { QGLFramebufferObject *chosen = 0; QGLFramebufferObject *candidate = 0; for (int i = 0; !chosen && i < m_fbos.size(); ++i) { QGLFramebufferObject *fbo = m_fbos.at(i); + if (strictSize) { + if (fbo->size() == requestSize && fbo->format() == requestFormat) { + chosen = fbo; + break; + } else { + continue; + } + } + if (fbo->format() == requestFormat) { // choose the fbo with a matching format and the closest size if (!candidate || areaDiff(requestSize, candidate) > areaDiff(requestSize, fbo)) @@ -127,7 +136,10 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize } if (!chosen) { - chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat); + if (strictSize) + chosen = new QGLFramebufferObject(requestSize, requestFormat); + else + chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat); } if (!chosen->isValid()) { @@ -140,7 +152,8 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize void QGLFramebufferObjectPool::release(QGLFramebufferObject *fbo) { - m_fbos << fbo; + if (fbo) + m_fbos << fbo; } diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index 6190d38..8a13e03 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -69,7 +69,7 @@ class QGLPixmapData; class QGLFramebufferObjectPool { public: - QGLFramebufferObject *acquire(const QSize &size, const QGLFramebufferObjectFormat &format); + QGLFramebufferObject *acquire(const QSize &size, const QGLFramebufferObjectFormat &format, bool strictSize = false); void release(QGLFramebufferObject *fbo); private: -- cgit v0.12 From 2a902676b74d0aa3482e722602879f7a02be1103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 14:26:55 +0100 Subject: Moved Qt::RenderHint back into QGraphicsBlurEffect and added a hint. Added AnimationHint, which didn't make too much sense in a generic enum, so Qt::RenderHint was moved back into QGraphicsBlurEffect as QGraphicsBlurEffect::BlurHint. Reviewed-by: Gunnar Sletta --- dist/changes-4.6.0 | 4 ++++ src/corelib/global/qnamespace.h | 5 ----- src/corelib/global/qnamespace.qdoc | 15 --------------- src/gui/effects/qgraphicseffect.cpp | 37 ++++++++++++++++++++++++++++--------- src/gui/effects/qgraphicseffect.h | 14 ++++++++++---- src/gui/image/qpixmapfilter.cpp | 18 ++++++++++++------ src/gui/image/qpixmapfilter_p.h | 5 +++-- src/opengl/qglpixmapfilter.cpp | 28 ++++++++++++++-------------- 8 files changed, 71 insertions(+), 55 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 7f723da..c7f9ad7 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -30,6 +30,10 @@ information about a particular change. * [245219] Added QXmlQuery::setFocus(const QString &focus); + - QGraphicsBlurEffect + * Since the 4.6 beta Qt::RenderHint has been moved to + QGraphicsBlurEffect::BlurHint. + - QVariant * Many optimisations * Added QVariant::toFloat() and QVariant::toReal() diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 2b62c6b..42dd3a2 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1645,11 +1645,6 @@ public: NavigationModeCursorAuto, NavigationModeCursorForceVisible }; - - enum RenderHint { - QualityHint, - PerformanceHint - }; } #ifdef Q_MOC_RUN ; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 5f9d01d..e3e881d 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2873,18 +2873,3 @@ \sa QApplication::setNavigationMode() \sa QApplication::navigationMode() */ - -/*! - \enum Qt::RenderHint - \since 4.6 - - This enum describes the possible hints that can be used to control various - rendering operations. - - \value QualityHint Indicates that rendering quality is the most important factor, - at the potential cost of lower performance. - - \value PerformanceHint Indicates that rendering performance is the most important factor, - at the potential cost of lower quality. -*/ - diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index c8e39da..e181b18 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -613,6 +613,26 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou */ /*! + \enum QGraphicsBlurEffect::BlurHint + \since 4.6 + + This enum describes the possible hints that can be used to control how + blur effects are applied. The hints might not have an effect in all the + paint engines. + + \value QualityHint Indicates that rendering quality is the most important factor, + at the potential cost of lower performance. + + \value PerformanceHint Indicates that rendering performance is the most important factor, + at the potential cost of lower quality. + + \value AnimationHint Indicates that the blur radius is going to be animated, hinting + that the implementation can keep a cache of blurred verisons of the source pixmap. + Do not use this hint if the source item is going to be dynamically changing. +*/ + + +/*! Constructs a new QGraphicsBlurEffect instance. The \a parent parameter is passed to QGraphicsEffect's constructor. */ @@ -620,7 +640,7 @@ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) { Q_D(QGraphicsBlurEffect); - d->filter->setBlurHint(Qt::PerformanceHint); + d->filter->setBlurHint(QGraphicsBlurEffect::PerformanceHint); } /*! @@ -667,20 +687,19 @@ void QGraphicsBlurEffect::setBlurRadius(qreal radius) \property QGraphicsBlurEffect::blurHint \brief the blur hint of the effect. - Use the Qt::PerformanceHint hint to say that you want a faster blur, - and the Qt::QualityHint hint to say that you prefer a higher quality blur. - - When animating the blur radius it's recommended to use Qt::PerformanceHint. + Use the PerformanceHint hint to say that you want a faster blur, + the QualityHint hint to say that you prefer a higher quality blur, + or the AnimationHint when you want to animate the blur radius. - By default, the blur hint is Qt::PerformanceHint. + By default, the blur hint is PerformanceHint. */ -Qt::RenderHint QGraphicsBlurEffect::blurHint() const +QGraphicsBlurEffect::BlurHint QGraphicsBlurEffect::blurHint() const { Q_D(const QGraphicsBlurEffect); return d->filter->blurHint(); } -void QGraphicsBlurEffect::setBlurHint(Qt::RenderHint hint) +void QGraphicsBlurEffect::setBlurHint(QGraphicsBlurEffect::BlurHint hint) { Q_D(QGraphicsBlurEffect); if (d->filter->blurHint() == hint) @@ -691,7 +710,7 @@ void QGraphicsBlurEffect::setBlurHint(Qt::RenderHint hint) } /*! - \fn void QGraphicsBlurEffect::blurHintChanged(Qt::RenderHint hint) + \fn void QGraphicsBlurEffect::blurHintChanged(Qt::BlurHint hint) This signal is emitted whenever the effect's blur hint changes. The \a hint parameter holds the effect's new blur hint. diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index bf18581..7335a25 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -183,22 +183,28 @@ class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) - Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged) + Q_PROPERTY(BlurHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged) public: + enum BlurHint { + QualityHint, + PerformanceHint, + AnimationHint + }; + QGraphicsBlurEffect(QObject *parent = 0); ~QGraphicsBlurEffect(); QRectF boundingRectFor(const QRectF &rect) const; qreal blurRadius() const; - Qt::RenderHint blurHint() const; + BlurHint blurHint() const; public Q_SLOTS: void setBlurRadius(qreal blurRadius); - void setBlurHint(Qt::RenderHint hint); + void setBlurHint(BlurHint hint); Q_SIGNALS: void blurRadiusChanged(qreal blurRadius); - void blurHintChanged(Qt::RenderHint hint); + void blurHintChanged(BlurHint hint); protected: void draw(QPainter *painter, QGraphicsEffectSource *source); diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index d0de03e..e50cc8b 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -504,10 +504,10 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q class QPixmapBlurFilterPrivate : public QPixmapFilterPrivate { public: - QPixmapBlurFilterPrivate() : radius(5), hint(Qt::PerformanceHint) {} + QPixmapBlurFilterPrivate() : radius(5), hint(QGraphicsBlurEffect::PerformanceHint) {} qreal radius; - Qt::RenderHint hint; + QGraphicsBlurEffect::BlurHint hint; }; @@ -556,12 +556,18 @@ qreal QPixmapBlurFilter::radius() const Setting the blur hint to PerformanceHint causes the implementation to trade off visual quality to blur the image faster. Setting the blur hint to QualityHint causes the implementation to improve - visual quality at the expense of speed. The implementation is free - to ignore this value if it only has a single blur algorithm. + visual quality at the expense of speed. + + AnimationHint causes the implementation to optimize for animating + the blur radius, possibly by caching blurred versions of the source + pixmap. + + The implementation is free to ignore this value if it only has a single + blur algorithm. \internal */ -void QPixmapBlurFilter::setBlurHint(Qt::RenderHint hint) +void QPixmapBlurFilter::setBlurHint(QGraphicsBlurEffect::BlurHint hint) { Q_D(QPixmapBlurFilter); d->hint = hint; @@ -572,7 +578,7 @@ void QPixmapBlurFilter::setBlurHint(Qt::RenderHint hint) \internal */ -Qt::RenderHint QPixmapBlurFilter::blurHint() const +QGraphicsBlurEffect::BlurHint QPixmapBlurFilter::blurHint() const { Q_D(const QPixmapBlurFilter); return d->hint; diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h index fc70795..6a96676 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/gui/image/qpixmapfilter_p.h @@ -55,6 +55,7 @@ #include #include +#include QT_BEGIN_HEADER @@ -130,10 +131,10 @@ public: ~QPixmapBlurFilter(); void setRadius(qreal radius); - void setBlurHint(Qt::RenderHint hint); + void setBlurHint(QGraphicsBlurEffect::BlurHint hint); qreal radius() const; - Qt::RenderHint blurHint() const; + QGraphicsBlurEffect::BlurHint blurHint() const; QRectF boundingRectFor(const QRectF &rect) const; void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const; diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 2af69e0..3b94ad3 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -100,7 +100,7 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapBlurFilter(Qt::RenderHint hint); + QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint); void setUniforms(QGLShaderProgram *program); @@ -117,13 +117,13 @@ private: mutable bool m_haveCached; mutable int m_cachedRadius; - mutable Qt::RenderHint m_hint; + mutable QGraphicsBlurEffect::BlurHint m_hint; }; class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapDropShadowFilter(Qt::RenderHint hint); + QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint); void setUniforms(QGLShaderProgram *program); @@ -137,7 +137,7 @@ private: mutable bool m_haveCached; mutable int m_cachedRadius; - mutable Qt::RenderHint m_hint; + mutable QGraphicsBlurEffect::BlurHint m_hint; }; extern QGLWidget *qt_gl_share_widget(); @@ -153,13 +153,13 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr case QPixmapFilter::BlurFilter: { const QPixmapBlurFilter *proto = static_cast(prototype); - if (proto->blurHint() == Qt::PerformanceHint || proto->radius() <= 5) { + if (proto->blurHint() == QGraphicsBlurEffect::PerformanceHint || proto->radius() <= 5) { if (!d->fastBlurFilter) - d->fastBlurFilter.reset(new QGLPixmapBlurFilter(Qt::PerformanceHint)); + d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); return d->fastBlurFilter.data(); } if (!d->blurFilter) - d->blurFilter.reset(new QGLPixmapBlurFilter(Qt::QualityHint)); + d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint)); return d->blurFilter.data(); } @@ -167,11 +167,11 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr const QPixmapDropShadowFilter *proto = static_cast(prototype); if (proto->blurRadius() <= 5) { if (!d->fastDropShadowFilter) - d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(Qt::PerformanceHint)); + d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::PerformanceHint)); return d->fastDropShadowFilter.data(); } if (!d->dropShadowFilter) - d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(Qt::QualityHint)); + d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::QualityHint)); return d->dropShadowFilter.data(); } @@ -327,7 +327,7 @@ static QByteArray qt_gl_convertToClamped(const QByteArray &source) return result; } -QGLPixmapBlurFilter::QGLPixmapBlurFilter(Qt::RenderHint hint) +QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint) : m_haveCached(false) , m_cachedRadius(0) , m_hint(hint) @@ -341,7 +341,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const int actualRadius = qRound(radius()); int filterRadius = actualRadius; int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 }; - if (m_hint == Qt::PerformanceHint) { + if (m_hint == QGraphicsBlurEffect::PerformanceHint) { uint i = 0; for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) { if (fastRadii[i+1] > filterRadius) @@ -428,7 +428,7 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - if (m_hint == Qt::QualityHint) { + if (m_hint == QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) @@ -578,7 +578,7 @@ QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius, bool singlePa return source; } -QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(Qt::RenderHint hint) +QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint) : m_haveCached(false) , m_cachedRadius(0) , m_hint(hint) @@ -685,7 +685,7 @@ void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program) alpha); } - if (m_hint == Qt::QualityHint) { + if (m_hint == QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) -- cgit v0.12 From 64fbefa605d976ab752149bb39880893c82ad8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 14:00:35 +0100 Subject: Optimized animated blur radii in the GL 2 paint engine. We add an internal cache which keeps four half-scaled versions of the source pixmap at different blur radii, then we simply interpolate between the two pixmaps around the desired blur radius, or between the base source pixmap and the first blurred version. Reviewed-by: Gunnar Sletta --- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 1 + src/opengl/qgl.h | 1 + src/opengl/qglpixmapfilter.cpp | 379 ++++++++++++++++++++- 3 files changed, 369 insertions(+), 12 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 209cd36..4cf2a83 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -289,6 +289,7 @@ public: QScopedPointer convolutionFilter; QScopedPointer colorizeFilter; QScopedPointer blurFilter; + QScopedPointer animationBlurFilter; QScopedPointer fastBlurFilter; QScopedPointer dropShadowFilter; QScopedPointer fastDropShadowFilter; diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index e14e7fb..079953f 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -399,6 +399,7 @@ private: friend class QGLTextureGlyphCache; friend class QGLShareRegister; friend class QGLSharedResourceGuard; + friend class QGLPixmapBlurFilter; friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags(); #ifdef Q_WS_MAC public: diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 3b94ad3..ff19e06 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -43,6 +43,8 @@ #include "private/qpixmapdata_gl_p.h" #include "private/qpaintengineex_opengl2_p.h" #include "private/qglengineshadermanager_p.h" +#include "private/qpixmapdata_p.h" +#include "private/qimagepixmapcleanuphooks_p.h" #include "qglpixmapfilter_p.h" #include "qgraphicssystem_gl_p.h" #include "qpaintengine_opengl_p.h" @@ -54,7 +56,7 @@ #include "private/qapplication_p.h" #include "private/qmath_p.h" - +#include "qmath.h" QT_BEGIN_NAMESPACE @@ -114,6 +116,10 @@ private: mutable QSize m_textureSize; mutable bool m_horizontalBlur; mutable bool m_singlePass; + mutable bool m_animatedBlur; + + mutable qreal m_t; + mutable QSize m_targetSize; mutable bool m_haveCached; mutable int m_cachedRadius; @@ -153,6 +159,11 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr case QPixmapFilter::BlurFilter: { const QPixmapBlurFilter *proto = static_cast(prototype); + if (proto->blurHint() == QGraphicsBlurEffect::AnimationHint) { + if (!d->animationBlurFilter) + d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHint())); + return d->animationBlurFilter.data(); + } if (proto->blurHint() == QGraphicsBlurEffect::PerformanceHint || proto->radius() <= 5) { if (!d->fastBlurFilter) d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); @@ -328,20 +339,343 @@ static QByteArray qt_gl_convertToClamped(const QByteArray &source) } QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint) - : m_haveCached(false) + : m_animatedBlur(false) + , m_haveCached(false) , m_cachedRadius(0) , m_hint(hint) { } +// should be even numbers as they will be divided by two +static const int qCachedBlurLevels[] = { 6, 14, 30 }; +static const int qNumCachedBlurTextures = sizeof(qCachedBlurLevels) / sizeof(*qCachedBlurLevels); +static const int qMaxCachedBlurLevel = qCachedBlurLevels[qNumCachedBlurTextures - 1]; + +static qreal qLogBlurLevel(int level) +{ + static bool initialized = false; + static qreal logBlurLevelCache[qNumCachedBlurTextures]; + if (!initialized) { + for (int i = 0; i < qNumCachedBlurTextures; ++i) + logBlurLevelCache[i] = qLn(qCachedBlurLevels[i]); + initialized = true; + } + return logBlurLevelCache[level]; +} + +class QGLBlurTextureInfo +{ +public: + QGLBlurTextureInfo(QSize size, GLuint textureIds[]) + : m_size(size) + { + for (int i = 0; i < qNumCachedBlurTextures; ++i) + m_textureIds[i] = textureIds[i]; + } + + ~QGLBlurTextureInfo() + { + glDeleteTextures(qNumCachedBlurTextures, m_textureIds); + } + + QSize size() const { return m_size; } + GLuint textureId(int i) const { return m_textureIds[i]; } + +private: + GLuint m_textureIds[qNumCachedBlurTextures]; + QSize m_size; +}; + +class QGLBlurTextureCache : public QObject +{ +public: + static QGLBlurTextureCache *cacheForContext(const QGLContext *context); + + QGLBlurTextureCache(); + ~QGLBlurTextureCache(); + + QGLBlurTextureInfo *takeBlurTextureInfo(const QPixmap &pixmap); + bool fitsInCache(const QPixmap &pixmap) const; + bool hasBlurTextureInfo(const QPixmap &pixmap) const; + void insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info); + void clearBlurTextureInfo(const QPixmap &pixmap); + + void timerEvent(QTimerEvent *event); + +private: + static void pixmapDestroyed(QPixmap *pixmap); + + QCache cache; + + static QList blurTextureCaches; + + int timerId; +}; + +QList QGLBlurTextureCache::blurTextureCaches; + +static void QGLBlurTextureCache_free(void *ptr) +{ + delete reinterpret_cast(ptr); +} + +Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_blur_texture_caches, (QGLBlurTextureCache_free)) + +QGLBlurTextureCache::QGLBlurTextureCache() + : timerId(0) +{ + cache.setMaxCost(4 * 1024 * 1024); + blurTextureCaches.append(this); +} + +QGLBlurTextureCache::~QGLBlurTextureCache() +{ + blurTextureCaches.removeAt(blurTextureCaches.indexOf(this)); +} + +void QGLBlurTextureCache::timerEvent(QTimerEvent *event) +{ + killTimer(timerId); + timerId = 0; + + cache.clear(); +} + +QGLBlurTextureCache *QGLBlurTextureCache::cacheForContext(const QGLContext *context) +{ + QGLBlurTextureCache *p = reinterpret_cast(qt_blur_texture_caches()->value(context)); + if (!p) { + p = new QGLBlurTextureCache; + qt_blur_texture_caches()->insert(context, p); + } + return p; +} + +QGLBlurTextureInfo *QGLBlurTextureCache::takeBlurTextureInfo(const QPixmap &pixmap) +{ + return cache.take(pixmap.cacheKey()); +} + +void QGLBlurTextureCache::clearBlurTextureInfo(const QPixmap &pixmap) +{ + cache.remove(pixmap.cacheKey()); +} + +bool QGLBlurTextureCache::hasBlurTextureInfo(const QPixmap &pixmap) const +{ + return cache.contains(pixmap.cacheKey()); +} + +void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info) +{ + static bool hookAdded = false; + if (!hookAdded) { + QImagePixmapCleanupHooks::instance()->addPixmapDestructionHook(pixmapDestroyed); + hookAdded = true; + } + + QImagePixmapCleanupHooks::enableCleanupHooks(pixmap); + cache.insert(pixmap.cacheKey(), info, pixmap.width() * pixmap.height()); + + if (timerId) + killTimer(timerId); + + timerId = startTimer(1000); +} + +bool QGLBlurTextureCache::fitsInCache(const QPixmap &pixmap) const +{ + return pixmap.width() * pixmap.height() <= cache.maxCost(); +} + +void QGLBlurTextureCache::pixmapDestroyed(QPixmap *pixmap) +{ + foreach (QGLBlurTextureCache *cache, blurTextureCaches) { + if (cache->hasBlurTextureInfo(*pixmap)) + cache->clearBlurTextureInfo(*pixmap); + } +} + +static const char *qt_gl_interpolate_filter = + "uniform lowp float interpolationValue;" + "uniform lowp sampler2D interpolateTarget;" + "uniform highp vec4 interpolateMapping;" + "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" + "{" + " return mix(texture2D(interpolateTarget, interpolateMapping.xy + interpolateMapping.zw * srcCoords)," + " texture2D(src, srcCoords), interpolationValue);" + "}"; + +static void initializeTexture(GLuint id, int width, int height) +{ + glBindTexture(GL_TEXTURE_2D, id); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D, 0); +} + bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { QGLPixmapBlurFilter *filter = const_cast(this); + QGLContext *ctx = const_cast(QGLContext::currentContext()); + QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); + + if (m_hint == QGraphicsBlurEffect::AnimationHint && blurTextureCache->fitsInCache(src)) { + QRect targetRect = src.rect().adjusted(-qMaxCachedBlurLevel, -qMaxCachedBlurLevel, qMaxCachedBlurLevel, qMaxCachedBlurLevel); + // ensure even dimensions (going to divide by two) + targetRect.setWidth((targetRect.width() + 1) & ~1); + targetRect.setHeight((targetRect.height() + 1) & ~1); + + QGLBlurTextureInfo *info = 0; + if (blurTextureCache->hasBlurTextureInfo(src)) { + info = blurTextureCache->takeBlurTextureInfo(src); + } else { + m_animatedBlur = false; + m_hint = QGraphicsBlurEffect::QualityHint; + m_singlePass = false; + + QGLFramebufferObjectFormat format; + format.setInternalTextureFormat(GL_RGBA); + QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size() / 2, format, true); + + if (!fbo) + return false; + + QPainter fboPainter(fbo); + QGL2PaintEngineEx *engine = static_cast(fboPainter.paintEngine()); + + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + + // ensure GL_LINEAR filtering is used for scaling down to half the size + fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + fboPainter.setCompositionMode(QPainter::CompositionMode_Source); + fboPainter.drawPixmap(qMaxCachedBlurLevel / 2, qMaxCachedBlurLevel / 2, + targetRect.width() / 2 - qMaxCachedBlurLevel, targetRect.height() / 2 - qMaxCachedBlurLevel, src); + + GLuint textures[qNumCachedBlurTextures]; // blur textures + glGenTextures(qNumCachedBlurTextures, textures); + GLuint temp; // temp texture + glGenTextures(1, &temp); + + initializeTexture(temp, fbo->width(), fbo->height()); + m_textureSize = fbo->size(); + + int currentBlur = 0; + + QRect fboRect(0, 0, fbo->width(), fbo->height()); + GLuint sourceTexture = fbo->texture(); + for (int i = 0; i < qNumCachedBlurTextures; ++i) { + int targetBlur = qCachedBlurLevels[i] / 2; + + int blurDelta = qRound(qSqrt(targetBlur * targetBlur - currentBlur * currentBlur)); + QByteArray source = generateGaussianShader(blurDelta); + filter->setSource(source); + + currentBlur = targetBlur; + + // now we're going to be nasty and keep using the same FBO with different textures + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, temp, 0); + + m_horizontalBlur = true; + filter->setOnPainter(&fboPainter); + engine->drawTexture(fboRect, sourceTexture, fbo->size(), fboRect); + filter->removeFromPainter(&fboPainter); + + sourceTexture = textures[i]; + initializeTexture(sourceTexture, fbo->width(), fbo->height()); + + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, textures[i], 0); + + m_horizontalBlur = false; + filter->setOnPainter(&fboPainter); + engine->drawTexture(fboRect, temp, fbo->size(), fboRect); + filter->removeFromPainter(&fboPainter); + } + + glDeleteTextures(1, &temp); + + // reattach the original FBO texture + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, fbo->texture(), 0); + + fboPainter.end(); + + qgl_fbo_pool()->release(fbo); + + info = new QGLBlurTextureInfo(fboRect.size(), textures); + } + + if (!m_haveCached || !m_animatedBlur) { + m_haveCached = true; + m_animatedBlur = true; + m_hint = QGraphicsBlurEffect::AnimationHint; + filter->setSource(qt_gl_interpolate_filter); + } + + QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); + painter->setRenderHint(QPainter::SmoothPixmapTransform); + filter->setOnPainter(painter); + + qreal logRadius = qLn(radius()); + + int t; + for (t = -1; t < qNumCachedBlurTextures - 2; ++t) { + if (logRadius < qLogBlurLevel(t+1)) + break; + } + + qreal logBase = t >= 0 ? qLogBlurLevel(t) : 0; + m_t = qBound(qreal(0), (logRadius - logBase) / (qLogBlurLevel(t+1) - logBase), qreal(1)); + + m_textureSize = info->size(); + + glActiveTexture(GL_TEXTURE0 + 3); + if (t >= 0) { + glBindTexture(GL_TEXTURE_2D, info->textureId(t)); + m_targetSize = info->size(); + } else { + QGLTexture *texture = + ctx->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption + | QGLContext::CanFlipNativePixmapBindOption); + m_targetSize = src.size(); + if (!(texture->options & QGLContext::InvertedYBindOption)) + m_targetSize.setHeight(-m_targetSize.height()); + } + + // restrict the target rect to the max of the radii we are interpolating between + int radiusDelta = qMaxCachedBlurLevel - qCachedBlurLevels[t+1]; + targetRect = targetRect.translated(pos.toPoint()).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta); + + radiusDelta /= 2; + QRect sourceRect = QRect(QPoint(), m_textureSize).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta); + + engine->drawTexture(targetRect, info->textureId(t+1), m_textureSize, sourceRect); + + glActiveTexture(GL_TEXTURE0 + 3); + glBindTexture(GL_TEXTURE_2D, 0); + + filter->removeFromPainter(painter); + blurTextureCache->insertBlurTextureInfo(src, info); + + return true; + } + + if (blurTextureCache->hasBlurTextureInfo(src)) + blurTextureCache->clearBlurTextureInfo(src); + int actualRadius = qRound(radius()); int filterRadius = actualRadius; int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 }; - if (m_hint == QGraphicsBlurEffect::PerformanceHint) { + if (m_hint != QGraphicsBlurEffect::QualityHint) { uint i = 0; for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) { if (fastRadii[i+1] > filterRadius) @@ -352,9 +686,10 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const m_singlePass = filterRadius <= 3; - if (!m_haveCached || filterRadius != m_cachedRadius) { + if (!m_haveCached || m_animatedBlur || filterRadius != m_cachedRadius) { // Only regenerate the shader from source if parameters have changed. m_haveCached = true; + m_animatedBlur = false; m_cachedRadius = filterRadius; QByteArray source = generateGaussianShader(filterRadius, m_singlePass); filter->setSource(source); @@ -389,13 +724,12 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPainter fboPainter(fbo); - if (src.hasAlphaChannel()) { - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - } + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); // ensure GL_LINEAR filtering is used fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + fboPainter.setCompositionMode(QPainter::CompositionMode_Source); filter->setOnPainter(&fboPainter); QBrush pixmapBrush = src; pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius)); @@ -428,6 +762,28 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + if (m_animatedBlur) { + program->setUniformValue("interpolateTarget", 3); + program->setUniformValue("interpolationValue", GLfloat(m_t)); + + if (m_textureSize == m_targetSize) { + program->setUniformValue("interpolateMapping", 0.0f, 0.0f, 1.0f, 1.0f); + } else { + float offsetX = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.width()); + float offsetY = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.height()); + + if (m_targetSize.height() < 0) + offsetY = 1 + offsetY; + + float scaleX = 2.0f * qreal(m_textureSize.width()) / qreal(m_targetSize.width()); + float scaleY = 2.0f * qreal(m_textureSize.height()) / qreal(m_targetSize.height()); + + program->setUniformValue("interpolateMapping", offsetX, offsetY, scaleX, scaleY); + } + + return; + } + if (m_hint == QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); @@ -632,13 +988,12 @@ bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, QPainter fboPainter(fbo); - if (src.hasAlphaChannel()) { - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - } + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); // ensure GL_LINEAR filtering is used fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + fboPainter.setCompositionMode(QPainter::CompositionMode_Source); filter->setOnPainter(&fboPainter); QBrush pixmapBrush = src; pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius)); -- cgit v0.12 From cb357aad0f26c36eb1f942ae37647f9de071c948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 30 Oct 2009 19:28:43 +0100 Subject: Made QGraphicsEffectSource::draw() use cached pixmap if possible. Small optimization for the case where the source pixmap is cached. Reviewed-by: Gunnar Sletta --- src/gui/effects/qgraphicseffect.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index e181b18..78a18d3 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -210,7 +210,23 @@ const QStyleOption *QGraphicsEffectSource::styleOption() const */ void QGraphicsEffectSource::draw(QPainter *painter) { - d_func()->draw(painter); + Q_D(const QGraphicsEffectSource); + + QPixmap pm; + if (QPixmapCache::find(d->m_cacheKey, &pm)) { + QTransform restoreTransform; + if (d->m_cachedSystem == Qt::DeviceCoordinates) { + restoreTransform = painter->worldTransform(); + painter->setWorldTransform(QTransform()); + } + + painter->drawPixmap(d->m_cachedOffset, pm); + + if (d->m_cachedSystem == Qt::DeviceCoordinates) + painter->setWorldTransform(restoreTransform); + } else { + d_func()->draw(painter); + } } /*! -- cgit v0.12 From 7f9c446f53ba89fb5add8ff6a62088eaa93d3460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 2 Nov 2009 10:14:34 +0100 Subject: Fixed compiler warning on GCC about empty while statement. --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 3fec1f0..2a57468 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2158,7 +2158,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #ifndef QT_NO_DEBUG // Reset the gl error stack...git - while (glGetError() != GL_NO_ERROR); + while (glGetError() != GL_NO_ERROR) ; #endif // Scale the pixmap if needed. GL textures needs to have the -- cgit v0.12 From d4ea57ff9022305437fb371802b41120074d3467 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 2 Nov 2009 13:56:40 +0100 Subject: Safeguard isNull() pixmaps in bindTexture and remove a compile warning Reviewed-by: TrustMe --- .../gl2paintengineex/qglengineshadermanager_p.h | 2 +- src/opengl/qgl.cpp | 39 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 59e50d0..50c1432 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -254,7 +254,7 @@ static const GLuint QT_VERTEX_COORDS_ATTR = 0; static const GLuint QT_TEXTURE_COORDS_ATTR = 1; static const GLuint QT_OPACITY_ATTR = 2; -struct QGLEngineShaderProg; +class QGLEngineShaderProg; class QGLEngineSharedShaders : public QObject { diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 3fec1f0..621d926 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2445,6 +2445,9 @@ int QGLContextPrivate::maxTextureSize() */ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, target, format, false, DefaultBindOption); return texture->id; @@ -2477,6 +2480,9 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) */ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, target, format, false, options); return texture->id; @@ -2486,6 +2492,9 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, /*! \internal */ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, DefaultBindOption); return texture->id; @@ -2495,6 +2504,9 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, options); return texture->id; @@ -2507,6 +2519,9 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, target, format, DefaultBindOption); return texture->id; @@ -2521,6 +2536,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, BindOptions options) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, target, format, options); return texture->id; @@ -2530,6 +2548,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma /*! \internal */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), DefaultBindOption); return texture->id; @@ -2538,6 +2559,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, Q GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format, BindOptions options) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), options); return texture->id; @@ -4595,6 +4619,9 @@ bool QGLWidget::autoBufferSwap() const */ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption); } @@ -4608,6 +4635,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format) */ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, target, format, options); } @@ -4617,6 +4647,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, /*! \internal */ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, GLenum(target), GLint(format), QGLContext::DefaultBindOption); } @@ -4624,6 +4657,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, QGLContext::BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, GLenum(target), GLint(format), options); } @@ -4637,6 +4673,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac */ GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { + if (pixmap.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption); } -- cgit v0.12 From bdcde683bc863d0c574b1e4d64b5a16ba0130596 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 2 Nov 2009 14:04:21 +0100 Subject: Make animation timer slightly more accurate with default interval of 15 On windows this will make it much more accurate Reviewed-by: ogoffart --- src/corelib/animation/qabstractanimation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index a4c7e29..7fa3ae3 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -156,7 +156,8 @@ #ifndef QT_NO_ANIMATION -#define DEFAULT_TIMER_INTERVAL 16 +//with 15 ms we get more accuracy on windows (it uses the multimedia timer) +#define DEFAULT_TIMER_INTERVAL 15 #define STARTSTOP_TIMER_DELAY 0 QT_BEGIN_NAMESPACE -- cgit v0.12 From 99bbe6fa6c2322449bb8ab7dda09c53b18cde68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 2 Nov 2009 14:13:05 +0100 Subject: Minor doc fixes for QGLContext::BindOption. Reviewed-by: Gunnar Sletta --- src/opengl/qgl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 2a57468..6370afd 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1773,10 +1773,12 @@ Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg() /*! \enum QGLContext::BindOption + \since 4.6 + A set of options to decide how to bind a texture using bindTexture(). \value NoBindOption Don't do anything, pass the texture straight - thru. + through. \value InvertedYBindOption Specifies that the texture should be flipped over the X axis so that the texture coordinate 0,0 corresponds to -- cgit v0.12 From 5b21746da4899a7d6dd78cf949e0a918c127fd49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Wed, 26 Aug 2009 13:13:36 +0200 Subject: Fix a freeze in QFileDialog (Mac) Running an open file dialog, for example with QFileDialog::getOpenFileName() can lead to a freeze if the user selects a folder, then selects a file in the parent folder and finally confirms the open dialog. Merge-request: 1327 Reviewed-by: Richard Moe Gustavsen --- src/gui/dialogs/qfiledialog_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 3914ab1..8bca025 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -819,8 +819,8 @@ void QFileDialogPrivate::qt_mac_filedialog_event_proc(const NavEventCallbackMess || mode == QFileDialog::ExistingFiles){ // When changing directory, the current selection is cleared if // we are supposed to be selecting files only: - fileDialogPrivate->mCurrentSelectionList.clear(); if (!fileDialogPrivate->mCurrentSelection.isEmpty()){ + fileDialogPrivate->mCurrentSelectionList.clear(); fileDialogPrivate->mCurrentSelection.clear(); emit fileDialogPrivate->q_func()->currentChanged(fileDialogPrivate->mCurrentSelection); } -- cgit v0.12 From e6da35f6055d3ae7acf38d89456d3047f055a9cd Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 2 Nov 2009 14:07:15 +0100 Subject: QStyleSheetStyle: ItemViews: Fixes drawing of items and branches. I am not sure why the code was there, but after some testing, it is better to remove it: - While painting the branch, we should not look at the ::item pseudo class at all. - Items specific stuff is drawn in PE_PanelItemViewItem, not PE_PanelItemViewRow - Selection is handled his way by the native style. background-color is not for selection and should not depends on SH_ItemView_ShowDecorationSelected Reviewed-by: Thierry Task-number: QTBUG-5228 Task-number: 258382 Task-number: QTBUG-4338 --- src/gui/styles/qstylesheetstyle.cpp | 30 +--- .../uiloader/baseline/css_itemview_task258382.ui | 179 +++++++++++++++++++++ 2 files changed, 180 insertions(+), 29 deletions(-) create mode 100644 tests/auto/uiloader/baseline/css_itemview_task258382.ui diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 32f259b..a224218 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -4277,23 +4277,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op p->fillRect(v2->rect, v2->palette.alternateBase()); subRule.drawRule(p, opt->rect); } else { - QStyleOptionViewItemV2 v2Copy(*v2); - if (v2->showDecorationSelected) { - QRenderRule subRule2 = renderRule(w, opt, PseudoElement_ViewItem); - if (v2->state & QStyle::State_Selected) { - subRule2.configurePalette(&v2Copy.palette, QPalette::NoRole, QPalette::Highlight); - } else if (v2->features & QStyleOptionViewItemV2::Alternate) { - subRule2.configurePalette(&v2Copy.palette, QPalette::NoRole, QPalette::AlternateBase); - } else if (subRule2.hasBackground()) { - p->fillRect(v2->rect, subRule2.background()->brush); - } - } else if (v2->features & QStyleOptionViewItemV2::Alternate) { - quint64 pc = v2->state & QStyle::State_Enabled ? PseudoClass_Enabled : PseudoClass_Disabled; - pc |= PseudoClass_Alternate; - QRenderRule subRule2 = renderRule(w, PseudoElement_ViewItem, pc); - subRule2.configurePalette(&v2Copy.palette, QPalette::NoRole, QPalette::AlternateBase); - } - baseStyle()->drawPrimitive(pe, &v2Copy, p, w); + baseStyle()->drawPrimitive(pe, v2, p, w); } } return; @@ -4358,18 +4342,6 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op break; case PE_PanelItemViewItem: - if (!styleHint(SH_ItemView_ShowDecorationSelected, opt, w)) { - rect = subElementRect(QStyle::SE_ItemViewItemText, opt, w) - | subElementRect(QStyle::SE_ItemViewItemDecoration, opt, w) - | subElementRect(QStyle::SE_ItemViewItemCheckIndicator, opt, w); - } - pseudoElement = PseudoElement_ViewItem; - break; - - case PE_PanelItemViewRow: - ParentStyle::drawPrimitive(pe, opt, p, w); - if (!styleHint(SH_ItemView_ShowDecorationSelected, opt, w)) - return; pseudoElement = PseudoElement_ViewItem; break; diff --git a/tests/auto/uiloader/baseline/css_itemview_task258382.ui b/tests/auto/uiloader/baseline/css_itemview_task258382.ui new file mode 100644 index 0000000..11c56b4 --- /dev/null +++ b/tests/auto/uiloader/baseline/css_itemview_task258382.ui @@ -0,0 +1,179 @@ + + + Form + + + + 0 + 0 + 437 + 352 + + + + Form + + + ::item { border: 1px solid black; background-color: purple; } +::item {margin-left: 20px; } + +QAbstractItemView { selection-background-color: red; +show-decoration- selected: 0; + } + +::item:selected { background-color: yellow; } + + + + + + + 1 + + + + + New Column + + + + + New Item + + + + + New Item + + + + + New Item + + + + New Subitem + + + + New Subitem + + + + + New Item + + + + + New Item + + + + + + + + + + + New Row + + + + + New Row + + + + + New Row + + + + + New Row + + + + + New Row + + + + + New Column + + + + + New Column + + + + + New Column + + + + + New Column + + + + + mljkh mh mjl + + + + + h jlh mjklh + + + + + mjklh mlhj mjlh m + + + + + mlhj lmhj + + + + + mlkj l + + + + + mlkj + + + + + mlkj lmkj + + + + + mlkhj mlh + + + + + mlkj lmkj + + + + + mlkj lmkj + + + + + + + + + -- cgit v0.12 From 56da3aca1fc8a7c269acf3cf1d4c3586ea8cdfd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Mon, 2 Nov 2009 15:37:17 +0200 Subject: QS60Style - TabWidget text changes color when widget becomes dimmed Style sets the tabWidget palette hash only for QPalette::Active. So, when widget becomes disabled, text color changes back to default. Task-number: QTBUG-4625 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 48f7042..949dfcb 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -743,7 +743,7 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const const QColor mainAreaTextColor = s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0); - widgetPalette.setColor(QPalette::All, QPalette::WindowText, + widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); QApplication::setPalette(widgetPalette, "QSlider"); // return to original palette after each widget @@ -767,34 +767,34 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const QApplication::setPalette(widgetPalette, "QHeaderView"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::ButtonText, + widgetPalette.setColor(QPalette::ButtonText, s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); QApplication::setPalette(widgetPalette, "QMenuBar"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::Active, QPalette::WindowText, + widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); QApplication::setPalette(widgetPalette, "QTabBar"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::Text, + widgetPalette.setColor(QPalette::Text, s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); QApplication::setPalette(widgetPalette, "QTableView"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + widgetPalette.setColor(QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QLineEdit"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::Text, + widgetPalette.setColor(QPalette::Text, s60Color(QS60StyleEnums::CL_QsnTextColors, 34, 0)); - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + widgetPalette.setColor(QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QTextEdit"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + widgetPalette.setColor(QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QComboBox"); widgetPalette = *palette; -- cgit v0.12 From 298e0d28106fd7ef3fe7232c71dd05a57b5d1d90 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 2 Nov 2009 15:35:56 +0200 Subject: Re-added checking for existence of sqlite3 binaries to Symbian builds Always adding export for sqlite3 binaries will cause cleanup of platform provided versions on platforms that provide them. Fixed by adding check for existence of sqlite3.dso before adding the export statement to bld.inf. Task-number: QT-2419 Reviewed-by: Janne Koskinen --- src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro index 4734144..158633d 100644 --- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro +++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro @@ -1,5 +1,7 @@ # Use subdirs template to suppress generation of unnecessary files TEMPLATE = subdirs -# We just want to extract the zip file containing sqlite binaries for Symbian -BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" +# We just want to export the sqlite3 binaries for Symbian for platforms that do not have them. +!exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) { + BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" +} -- cgit v0.12 From 5f7d92b32e375aa7c2d0acf69d1fc033c6fd476a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 2 Nov 2009 14:54:23 +0100 Subject: Disable the move-by-scrolling optimization. The current implementation fails when moving the widget onto an area that has just been exposed as a part of a window resize operation. --- src/gui/kernel/qwidget_mac.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index db11815..89f2d02 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3756,7 +3756,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget *w) /* Modifies the bounds for a widgets backing HIView during moves and resizes. Also updates the widget, either by scrolling its contents or repainting, depending on the WA_StaticContents - and QWidgetPrivate::isOpaque flags. + flag */ static void qt_mac_update_widget_posisiton(QWidget *q, QRect oldRect, QRect newRect) { @@ -3773,8 +3773,8 @@ static void qt_mac_update_widget_posisiton(QWidget *q, QRect oldRect, QRect newR // Perform a normal (complete repaint) update in some cases: if ( - // move-by-scroll requires QWidgetPrivate::isOpaque set - (isMove && q->testAttribute(Qt::WA_OpaquePaintEvent) == false) || + // always repaint on move. + (isMove) || // limited update on resize requires WA_StaticContents. (isResize && q->testAttribute(Qt::WA_StaticContents) == false) || -- cgit v0.12 From 8d01f436451071a917c147a96a979ccdaee106f9 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 2 Nov 2009 14:49:33 +0100 Subject: QCSSParser: Fixes the way spaces are handled in font family. We cannot simplify spaces because a font may have several spaces in its name. If we only add spaces when needed when merging tokens, we don't need to simplyfy the string later The CSS tokenizer will already make sure that spaces are removed if there is no quotes (btw, the CSS specification says that there must be quotes if there is spaces, but we tollerate if there is no quotes) Reviewed-by: Jocelyn Turcotte Task-number: QTBUG-4344 Task-number: 258586 --- src/gui/text/qcssparser.cpp | 7 +++++-- tests/auto/qcssparser/tst_qcssparser.cpp | 3 +++ tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp | 10 ++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 6db86bd..93b9fc6 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1129,19 +1129,22 @@ static bool setFontWeightFromValue(const Value &value, QFont *font) static bool setFontFamilyFromValues(const QVector &values, QFont *font, int start = 0) { QString family; + bool shouldAddSpace = false; for (int i = start; i < values.count(); ++i) { const Value &v = values.at(i); if (v.type == Value::TermOperatorComma) { family += QLatin1Char(','); + shouldAddSpace = false; continue; } const QString str = v.variant.toString(); if (str.isEmpty()) break; + if (shouldAddSpace) + family += QLatin1Char(' '); family += str; - family += QLatin1Char(' '); + shouldAddSpace = true; } - family = family.simplified(); if (family.isEmpty()) return false; font->setFamily(family); diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp index 150f131..3580252 100644 --- a/tests/auto/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/qcssparser/tst_qcssparser.cpp @@ -1556,8 +1556,11 @@ void tst_QCssParser::extractFontFamily_data() QTest::newRow("shorthand") << "font: 12pt Times New Roman" << QString("Times New Roman"); QTest::newRow("shorthand multiple quote") << "font: 12pt invalid, \"Times New Roman\" " << QString("Times New Roman"); QTest::newRow("shorthand multiple") << "font: 12pt invalid, Times New Roman " << QString("Times New Roman"); + QTest::newRow("invalid spaces") << "font-family: invalid spaces, Times New Roman " << QString("Times New Roman"); + QTest::newRow("invalid spaces quotes") << "font-family: 'invalid spaces', 'Times New Roman' " << QString("Times New Roman"); } + void tst_QCssParser::extractFontFamily() { QFETCH(QString, css); diff --git a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 8c4d8fd..4dc732c 100644 --- a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -2197,6 +2197,16 @@ void tst_QTextDocumentFragment::html_quotedFontFamily() setHtml("
Test
"); QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar")); + + setHtml("
Test
"); + QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar")); + + setHtml("
Test
"); + QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar")); + + setHtml("
Test
"); + QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar,serif,bar foo")); + } void tst_QTextDocumentFragment::defaultFont() -- cgit v0.12 From 8abe466caa1b38f4cc1f95fba83d5e61e611e931 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 2 Nov 2009 15:45:49 +0100 Subject: Make the combobox emit activated when it loses focus Task-number: QTBUG-1071 Reviewed-by: ogoffart --- src/gui/widgets/qcombobox.cpp | 37 ++++++++++++++++++++++++++-------- src/gui/widgets/qcombobox.h | 1 + src/gui/widgets/qcombobox_p.h | 2 ++ tests/auto/qcombobox/tst_qcombobox.cpp | 31 ++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 1879db4..bd1d8ba 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -1111,6 +1111,32 @@ void QComboBoxPrivate::updateLineEditGeometry() lineEdit->setGeometry(editRect); } +Qt::MatchFlags QComboBoxPrivate::matchFlags() const +{ + // Base how duplicates are determined on the autocompletion case sensitivity + Qt::MatchFlags flags = Qt::MatchFixedString; +#ifndef QT_NO_COMPLETER + if (!lineEdit->completer() || lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive) +#endif + flags |= Qt::MatchCaseSensitive; + return flags; +} + + +void QComboBoxPrivate::_q_editingFinished() +{ + Q_Q(QComboBox); + if (lineEdit && !lineEdit->text().isEmpty()) { + //here we just check if the current item was entered + const int index = q_func()->findText(lineEdit->text(), matchFlags()); + if (index != -1 && itemText(currentIndex) != lineEdit->text()) { + q->setCurrentIndex(index); + emitActivated(currentIndex); + } + } + +} + void QComboBoxPrivate::_q_returnPressed() { Q_Q(QComboBox); @@ -1123,13 +1149,7 @@ void QComboBoxPrivate::_q_returnPressed() // check for duplicates (if not enabled) and quit int index = -1; if (!duplicatesEnabled) { - // Base how duplicates are determined on the autocompletion case sensitivity - Qt::MatchFlags flags = Qt::MatchFixedString; -#ifndef QT_NO_COMPLETER - if (!lineEdit->completer() || lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive) -#endif - flags |= Qt::MatchCaseSensitive; - index = q->findText(text, flags); + index = q->findText(text, matchFlags()); if (index != -1) { q->setCurrentIndex(index); emitActivated(currentIndex); @@ -1664,6 +1684,7 @@ void QComboBox::setLineEdit(QLineEdit *edit) if (d->lineEdit->parent() != this) d->lineEdit->setParent(this); connect(d->lineEdit, SIGNAL(returnPressed()), this, SLOT(_q_returnPressed())); + connect(d->lineEdit, SIGNAL(editingFinished()), this, SLOT(_q_editingFinished())); connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(editTextChanged(QString))); #ifdef QT3_SUPPORT connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged(QString))); @@ -1960,7 +1981,7 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi) if (lineEdit) { QString newText = q->itemText(currentIndex.row()); if (lineEdit->text() != newText) - lineEdit->setText(q->itemText(currentIndex.row())); + lineEdit->setText(newText); updateLineEditGeometry(); } if (indexChanged) { diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index 4089a09..485e562 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -305,6 +305,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_itemSelected(const QModelIndex &item)) Q_PRIVATE_SLOT(d_func(), void _q_emitHighlighted(const QModelIndex &)) Q_PRIVATE_SLOT(d_func(), void _q_emitCurrentIndexChanged(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_editingFinished()) Q_PRIVATE_SLOT(d_func(), void _q_returnPressed()) Q_PRIVATE_SLOT(d_func(), void _q_resetButton()) Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &, const QModelIndex &)) diff --git a/src/gui/widgets/qcombobox_p.h b/src/gui/widgets/qcombobox_p.h index fe42c47..f6ba57c 100644 --- a/src/gui/widgets/qcombobox_p.h +++ b/src/gui/widgets/qcombobox_p.h @@ -342,6 +342,8 @@ public: void init(); QComboBoxPrivateContainer* viewContainer(); void updateLineEditGeometry(); + Qt::MatchFlags matchFlags() const; + void _q_editingFinished(); void _q_returnPressed(); void _q_complete(); void _q_itemSelected(const QModelIndex &item); diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 51a7ff8..06c632d 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #ifdef Q_WS_MAC #include #elif defined Q_WS_X11 @@ -154,6 +155,7 @@ private slots: void removeItem(); void resetModel(); void keyBoardNavigationWithMouse(); + void task_QTBUG_1071_changingFocusEmitsActivated(); protected slots: void onEditTextChanged( const QString &newString ); @@ -813,21 +815,25 @@ void tst_QComboBox::autoCompletionCaseSensitivity() // case insensitive testWidget->clearEditText(); + QSignalSpy spyReturn(testWidget, SIGNAL(activated(int))); testWidget->setAutoCompletionCaseSensitivity(Qt::CaseInsensitive); QVERIFY(testWidget->autoCompletionCaseSensitivity() == Qt::CaseInsensitive); QTest::keyClick(testWidget->lineEdit(), Qt::Key_A); qApp->processEvents(); QCOMPARE(testWidget->currentText(), QString("aww")); + QCOMPARE(spyReturn.count(), 0); QTest::keyClick(testWidget->lineEdit(), Qt::Key_B); qApp->processEvents(); // autocompletions preserve userkey-case from 4.2 QCOMPARE(testWidget->currentText(), QString("abCDEF")); + QCOMPARE(spyReturn.count(), 0); QTest::keyClick(testWidget->lineEdit(), Qt::Key_Enter); qApp->processEvents(); QCOMPARE(testWidget->currentText(), QString("aBCDEF")); // case restored to item's case + QCOMPARE(spyReturn.count(), 1); testWidget->clearEditText(); QTest::keyClick(testWidget->lineEdit(), 'c'); @@ -2500,6 +2506,31 @@ void tst_QComboBox::keyBoardNavigationWithMouse() QTRY_COMPARE(combo.currentText(), QString::number(final)); } +void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated() +{ + QWidget w; + QVBoxLayout layout(&w); + QComboBox cb; + cb.setEditable(true); + QSignalSpy spy(&cb, SIGNAL(activated(int))); + cb.addItem("0"); + cb.addItem("1"); + cb.addItem("2"); + QLineEdit edit; + layout.add(&cb); + layout.add(&edit); + + w.show(); + QTest::qWaitForWindowShown(&w); + cb.clearEditText(); + cb.setFocus(); + QApplication::processEvents(); + QTest::keyClick(0, '1'); + QCOMPARE(spy.count(), 0); + edit.setFocus(); + QTRY_VERIFY(edit.hasFocus()); + QCOMPARE(spy.count(), 1); +} QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" -- cgit v0.12 From f1132e60e0759d8be043a2c4312915b3103004ff Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Mon, 2 Nov 2009 15:34:15 +0100 Subject: Titlebar icon (for e.g. Assistant) not visible in Cocoa. standardWindowButton:NSWindowDocumentIconButton will not return a valid NSButton unless you call setRepresentedURL or setRepresentedFilename for the NSWindow. This patch makes sure that setWindowIcon_sys() sets the icon using a valid NSButton. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoawindowdelegate_mac.mm | 23 +++++++++++++++++++++++ src/gui/kernel/qcocoawindowdelegate_mac_p.h | 2 ++ src/gui/kernel/qwidget_mac.mm | 6 ++++++ 3 files changed, 31 insertions(+) diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 95c89e5..803a1b1 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -346,5 +346,28 @@ static void cleanupCocoaWindowDelegate() m_drawerHash->remove(drawer); } +- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu +{ + Q_UNUSED(menu); + QWidget *qwidget = m_windowHash->value(window); + if (qwidget && !qwidget->windowFilePath().isEmpty()) { + return YES; + } + return NO; +} + +- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event + from:(NSPoint)dragImageLocation + withPasteboard:(NSPasteboard *)pasteboard +{ + Q_UNUSED(event); + Q_UNUSED(dragImageLocation); + Q_UNUSED(pasteboard); + QWidget *qwidget = m_windowHash->value(window); + if (qwidget && !qwidget->windowFilePath().isEmpty()) { + return YES; + } + return NO; +} @end #endif// QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/gui/kernel/qcocoawindowdelegate_mac_p.h index a06c516..3728002 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h +++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h @@ -76,6 +76,8 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData) - (void)windowDidResignMain:(NSNotification*)notification; - (void)windowDidBecomeKey:(NSNotification*)notification; - (void)windowDidResignKey:(NSNotification*)notification; +- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu; +- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard; @end @protocol NSDrawerDelegate diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 58252ca..79f55a1 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3017,6 +3017,12 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) #else QMacCocoaAutoReleasePool pool; NSButton *iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton]; + if (iconButton == nil) { + QCFString string(q->windowTitle()); + const NSString *tmpString = reinterpret_cast((CFStringRef)string); + [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:tmpString]]; + iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton]; + } if (icon.isNull()) { [iconButton setImage:nil]; } else { -- cgit v0.12 From ab473d6a8e4fa619537c4cdaaf1b6a9d8544b30a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 2 Nov 2009 15:30:55 +0100 Subject: Fixed holes in thick strokes. When stroking small paths with a thick pen, it looked like the winding fill rule was ignored. The bug was in the stroke generator which generated paths where the winding number could incorrectly become zero. Task-number: QTBUG-1537 Reviewed-by: Gunnar --- src/gui/painting/qstroker.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index c57b3c1..228a6b1 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -452,6 +452,17 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine #endif if (join == FlatJoin) { + QLineF prevLine(qt_fixed_to_real(m_back2X), qt_fixed_to_real(m_back2Y), + qt_fixed_to_real(m_back1X), qt_fixed_to_real(m_back1Y)); + QPointF isect; + QLineF::IntersectType type = prevLine.intersect(nextLine, &isect); + QLineF shortCut(prevLine.p2(), nextLine.p1()); + qreal angle = shortCut.angleTo(prevLine); + if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); + emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); + return; + } emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); @@ -468,8 +479,8 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine // If we are on the inside, do the short cut... QLineF shortCut(prevLine.p2(), nextLine.p1()); qreal angle = shortCut.angleTo(prevLine); - if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); return; } @@ -509,8 +520,9 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine qfixed offset = m_strokeWidth / 2; QLineF shortCut(prevLine.p2(), nextLine.p1()); - qreal angle = prevLine.angle(shortCut); + qreal angle = shortCut.angleTo(prevLine); if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); return; } @@ -581,6 +593,13 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine qt_real_to_fixed(l1.x1()), qt_real_to_fixed(l1.y1())); } else if (join == SvgMiterJoin) { + QLineF shortCut(prevLine.p2(), nextLine.p1()); + qreal angle = shortCut.angleTo(prevLine); + if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); + emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); + return; + } QLineF miterLine(QPointF(qt_fixed_to_real(focal_x), qt_fixed_to_real(focal_y)), isect); if (miterLine.length() > qt_fixed_to_real(m_strokeWidth * m_miterLimit) / 2) { -- cgit v0.12 From 11dea4a8b227801c110f791f350632bf6f0c958d Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 2 Nov 2009 15:25:19 +0100 Subject: Fixed spacing display in QListView with wrapped text. The spacing was not being substracted from the viewport width when calculating the available space for items. Auto-test included. Reviewed-by: Olivier Task-number: QTBUG-2678 --- src/gui/itemviews/qlistview.cpp | 10 +++++----- tests/auto/qlistview/tst_qlistview.cpp | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index d680af8..15db9a6 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -357,7 +357,7 @@ QListView::LayoutMode QListView::layoutMode() const /*! \property QListView::spacing - \brief the space between items in the layout + \brief the space around the items in the layout This property is the size of the empty space that is padded around an item in the layout. @@ -972,9 +972,9 @@ void QListView::paintEvent(QPaintEvent *e) option.rect = visualRect(*it); if (flow() == TopToBottom) - option.rect.setWidth(qMin(viewport()->size().width(), option.rect.width())); + option.rect.setWidth(qMin(viewport()->size().width() - 2 * d->spacing(), option.rect.width())); else - option.rect.setHeight(qMin(viewport()->size().height(), option.rect.height())); + option.rect.setHeight(qMin(viewport()->size().height() - 2 * d->spacing(), option.rect.height())); option.state = state; if (selections && selections->isSelected(*it)) @@ -1837,14 +1837,14 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) { horizontalScrollBar()->setSingleStep(step.width() + spacing()); horizontalScrollBar()->setPageStep(viewport()->width()); - horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width()); + horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width() - 2 * spacing()); } void QCommonListViewBase::updateVerticalScrollBar(const QSize &step) { verticalScrollBar()->setSingleStep(step.height() + spacing()); verticalScrollBar()->setPageStep(viewport()->height()); - verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height()); + verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height() - 2 * spacing()); } void QCommonListViewBase::scrollContentsBy(int dx, int dy, bool /*scrollElasticBand*/) diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index a5ff153..246f092 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -121,6 +121,7 @@ private slots: void taskQTBUG_2233_scrollHiddenItems(); void taskQTBUG_633_changeModelData(); void taskQTBUG_435_deselectOnViewportClick(); + void taskQTBUG_2678_spacingAndWrappedText(); }; // Testing get/set functions @@ -1876,5 +1877,19 @@ void tst_QListView::taskQTBUG_435_deselectOnViewportClick() QVERIFY(!view.selectionModel()->hasSelection()); } +void tst_QListView::taskQTBUG_2678_spacingAndWrappedText() +{ + static const QString lorem("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); + QStringListModel model(QStringList() << lorem << lorem << "foo" << lorem << "bar" << lorem << lorem); + QListView w; + w.setModel(&model); + w.setViewMode(QListView::ListMode); + w.setWordWrap(true); + w.setSpacing(10); + w.show(); + QTest::qWaitForWindowShown(&w); + QCOMPARE(w.horizontalScrollBar()->minimum(), w.horizontalScrollBar()->maximum()); +} + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" -- cgit v0.12 From 243163c3f61c79146c37da0a4da4bacafa8e1321 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 2 Nov 2009 16:06:06 +0100 Subject: Fixed test, QGraphicsSourceEffect::pixmap(), caching caused failure. Reviewed-by: Samuel --- src/gui/effects/qgraphicseffect.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 3a6bab5..f24d424 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -97,6 +97,8 @@ */ #include "qgraphicseffect_p.h" +#include "private/qgraphicsitem_p.h" + #include #include @@ -260,6 +262,12 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse return ((QGraphicsPixmapItem *) item)->pixmap(); } + if (system == Qt::DeviceCoordinates && item + && !static_cast(d_func())->info) { + qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); + return QPixmap(); + } + QPixmap pm; if (d->m_cachedSystem == system && d->m_cachedMode == mode) QPixmapCache::find(d->m_cacheKey, &pm); -- cgit v0.12 From 915f20bb167aa09ca8c8db478a2a78d5e357b67e Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 2 Nov 2009 16:58:56 +0100 Subject: Better cosmetic pen scaling for beziers in tristroker. Reviewed-By: Samuel --- src/opengl/gl2paintengineex/qtriangulatingstroker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index ad18a51..1163eba 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -114,7 +114,7 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen) if (m_join_style == Qt::RoundJoin) m_join_style = Qt::MiterJoin; m_curvyness_add = 0.5; - m_curvyness_mul = CURVE_FLATNESS; + m_curvyness_mul = CURVE_FLATNESS / m_inv_scale; m_roundness = 1; } else if (cosmetic) { m_curvyness_add = realWidth / 2; -- cgit v0.12 From b72d41cf30f82c74c10c31808907cc990c86efe6 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 3 Nov 2009 08:23:18 +1000 Subject: Protect the OpenVG engine from null QPixmapData objects Reviewed-by: Sarah Smith --- src/openvg/qpaintengine_vg.cpp | 10 ++++++++++ src/openvg/qpixmapdata_vg.cpp | 2 ++ src/openvg/qpixmapfilter_vg.cpp | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 8a485a0..047d9d8 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1178,6 +1178,8 @@ VGPaintType QVGPaintEnginePrivate::setBrush case Qt::TexturePattern: { // The brush is a texture specified by a QPixmap/QImage. QPixmapData *pd = brush.texture().pixmapData(); + if (!pd) + break; // null QPixmap VGImage vgImg; bool deref = false; if (pd->pixelType() == QPixmapData::BitmapType) { @@ -2893,6 +2895,8 @@ void qt_vg_drawVGImageStencil void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { QPixmapData *pd = pm.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { Q_D(QVGPaintEngine); QVGPixmapData *vgpd = static_cast(pd); @@ -2910,6 +2914,8 @@ void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF void QVGPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) { QPixmapData *pd = pm.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { Q_D(QVGPaintEngine); QVGPixmapData *vgpd = static_cast(pd); @@ -2985,6 +2991,8 @@ void QVGPaintEngine::drawPixmaps // If the pixmap is not VG, or the transformation is projective, // then fall back to the default implementation. QPixmapData *pd = pixmap.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) { QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints); return; @@ -3581,6 +3589,8 @@ void QVGCompositionHelper::drawCursorPixmap // Fetch the VGImage from the pixmap if possible. QPixmapData *pd = pixmap.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast(pd); if (vgpd->isValid()) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index f86e116..3254aa3 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -369,6 +369,8 @@ QImage::Format QVGPixmapData::sourceFormat() const Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap) { QPixmapData *pd = pixmap.pixmapData(); + if (!pd) + return VG_INVALID_HANDLE; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast(pd); if (vgpd->isValid()) diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp index 8e104db..e17c728 100644 --- a/src/openvg/qpixmapfilter_vg.cpp +++ b/src/openvg/qpixmapfilter_vg.cpp @@ -65,6 +65,9 @@ void QVGPixmapConvolutionFilter::draw (QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default convolution filter implementation. @@ -135,6 +138,9 @@ QVGPixmapColorizeFilter::~QVGPixmapColorizeFilter() void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default colorize filter implementation. @@ -225,6 +231,9 @@ QVGPixmapDropShadowFilter::~QVGPixmapDropShadowFilter() void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default drop shadow filter implementation. @@ -290,6 +299,9 @@ QVGPixmapBlurFilter::~QVGPixmapBlurFilter() void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default blur filter implementation. -- cgit v0.12 From 02b16c259cf268903823304e02d308cbbd043194 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 2 Nov 2009 15:46:53 +0100 Subject: Cocoa: fix double emit bug from file dialog For some reason, Cocoa tells us twize whenever a selection change occurs in the native file dialog. This patch inserts a check that the selection actually changed before emitting any signals Rev-By: Prasanth --- src/gui/dialogs/qfiledialog_mac.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index d9bec27..4af5688 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -399,9 +399,13 @@ QT_USE_NAMESPACE - (void)panelSelectionDidChange:(id)sender { Q_UNUSED(sender); - *mCurrentSelection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename])); - if (mPriv) - mPriv->QNSOpenSavePanelDelegate_selectionChanged(*mCurrentSelection); + if (mPriv) { + QString selection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename])); + if (selection != mCurrentSelection) { + *mCurrentSelection = selection; + mPriv->QNSOpenSavePanelDelegate_selectionChanged(selection); + } + } } - (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo -- cgit v0.12 From e7a10b00be3e4aa197900ecf424e6d44b07248ae Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 20 Oct 2009 18:03:10 +0300 Subject: Fixed QGraphicsScene::clear() not to crash if related top level items happen to delete each others. Merge-Request: 1863 Reviewed-by: Andreas Reviewed-by: Olivier --- src/gui/graphicsview/qgraphicsscene.cpp | 5 +++-- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a62e486..a4965e4 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -2292,8 +2292,9 @@ void QGraphicsScene::clear() // NB! We have to clear the index before deleting items; otherwise the // index might try to access dangling item pointers. d->index->clear(); - const QList items = d->topLevelItems; - qDeleteAll(items); + // NB! QGraphicsScenePrivate::unregisterTopLevelItem() removes items + while (!d->topLevelItems.isEmpty()) + delete d->topLevelItems.first(); Q_ASSERT(d->topLevelItems.isEmpty()); d->lastItemCount = 0; d->allItemsIgnoreHoverEvents = true; diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 0589994..4f76ddd 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -1453,6 +1453,13 @@ void tst_QGraphicsScene::focusItemLostFocus() item->clearFocus(); } +class ClearTestItem : public QGraphicsRectItem +{ +public: + ~ClearTestItem() { qDeleteAll(items); } + QList items; +}; + void tst_QGraphicsScene::clear() { QGraphicsScene scene; @@ -1463,6 +1470,19 @@ void tst_QGraphicsScene::clear() scene.clear(); QVERIFY(scene.items().isEmpty()); QCOMPARE(scene.sceneRect(), QRectF(0, 0, 100, 100)); + + ClearTestItem *firstItem = new ClearTestItem; + QGraphicsItem *secondItem = new QGraphicsRectItem; + firstItem->items += secondItem; + + scene.setItemIndexMethod(QGraphicsScene::NoIndex); + scene.addItem(firstItem); + scene.addItem(secondItem); + QCOMPARE(scene.items().at(0), firstItem); + QCOMPARE(scene.items().at(1), secondItem); + // must not crash even if firstItem deletes secondItem + scene.clear(); + QVERIFY(scene.items().isEmpty()); } void tst_QGraphicsScene::setFocusItem() -- cgit v0.12 From 4eff66941486568cd25dc9aaa372f9d36b84dad8 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 10:05:11 +0100 Subject: doc: Polish documentation for state machine framework Fix some examples and wording, and add some clarification based on comments in documentation review session. Reviewed-by: Kent Hansen --- doc/src/frameworks-technologies/statemachine.qdoc | 104 +++++++++++----------- doc/src/snippets/statemachine/main2.cpp | 11 +-- doc/src/snippets/statemachine/main5.cpp | 44 +++++++-- 3 files changed, 93 insertions(+), 66 deletions(-) diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index ed8bc85..ac10314 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -75,6 +75,11 @@ states can be configured to set properties and invoke methods on QObjects. Qt's event system is used to drive the state machines. + The state graph in the State Machine framework is hierarchical. States can be nested inside of + other states, and the current configuration of the state machine consists of the set of states + which are currently active. All the states in a valid configuration of the state machine will + have a common ancestor. + \section1 Classes in the State Machine Framework These classes are provided by qt for creating event-driven state machines. @@ -269,9 +274,17 @@ When a parallel state group is entered, all its child states will be simultaneously entered. Transitions within the individual child states - operate normally. However, any of the child states may take a transition - outside the parent state. When this happens, the parent state and all of its - child states are exited. + operate normally. However, any of the child states may take a transition which exits the parent + state. When this happens, the parent state and all of its child states are exited. + + The parallelism in the State Machine framework follows an interleaved semantics. All parallel + operations will be executed in a single, atomic step of the event processing, so no event can + interrupt the parallel operations. However, events will still be processed sequentially, since + the machine itself is single threaded. As an example: Consider the situation where there are two + transitions that exit the same parallel state group, and their conditions become true + simultaneously. In this case, the event that is processed last of the two will not have any + effect, since the first event will already have caused the machine to exit from the parallel + state. \section1 Detecting that a Composite State has Finished @@ -414,16 +427,7 @@ Take the following code: \code - QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); - - QState *s1 = new QState(); - s1->assignProperty(object, "fooBar", 1.0); - machine.addState(s1); - machine.setInitialState(s1); - - QState *s2 = new QState(); - machine.addState(s2); + \snippet doc/src/snippets/statemachine/main5.cpp 0 \endcode Lets say the property \c fooBar is 0.0 when the machine starts. When the machine is in state @@ -434,19 +438,7 @@ If we are using nested states, the parent defines a value for the property which is inherited by all descendants that do not explicitly assign a value to the property. \code - QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); - - QState *s1 = new QState(); - s1->assignProperty(object, "fooBar", 1.0); - machine.addState(s1); - machine.setInitialState(s1); - - QState *s2 = new QState(s1); - s2->assignProperty(object, "fooBar", 2.0); - s1->setInitialState(s2); - - QState *s3 = new QState(s1); + \snippet doc/src/snippets/statemachine/main5.cpp 2 \endcode Here \c s1 has two children: \c s2 and \c s3. When \c s2 is entered, the property \c fooBar @@ -461,13 +453,7 @@ Say we have the following code: \code - QState *s1 = new QState(); - QState *s2 = new QState(); - - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); - s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); - - s1->addTransition(button, SIGNAL(clicked()), s2); + \snippet doc/src/snippets/statemachine/main5.cpp 3 \endcode Here we define two states of a user interface. In \c s1 the \c button is small, and in \c s2 @@ -477,14 +463,7 @@ object. \code - QState *s1 = new QState(); - QState *s2 = new QState(); - - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); - s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); - - QSignalTransition *transition = s1->addTransition(button, SIGNAL(clicked()), s2); - transition->addAnimation(new QPropertyAnimation(button, "geometry")); + \snippet doc/src/snippets/statemachine/main5.cpp 4 \endcode Adding an animation for the property in question means that the property assignment will no @@ -504,28 +483,45 @@ property can potentially have any value, depending on the animation. In some cases, it can be useful to be able to detect when the property has actually been assigned - the value defined by a state. For this, we can use the state's polished() signal. + the value defined by a state. + + Say we have the following code: \code - QState *s1 = new QState(); - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + \snippet doc/src/snippets/statemachine/main5.cpp 5 + \endcode - QState *s2 = new QState(); + When \c button is clicked, the machine will transition into state \c s2, which will set the + geometry of the button, and then pop up a message box to alert the user that the geometry has + been changed. + + In the normal case, where animations are not used, this will operate as expected. However, if + an animation for the \c geometry of \c button is set on the transition between \c s1 and \c s2, + the animation will be started when \c s2 is entered, but the \c geometry property will not + actually reach its defined value before the animation is finished running. In this case, the + message box will pop up before the geometry of the button has actually been set. - s1->addTransition(s1, SIGNAL(polished()), s2); + To ensure that the message box does not pop up until the geometry actually reaches its final + value, we can use the state's polished() signal. The polished() signal will be emitted when the + the property is assigned its final value, whether this is done immediately or after the animation + has finished playing. + \code + \snippet doc/src/snippets/statemachine/main5.cpp 6 \endcode - The machine will be in state \c s1 until the \c geometry property has been set. Then it will - immediately transition into \c s2. If the transition into \c s1 has an animation for the \c - geometry property, then the machine will stay in \c s1 until the animation has finished. If there - is no animation, it will simply set the property and immediately enter state \c s2. + In this example, when \c button is clicked, the machine will enter \c s2. It will remain in state + \c s2 until the \c geometry property has been set to \c QRect(0, 0, 50, 50). Then it will + transition into \c s3. When \c s3 is entered, the message box will pop up. If the transition into + \c s2 has an animation for the \c geometry property, then the machine will stay in \c s2 until the + animation has finished playing. If there is no such animation, it will simply set the property and + immediately enter state \c s3. - Either way, when the machine is in state \c s2, the property \c geometry has been assigned the - defined value. + Either way, when the machine is in state \c s3, you are guaranteed that the property \c geometry + has been assigned the defined value. If the global restore policy is set to QStateMachine::RestoreProperties, the state will not emit the polished() signal until these have been executed as well. - \section1 What happens if a state is exited before the animation has finished + \section1 What Happens If A State Is Exited Before The Animation Has Finished If a state has property assignments, and the transition into the state has animations for the properties, the state can potentially be exited before the properties have been assigned to the @@ -545,7 +541,7 @@ If the target state does not assign any value to the property, there are two options: By default, the property will be assigned the value defined by the state it is leaving - (the value it would have been assigned if the animation had been permitted to finish playing.) If + (the value it would have been assigned if the animation had been permitted to finish playing). If a global restore policy is set, however, this will take precedence, and the property will be restored as usual. diff --git a/doc/src/snippets/statemachine/main2.cpp b/doc/src/snippets/statemachine/main2.cpp index 2419dc2..9a2890f 100644 --- a/doc/src/snippets/statemachine/main2.cpp +++ b/doc/src/snippets/statemachine/main2.cpp @@ -69,17 +69,18 @@ int main(int argv, char **args) //![1] QButton *interruptButton = new QPushButton("Interrupt Button"); + QWidget *mainWindow = new QWidget(); //![3] QHistoryState *s1h = new QHistoryState(s1); QState *s3 = new QState(); s3->assignProperty(label, "text", "In s3"); - QMessageBox mbox; - mbox.addButton(QMessageBox::Ok); - mbox.setText("Interrupted!"); - mbox.setIcon(QMessageBox::Information); - QObject::connect(s3, SIGNAL(entered()), &mbox, SLOT(exec())); + QMessageBox *mbox = new QMessageBox(mainWindow); + mbox->addButton(QMessageBox::Ok); + mbox->setText("Interrupted!"); + mbox->setIcon(QMessageBox::Information); + QObject::connect(s3, SIGNAL(entered()), mbox, SLOT(exec())); s3->addTransition(s1h); machine.addState(s3); diff --git a/doc/src/snippets/statemachine/main5.cpp b/doc/src/snippets/statemachine/main5.cpp index a9d4091..346cbce 100644 --- a/doc/src/snippets/statemachine/main5.cpp +++ b/doc/src/snippets/statemachine/main5.cpp @@ -44,14 +44,13 @@ int main(int argv, char **args) { QApplication app(argv, args); + QWidget *button; { //![0] QStateMachine machine; machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); -//![0] -//![1] QState *s1 = new QState(); s1->assignProperty(object, "fooBar", 1.0); machine.addState(s1); @@ -59,7 +58,7 @@ int main(int argv, char **args) QState *s2 = new QState(); machine.addState(s2); -//![1] +//![0] } { @@ -110,21 +109,50 @@ int main(int argv, char **args) } { + QMainWindow *mainWindow = 0; //![5] + QMessageBox *messageBox = new QMessageBox(mainWindow); + messageBox->addButton(QMessageBox::Ok); + messageBox->setText("Button geometry has been set!"); + messageBox->setIcon(QMessageBox::Information); + QState *s1 = new QState(); - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); QState *s2 = new QState(); + s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + connect(s2, SIGNAL(entered()), messageBox, SLOT(exec())); - s1->addTransition(s1, SIGNAL(polished()), s2); + s1->addTransition(button, SIGNAL(clicked()), s2); //![5] - } { + QMainWindow *mainWindow = 0; + +//![6] + QMessageBox *messageBox = new QMessageBox(mainWindow); + messageBox->addButton(QMessageBox::Ok); + messageBox->setText("Button geometry has been set!"); + messageBox->setIcon(QMessageBox::Information); + + QState *s1 = new QState(); + + QState *s2 = new QState(); + s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + + QState *s3 = new QState(); + connect(s3, SIGNAL(entered()), messageBox, SLOT(exec())); + s1->addTransition(button, SIGNAL(clicked()), s2); + s2->addTransition(s2, SIGNAL(polished()), s3); //![6] + + } + + { + +//![7] QState *s1 = new QState(); QState *s2 = new QState(); @@ -134,10 +162,12 @@ int main(int argv, char **args) QStateMachine machine; machine.setInitialState(s1); machine.addDefaultAnimation(new QPropertyAnimation(object, "fooBar")); -//![6] +//![7] } + + return app.exec(); } -- cgit v0.12 From 553d7f7416eca57b63992a453ceb3b333749c11a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 28 Oct 2009 16:15:06 +0200 Subject: Introduced QGraphicsItem::ItemSendsScenePositionChanges and QGraphicsItem::ItemScenePositionHasChanged Merge-Request: 1945 Reviewed-By: Andreas --- src/gui/graphicsview/qgraphicsitem.cpp | 63 ++++++++++++++++++++-- src/gui/graphicsview/qgraphicsitem.h | 6 ++- src/gui/graphicsview/qgraphicsitem_p.h | 7 ++- src/gui/graphicsview/qgraphicsscene.cpp | 56 +++++++++++++++++++ src/gui/graphicsview/qgraphicsscene.h | 1 + src/gui/graphicsview/qgraphicsscene_p.h | 7 +++ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 74 ++++++++++++++++++++++++++ 7 files changed, 206 insertions(+), 8 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 4665916..93b9ba9 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -386,6 +386,12 @@ introduced in Qt 4.6. \omitvalue ItemIsFocusScope Internal only (for now). + + \value ItemSendsScenePositionChanges The item enables itemChange() + notifications for ItemScenePositionHasChanged. For performance reasons, + these notifications are disabled by default. You must enable this flag + to receive notifications for scene position changes. This flag was + introduced in Qt 4.6. */ /*! @@ -562,6 +568,14 @@ \value ItemOpacityHasChanged The item's opacity has changed. The value argument is the new opacity (i.e., a double). Do not call setOpacity() as this notification is delivered. The return value is ignored. + + \value ItemScenePositionHasChanged The item's scene position has changed. + This notification is sent if the ItemSendsScenePositionChanges flag is + enabled, and after the item's scene position has changed (i.e., the + position or transformation of the item itself or the position or + transformation of any ancestor has changed). The value argument is the + new scene position (the same as scenePos()), and QGraphicsItem ignores + the return value for this notification (i.e., a read-only notification). */ /*! @@ -990,6 +1004,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) if (scene) { // Deliver the change to the index scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParentVariant); + + // Disable scene pos notifications for old ancestors + if (scenePosDescendants || (flags & QGraphicsItem::ItemSendsScenePositionChanges)) + scene->d_func()->setScenePosItemEnabled(q, false); } if (subFocusItem && parent) { @@ -1084,10 +1102,15 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) parent->d_ptr->addChild(q); parent->itemChange(QGraphicsItem::ItemChildAddedChange, thisPointerVariant); - if (!implicitUpdate && scene) { - scene->d_func()->markDirty(q_ptr, QRect(), - /*invalidateChildren=*/false, - /*maybeDirtyClipPath=*/true); + if (scene) { + if (!implicitUpdate) + scene->d_func()->markDirty(q_ptr, QRect(), + /*invalidateChildren=*/false, + /*maybeDirtyClipPath=*/true); + + // Re-enable scene pos notifications for new ancestors + if (scenePosDescendants || (flags & QGraphicsItem::ItemSendsScenePositionChanges)) + scene->d_func()->setScenePosItemEnabled(q, true); } // Inherit ancestor flags from the new parent. @@ -1746,6 +1769,12 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) } if (d_ptr->scene) { + if ((flags & ItemSendsScenePositionChanges) != (oldFlags & ItemSendsScenePositionChanges)) { + if (flags & ItemSendsScenePositionChanges) + d_ptr->scene->d_func()->registerScenePosItem(this); + else + d_ptr->scene->d_func()->unregisterScenePosItem(this); + } d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true, /*maybeDirtyClipPath*/true); @@ -3412,6 +3441,7 @@ void QGraphicsItem::setPos(const QPointF &pos) // Send post-notification. itemChange(QGraphicsItem::ItemPositionHasChanged, newPosVariant); + d_ptr->sendScenePosChange(); } /*! @@ -4022,6 +4052,7 @@ void QGraphicsItem::setTransform(const QTransform &matrix, bool combine) // Send post-notification. itemChange(ItemTransformHasChanged, newTransformVariant); + d_ptr->sendScenePosChange(); } /*! @@ -4246,6 +4277,24 @@ void QGraphicsItemPrivate::ensureSequentialSiblingIndex() } /*! + \internal +*/ +inline void QGraphicsItemPrivate::sendScenePosChange() +{ + Q_Q(QGraphicsItem); + if (scene) { + if (flags & QGraphicsItem::ItemSendsScenePositionChanges) + q->itemChange(QGraphicsItem::ItemScenePositionHasChanged, q->scenePos()); + if (scenePosDescendants) { + foreach (QGraphicsItem *item, scene->d_func()->scenePosItems) { + if (q->isAncestorOf(item)) + item->itemChange(QGraphicsItem::ItemScenePositionHasChanged, item->scenePos()); + } + } + } +} + +/*! \since 4.6 Stacks this item before \a sibling, which must be a sibling item (i.e., the @@ -10925,6 +10974,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change) case QGraphicsItem::ItemOpacityHasChanged: str = "ItemOpacityHasChanged"; break; + case QGraphicsItem::ItemScenePositionHasChanged: + str = "ItemScenePositionHasChanged"; + break; } debug << str; return debug; @@ -10982,6 +11034,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemIsFocusScope: str = "ItemIsFocusScope"; break; + case QGraphicsItem::ItemSendsScenePositionChanges: + str = "ItemSendsScenePositionChanges"; + break; } debug << str; return debug; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index f3fe99c..6e1c632 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -105,7 +105,8 @@ public: ItemAcceptsInputMethod = 0x1000, ItemNegativeZStacksBehindParent = 0x2000, ItemIsPanel = 0x4000, - ItemIsFocusScope = 0x8000 // internal + ItemIsFocusScope = 0x8000, // internal + ItemSendsScenePositionChanges = 0x10000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) @@ -137,7 +138,8 @@ public: ItemZValueChange, ItemZValueHasChanged, ItemOpacityChange, - ItemOpacityHasChanged + ItemOpacityHasChanged, + ItemScenePositionHasChanged }; enum CacheMode { diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index ca56c18..92d45f6 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -179,6 +179,7 @@ public: holesInSiblingIndex(0), sequentialOrdering(1), updateDueToGraphicsEffect(0), + scenePosDescendants(0), globalStackingOrder(-1), q_ptr(0) { @@ -429,6 +430,7 @@ public: inline void ensureSortedChildren(); static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b); void ensureSequentialSiblingIndex(); + inline void sendScenePosChange(); QPainterPath cachedClipPath; QRectF childrenBoundingRect; @@ -483,7 +485,7 @@ public: // Packed 32 bits quint32 fullUpdatePending : 1; - quint32 flags : 16; + quint32 flags : 17; quint32 dirtyChildrenBoundingRect : 1; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; @@ -498,14 +500,15 @@ public: quint32 sceneTransformTranslateOnly : 1; quint32 notifyBoundingRectChanged : 1; quint32 notifyInvalidated : 1; - quint32 mouseSetsFocus : 1; // New 32 bits + quint32 mouseSetsFocus : 1; quint32 explicitActivate : 1; quint32 wantsActive : 1; quint32 holesInSiblingIndex : 1; quint32 sequentialOrdering : 1; quint32 updateDueToGraphicsEffect : 1; + quint32 scenePosDescendants : 1; // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a4965e4..b992398 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -294,6 +294,7 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() needSortTopLevelItems(true), holesInTopLevelSiblingIndex(false), topLevelSequentialOrdering(true), + scenePosDescendantsUpdatePending(false), stickyFocus(false), hasFocus(false), focusItem(0), @@ -488,6 +489,55 @@ void QGraphicsScenePrivate::_q_processDirtyItems() /*! \internal +*/ +void QGraphicsScenePrivate::setScenePosItemEnabled(QGraphicsItem *item, bool enabled) +{ + QGraphicsItem *p = item->d_ptr->parent; + while (p) { + p->d_ptr->scenePosDescendants = enabled; + p = p->d_ptr->parent; + } + if (!enabled && !scenePosDescendantsUpdatePending) { + scenePosDescendantsUpdatePending = true; + QMetaObject::invokeMethod(q_func(), "_q_updateScenePosDescendants", Qt::QueuedConnection); + } +} + +/*! + \internal +*/ +void QGraphicsScenePrivate::registerScenePosItem(QGraphicsItem *item) +{ + scenePosItems.insert(item); + setScenePosItemEnabled(item, true); +} + +/*! + \internal +*/ +void QGraphicsScenePrivate::unregisterScenePosItem(QGraphicsItem *item) +{ + scenePosItems.remove(item); + setScenePosItemEnabled(item, false); +} + +/*! + \internal +*/ +void QGraphicsScenePrivate::_q_updateScenePosDescendants() +{ + foreach (QGraphicsItem *item, scenePosItems) { + QGraphicsItem *p = item->d_ptr->parent; + while (p) { + p->d_ptr->scenePosDescendants = 1; + p = p->d_ptr->parent; + } + } + scenePosDescendantsUpdatePending = false; +} + +/*! + \internal Schedules an item for removal. This function leaves some stale indexes around in the BSP tree if called from the item's destructor; these will @@ -523,6 +573,9 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) widget->d_func()->fixFocusChainBeforeReparenting(0, 0); } + if (item->flags() & QGraphicsItem::ItemSendsScenePositionChanges) + unregisterScenePosItem(item); + item->d_func()->scene = 0; //We need to remove all children first because they might use their parent @@ -2540,6 +2593,9 @@ void QGraphicsScene::addItem(QGraphicsItem *item) } } + if (item->flags() & QGraphicsItem::ItemSendsScenePositionChanges) + d->registerScenePosItem(item); + // Ensure that newly added items that have subfocus set, gain // focus automatically if there isn't a focus item already. if (!d->focusItem && item != d->lastFocusItem && item->focusItem() == item) diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index d6d48d7..a47574e 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -299,6 +299,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_emitUpdated()) Q_PRIVATE_SLOT(d_func(), void _q_polishItems()) Q_PRIVATE_SLOT(d_func(), void _q_processDirtyItems()) + Q_PRIVATE_SLOT(d_func(), void _q_updateScenePosDescendants()) friend class QGraphicsItem; friend class QGraphicsItemPrivate; friend class QGraphicsView; diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index cd20fd0..6d46db5 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -122,6 +122,13 @@ public: void _q_processDirtyItems(); + QSet scenePosItems; + bool scenePosDescendantsUpdatePending; + void setScenePosItemEnabled(QGraphicsItem *item, bool enabled); + void registerScenePosItem(QGraphicsItem *item); + void unregisterScenePosItem(QGraphicsItem *item); + void _q_updateScenePosDescendants(); + void removeItemHelper(QGraphicsItem *item); QBrush backgroundBrush; diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 684ad4f..1081fd5 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -401,6 +401,7 @@ private slots: void modality_clickFocus(); void modality_keyEvents(); void itemIsInFront(); + void scenePosChange(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -4229,6 +4230,8 @@ protected: break; case QGraphicsItem::ItemOpacityHasChanged: break; + case QGraphicsItem::ItemScenePositionHasChanged: + break; } return itemChangeReturnValue.isValid() ? itemChangeReturnValue : value; } @@ -9691,5 +9694,76 @@ void tst_QGraphicsItem::itemIsInFront() QCOMPARE(qt_closestItemFirst(rect1child1_2, rect2child1), false); } +class ScenePosChangeTester : public ItemChangeTester +{ +public: + ScenePosChangeTester() + { } + ScenePosChangeTester(QGraphicsItem *parent) : ItemChangeTester(parent) + { } +}; + +void tst_QGraphicsItem::scenePosChange() +{ + ScenePosChangeTester* root = new ScenePosChangeTester; + ScenePosChangeTester* child1 = new ScenePosChangeTester(root); + ScenePosChangeTester* grandChild1 = new ScenePosChangeTester(child1); + ScenePosChangeTester* child2 = new ScenePosChangeTester(root); + ScenePosChangeTester* grandChild2 = new ScenePosChangeTester(child2); + + child1->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true); + grandChild2->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true); + + QGraphicsScene scene; + scene.addItem(root); + + // ignore uninteresting changes + child1->clear(); + child2->clear(); + grandChild1->clear(); + grandChild2->clear(); + + // move whole tree + root->moveBy(1.0, 1.0); + QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1); + QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); + QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); + QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1); + + // move subtree + child2->moveBy(1.0, 1.0); + QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1); + QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); + QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); + QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 2); + + // reparent + grandChild2->setParentItem(child1); + child1->moveBy(1.0, 1.0); + QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 2); + QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); + QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); + QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 3); + + // change flags + grandChild1->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true); + grandChild2->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, false); + QCoreApplication::processEvents(); // QGraphicsScenePrivate::_q_updateScenePosDescendants() + child1->moveBy(1.0, 1.0); + QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 3); + QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1); + QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); + QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 3); + + // remove + scene.removeItem(grandChild1); + delete grandChild2; grandChild2 = 0; + QCoreApplication::processEvents(); // QGraphicsScenePrivate::_q_updateScenePosDescendants() + root->moveBy(1.0, 1.0); + QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 4); + QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1); + QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From 2a0d6bf8d3f7c92667512d2222cf2304e06130b4 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 10:56:06 +0100 Subject: Adapt testcase to cosmetic pen workarounds in code Reviewed-by: Samuel --- tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index fbeb425..55294d5 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -357,7 +357,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data() QTest::newRow("log,transparent") << int(Qt::LogicalCoordinates) << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) - << QSize(12, 12) << QPoint(-1, -1) + << QSize(14, 14) << QPoint(-2, -2) << 0x00000000u; QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates) @@ -372,7 +372,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data() QTest::newRow("dev,transparent") << int(Qt::DeviceCoordinates) << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) - << QSize(22, 22) << QPoint(39, 39) + << QSize(24, 24) << QPoint(38, 38) << 0x00000000u; QTest::newRow("dev,effectrect") << int(Qt::DeviceCoordinates) -- cgit v0.12 From 83b069307781f138394d29540a35c62d1dc584c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 3 Nov 2009 11:58:53 +0200 Subject: Build break fix for S60Simulated style S60Simulated style broke down after change SHA da9880eaed0d09338717db1a73db01e6b0ab080d, because part()-method call in simulated style was not updated to have additional parameter. Task-number: None Reviewed-by: Shane Kearns --- src/gui/styles/qs60style_simulated.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 14f0424..706b4e9 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -322,7 +322,7 @@ QPixmap QS60StylePrivate::backgroundTexture() { if (!m_background) { const QSize size = QApplication::desktop()->screen()->size(); - QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size); + QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size, 0); m_background = new QPixmap(background); } return *m_background; -- cgit v0.12 From 1ef5dddf91c666664911686ca77cb6c1b2cde828 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 3 Nov 2009 12:06:35 +0200 Subject: Force Qt libs to install on phone memory in Symbian. Starting Qt apps when Qt libs are installed on a memory card takes ages (15-20 seconds), because Symbian recalculates hash of the dll every time it loads it from a non-system drive. Worked around this issue by forcing installation of Qt libs to the C-drive. Task-number: QT-690 Reviewed-by: Janne Koskinen --- src/s60installs/s60installs.pro | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 022a072..9c53167 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -12,7 +12,7 @@ symbian: { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} qtresources.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/s60main.rsc - qtresources.path = $$APP_RESOURCE_DIR + qtresources.path = c:$$APP_RESOURCE_DIR qtlibraries.sources = \ QtCore.dll \ @@ -24,24 +24,24 @@ symbian: { qts60plugindeployment = \ "IF package(0x1028315F)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"!:\\sys\\bin\\qts60plugin_5_0.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \ "ELSEIF package(0x102752AE)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_2.dll\" - \"!:\\sys\\bin\\qts60plugin_3_2.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_2.dll\" - \"c:\\sys\\bin\\qts60plugin_3_2.dll\"" \ "ELSEIF package(0x102032BE)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"!:\\sys\\bin\\qts60plugin_3_1.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"c:\\sys\\bin\\qts60plugin_3_1.dll\"" \ "ELSE" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"!:\\sys\\bin\\qts60plugin_5_0.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \ "ENDIF" qtlibraries.pkg_postrules += qts60plugindeployment sqlitedeployment = \ "; Deploy sqlite onto phone that does not have it (this should be replaced with embedded sis file when available)" \ "IF NOT package(0x2002533b) " \ - "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"!:\\sys\\bin\\sqlite3.dll\"" \ + "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"c:\\sys\\bin\\sqlite3.dll\"" \ "ENDIF" qtlibraries.pkg_postrules += sqlitedeployment - qtlibraries.path = /sys/bin + qtlibraries.path = c:/sys/bin vendorinfo = \ "; Localised Vendor name" \ @@ -67,15 +67,15 @@ symbian: { !contains(QT_CONFIG, no-mng): imageformats_plugins.sources += qmng.dll !contains(QT_CONFIG, no-tiff): imageformats_plugins.sources += qtiff.dll !contains(QT_CONFIG, no-ico): imageformats_plugins.sources += qico.dll - imageformats_plugins.path = $$QT_PLUGINS_BASE_DIR/imageformats + imageformats_plugins.path = c:$$QT_PLUGINS_BASE_DIR/imageformats codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll - codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs + codecs_plugins.path = c:$$QT_PLUGINS_BASE_DIR/codecs contains(QT_CONFIG, phonon-backend) { phonon_backend_plugins.sources += phonon_mmf.dll - phonon_backend_plugins.path = $$QT_PLUGINS_BASE_DIR/phonon_backend + phonon_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/phonon_backend DEPLOYMENT += phonon_backend_plugins } @@ -85,7 +85,7 @@ symbian: { qtlibraries.sources += QtSvg.dll imageformats_plugins.sources += qsvg.dll iconengines_plugins.sources = qsvgicon.dll - iconengines_plugins.path = $$QT_PLUGINS_BASE_DIR/iconengines + iconengines_plugins.path = c:$$QT_PLUGINS_BASE_DIR/iconengines DEPLOYMENT += iconengines_plugins } @@ -105,7 +105,7 @@ symbian: { qtlibraries.sources += QtWebKit.dll } - graphicssystems_plugins.path = $$QT_PLUGINS_BASE_DIR/graphicssystems + graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems contains(QT_CONFIG, openvg) { qtlibraries.sources = QtOpenVG.dll graphicssystems_plugins.sources += qvggraphicssystem.dll -- cgit v0.12 From 29ddc44a11e16347212fccd3d81c4e0c91bf61a1 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 2 Nov 2009 12:37:41 +0100 Subject: Documentation fixes related to gestures doc. Reviewed-by: David Boddie --- doc/src/frameworks-technologies/gestures.qdoc | 4 ++-- src/gui/kernel/qevent.cpp | 5 +++-- src/gui/kernel/qgesture.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index a619fe8..f64e301 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -168,6 +168,6 @@ \section1 Further Reading - The \l{Image Gestures Example} shows how to enable gestures for a widget in - a simple image viewer application. + The \l{gestures/imagegestures}{Image Gestures Example} shows how to enable + gestures for a widget in a simple image viewer application. */ diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ab43e79..6757fa2 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4344,8 +4344,9 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const Sets the accept flag of the given \a gestureType object to the specified \a value. - Setting the accept flag indicates that the event receiver wants the \a gesture. - Unwanted gestures may be propagated to the parent widget. + Setting the accept flag indicates that the event receiver wants the gesture + of type \a gestureType. Unwanted gestures may be propagated to the parent + widget. By default, gestures in events of type QEvent::Gesture are accepted, and gestures in QEvent::GestureOverride events are ignored. diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 850f22c..df99746 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -217,7 +217,7 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const */ /*! - \property QGesture::GestureCancelPolicy + \property QGesture::gestureCancelPolicy \brief the policy for deciding what happens on accepting a gesture On accepting one gesture Qt can automatically cancel other gestures -- cgit v0.12 From b112af4614dffcb230956bfa319c37fc00e6a13c Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 2 Nov 2009 14:13:17 +0100 Subject: Added QGraphicsObject::ungrabGesture() Oops, apparently we forgot to add a function for unsubscribing a graphics object from a gesture. Fixing it now. Reviewed-by: trustme --- src/gui/graphicsview/qgraphicsitem.cpp | 17 +++++++++++++++-- src/gui/graphicsview/qgraphicsitem.h | 1 + src/gui/kernel/qwidget.cpp | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 738c6e3..58d7e7d 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7322,9 +7322,8 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent /*! Subscribes the graphics object to the given \a gesture for the specified \a context. - \sa QGestureEvent + \sa ungrabGesture(), QGestureEvent */ - void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) { QGraphicsItemPrivate * const d = QGraphicsItem::d_func(); @@ -7333,6 +7332,20 @@ void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext co } /*! + Unsubscribes the graphics object from the given \a gesture. + + \sa grabGesture(), QGestureEvent +*/ +void QGraphicsObject::ungrabGesture(Qt::GestureType gesture) +{ + QGraphicsItemPrivate * const d = QGraphicsItem::d_func(); + if (d->gestureContext.remove(gesture)) { + QGestureManager *manager = QGestureManager::instance(); + manager->cleanupCachedGestures(this, gesture); + } +} + +/*! \property QGraphicsObject::parent \brief the parent of the item diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index f3fe99c..fc180f3 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -556,6 +556,7 @@ public: #endif void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::ItemWithChildrenGesture); + void ungrabGesture(Qt::GestureType type); Q_SIGNALS: void parentChanged(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 14f3bfe..ac2808c 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11712,7 +11712,7 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const /*! Subscribes the widget to a given \a gesture with a \a context. - \sa QGestureEvent + \sa ungrabGesture(), QGestureEvent \since 4.6 */ void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) @@ -11725,7 +11725,7 @@ void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) /*! Unsubscribes the widget to a given \a gesture type - \sa QGestureEvent + \sa grabGesture(), QGestureEvent \since 4.6 */ void QWidget::ungrabGesture(Qt::GestureType gesture) -- cgit v0.12 From 0222f4f55d6af9ad4f4ca1ee07ae9810ff9256a2 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 30 Oct 2009 13:57:34 +0100 Subject: Improved gesture scrollarea manualtest. Reviewed-by: trustme --- tests/manual/gestures/scrollarea/main.cpp | 30 +++++++++++++++------- .../scrollarea/mousepangesturerecognizer.cpp | 14 ++++++++-- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp index f90f6c6..9a5eb02 100644 --- a/tests/manual/gestures/scrollarea/main.cpp +++ b/tests/manual/gestures/scrollarea/main.cpp @@ -73,11 +73,11 @@ protected: QPanGesture *pan = static_cast(event->gesture(Qt::PanGesture)); if (pan) { switch(pan->state()) { - case Qt::GestureStarted: qDebug("area: Pan: started"); break; - case Qt::GestureFinished: qDebug("area: Pan: finished"); break; - case Qt::GestureCanceled: qDebug("area: Pan: canceled"); break; + case Qt::GestureStarted: qDebug() << this << "Pan: started"; break; + case Qt::GestureFinished: qDebug() << this << "Pan: finished"; break; + case Qt::GestureCanceled: qDebug() << this << "Pan: canceled"; break; case Qt::GestureUpdated: break; - default: qDebug("area: Pan: "); break; + default: qDebug() << this << "Pan: "; break; } if (pan->state() == Qt::GestureStarted) @@ -134,11 +134,11 @@ protected: QPanGesture *pan = static_cast(event->gesture(Qt::PanGesture)); if (pan) { switch (pan->state()) { - case Qt::GestureStarted: qDebug("slider: Pan: started"); break; - case Qt::GestureFinished: qDebug("slider: Pan: finished"); break; - case Qt::GestureCanceled: qDebug("slider: Pan: canceled"); break; + case Qt::GestureStarted: qDebug() << this << "Pan: started"; break; + case Qt::GestureFinished: qDebug() << this << "Pan: finished"; break; + case Qt::GestureCanceled: qDebug() << this << "Pan: canceled"; break; case Qt::GestureUpdated: break; - default: qDebug("slider: Pan: "); break; + default: qDebug() << this << "Pan: "; break; } if (pan->state() == Qt::GestureStarted) @@ -186,6 +186,7 @@ public: MainWindow() { rootScrollArea = new ScrollArea; + rootScrollArea->setObjectName(QLatin1String("rootScrollArea")); setCentralWidget(rootScrollArea); QWidget *root = new QWidget; @@ -193,14 +194,17 @@ public: rootScrollArea->setWidget(root); Slider *verticalSlider = new Slider(Qt::Vertical, root); + verticalSlider->setObjectName(QLatin1String("verticalSlider")); verticalSlider ->move(650, 1100); Slider *horizontalSlider = new Slider(Qt::Horizontal, root); + horizontalSlider->setObjectName(QLatin1String("horizontalSlider")); horizontalSlider ->move(600, 1000); childScrollArea = new ScrollArea(root); + childScrollArea->setObjectName(QLatin1String("childScrollArea")); childScrollArea->move(500, 500); QWidget *w = new QWidget; - w->setMinimumWidth(400); + w->setMinimumWidth(700); QVBoxLayout *l = new QVBoxLayout(w); l->setMargin(20); for (int i = 0; i < 100; ++i) { @@ -211,6 +215,14 @@ public: l->addWidget(w); } childScrollArea->setWidget(w); +#if defined(Q_OS_WIN) + // Windows can force Qt to create a native window handle for an + // intermediate widget and that will block gesture to get touch events. + // So this hack to make sure gestures get all touch events they need. + foreach (QObject *w, children()) + if (w->isWidgetType()) + static_cast(w)->setAttribute(Qt::WA_AcceptTouchEvents); +#endif } private: ScrollArea *rootScrollArea; diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp index 63d3e76..ce5ef57 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp @@ -57,8 +57,16 @@ QGesture* MousePanGestureRecognizer::createGesture(QObject *) QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) { QPanGesture *g = static_cast(state); + if (event->type() == QEvent::TouchBegin) { + // ignore the following mousepress event + g->setProperty("ignoreMousePress", QVariant::fromValue(true)); + } else if (event->type() == QEvent::TouchEnd) { + g->setProperty("ignoreMousePress", QVariant::fromValue(false)); + } QMouseEvent *me = static_cast(event); - if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick) { + if (event->type() == QEvent::MouseButtonPress) { + if (g->property("ignoreMousePress").toBool()) + return QGestureRecognizer::Ignore; g->setHotSpot(me->globalPos()); g->setProperty("lastPos", me->globalPos()); g->setProperty("pressed", QVariant::fromValue(true)); @@ -76,7 +84,8 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat } return QGestureRecognizer::NotGesture; } else if (event->type() == QEvent::MouseButtonRelease) { - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + if (g->property("pressed").toBool()) + return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; } return QGestureRecognizer::Ignore; } @@ -90,5 +99,6 @@ void MousePanGestureRecognizer::reset(QGesture *state) g->setAcceleration(0); g->setProperty("lastPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); + g->setProperty("ignoreMousePress", QVariant::fromValue(false)); QGestureRecognizer::reset(state); } -- cgit v0.12 From b7b4df9c87805be372fa6f74422e0f4648a5d520 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 30 Oct 2009 14:01:41 +0100 Subject: Fixed the imagegestures project file. Reviewed-by: trustme --- examples/gestures/imagegestures/imagegestures.pro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro index 7780ad9..8c947e4 100644 --- a/examples/gestures/imagegestures/imagegestures.pro +++ b/examples/gestures/imagegestures/imagegestures.pro @@ -5,12 +5,12 @@ SOURCES = imagewidget.cpp \ mainwidget.cpp # install -target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer +target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures sources.files = $$SOURCES \ $$HEADERS \ $$RESOURCES \ $$FORMS \ - imageviewer.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer + imagegestures.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures INSTALLS += target \ sources -- cgit v0.12 From 54db3afc9797a3adf5a38f35f6338960924e9e1a Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 30 Oct 2009 17:14:53 +0100 Subject: Implemented pinch gesture recognizer. Reviewed-by: trustme --- examples/gestures/imagegestures/imagewidget.cpp | 18 +-- src/gui/kernel/qgesture_p.h | 3 + src/gui/kernel/qgesturemanager.cpp | 1 + src/gui/kernel/qstandardgestures.cpp | 177 ++++++++++++--------- src/gui/kernel/qstandardgestures_p.h | 11 ++ src/gui/kernel/qwidget.cpp | 1 + src/gui/kernel/qwidget_win.cpp | 11 -- .../kernel/qwinnativepangesturerecognizer_win.cpp | 8 +- .../kernel/qwinnativepangesturerecognizer_win_p.h | 2 +- 9 files changed, 130 insertions(+), 102 deletions(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index 28de6da..c798fcc 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -102,17 +102,13 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) //! [gesture event handler] bool ImageWidget::gestureEvent(QGestureEvent *event) { - if (QGesture *pan = event->gesture(Qt::PanGesture)) { - panTriggered(static_cast(pan)); - return true; - } else if (QGesture *pinch = event->gesture(Qt::PinchGesture)) { - pinchTriggered(static_cast(pinch)); - return true; - } else if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) { - swipeTriggered(static_cast(swipe)); - return true; - } - return false; + if (QGesture *pan = event->gesture(Qt::PanGesture)) + panTriggered(static_cast(pan)); + if (QGesture *pinch = event->gesture(Qt::PinchGesture)) + pinchTriggered(static_cast(pinch)); + if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) + swipeTriggered(static_cast(swipe)); + return true; } //! [gesture event handler] diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 34fbb26..73a6bcf 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -121,6 +121,9 @@ public: qreal totalRotationAngle; qreal lastRotationAngle; qreal rotationAngle; + + bool isNewSequence; + QPointF startPosition[2]; }; class QSwipeGesturePrivate : public QGesturePrivate diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 1d33c84..6ea350b 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -77,6 +77,7 @@ QGestureManager::QGestureManager(QObject *parent) #endif #else registerGestureRecognizer(new QPanGestureRecognizer); + registerGestureRecognizer(new QPinchGestureRecognizer); #endif } diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index dec2311..57cf12d 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -44,6 +44,7 @@ #include "qgesture_p.h" #include "qevent.h" #include "qwidget.h" +#include "qabstractscrollarea.h" QT_BEGIN_NAMESPACE @@ -54,7 +55,13 @@ QPanGestureRecognizer::QPanGestureRecognizer() QGesture *QPanGestureRecognizer::createGesture(QObject *target) { if (target && target->isWidgetType()) { +#if defined(Q_OS_WIN) + // for scroll areas on Windows we want to use native gestures instead + if (!qobject_cast(target->parent())) + static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); +#else static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); +#endif } return new QPanGesture; } @@ -132,104 +139,124 @@ void QPanGestureRecognizer::reset(QGesture *state) d->lastPosition = QPoint(); d->acceleration = 0; -//#if defined(QT_MAC_USE_COCOA) -// d->singleTouchPanTimer.stop(); -// d->prevMousePos = QPointF(0, 0); -//#endif - QGestureRecognizer::reset(state); } -/* -bool QPanGestureRecognizer::event(QEvent *event) + +// +// QPinchGestureRecognizer +// + +QPinchGestureRecognizer::QPinchGestureRecognizer() { -#if defined(QT_MAC_USE_COCOA) - Q_D(QPanGesture); - if (event->type() == QEvent::Timer) { - const QTimerEvent *te = static_cast(event); - if (te->timerId() == d->singleTouchPanTimer.timerId()) { - d->singleTouchPanTimer.stop(); - updateState(Qt::GestureStarted); - } +} + +QGesture *QPinchGestureRecognizer::createGesture(QObject *target) +{ + if (target && target->isWidgetType()) { + static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); } -#endif + return new QPinchGesture; +} - bool consume = false; +QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +{ + QPinchGesture *q = static_cast(state); + QPinchGesturePrivate *d = q->d_func(); -#if defined(Q_WS_WIN) -#elif defined(QT_MAC_USE_COCOA) - // The following implements single touch - // panning on Mac: - const int panBeginDelay = 300; - const int panBeginRadius = 3; - const QTouchEvent *ev = static_cast(event); + const QTouchEvent *ev = static_cast(event); + + QGestureRecognizer::Result result; switch (event->type()) { case QEvent::TouchBegin: { - if (ev->touchPoints().size() == 1) { - d->delayManager->setEnabled(true); - consume = d->delayManager->append(d->gestureTarget, *event); - d->lastPosition = QCursor::pos(); - d->singleTouchPanTimer.start(panBeginDelay, this); - } - break;} + result = QGestureRecognizer::MaybeGesture; + break; + } case QEvent::TouchEnd: { - d->delayManager->setEnabled(false); - if (state() != Qt::NoGesture) { - updateState(Qt::GestureFinished); - consume = true; - d->delayManager->clear(); + if (q->state() != Qt::NoGesture) { + result = QGestureRecognizer::GestureFinished; } else { - d->delayManager->replay(); + result = QGestureRecognizer::NotGesture; } - reset(); - break;} + break; + } case QEvent::TouchUpdate: { - consume = d->delayManager->append(d->gestureTarget, *event); - if (ev->touchPoints().size() == 1) { - if (state() == Qt::NoGesture) { - // INVARIANT: The singleTouchTimer has still not fired. - // Lets check if the user moved his finger so much from - // the starting point that it makes sense to cancel: - const QPointF startPos = ev->touchPoints().at(0).startPos().toPoint(); - const QPointF p = ev->touchPoints().at(0).pos().toPoint(); - if ((startPos - p).manhattanLength() > panBeginRadius) { - d->delayManager->replay(); - consume = false; - reset(); - } else { - d->lastPosition = QCursor::pos(); - } + d->whatChanged = 0; + if (ev->touchPoints().size() == 2) { + QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0); + QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); + + d->hotSpot = p1.screenPos(); + d->isHotSpotSet = true; + + if (d->isNewSequence) { + d->startPosition[0] = p1.screenPos(); + d->startPosition[1] = p2.screenPos(); + } + QLineF line(p1.screenPos(), p2.screenPos()); + QLineF tmp(line); + tmp.setLength(line.length() / 2.); + QPointF centerPoint = tmp.p2(); + + d->lastCenterPoint = d->centerPoint; + d->centerPoint = centerPoint; + d->whatChanged |= QPinchGesture::CenterPointChanged; + + const qreal scaleFactor = QLineF(p1.pos(), p2.pos()).length() + / QLineF(d->startPosition[0], d->startPosition[1]).length(); + if (d->isNewSequence) { + d->lastScaleFactor = scaleFactor; } else { - d->delayManager->clear(); - QPointF mousePos = QCursor::pos(); - QPointF dist = mousePos - d->lastPosition; - d->lastPosition = mousePos; - d->lastOffset = d->offset; - d->offset = QSizeF(dist.x(), dist.y()); - d->totalOffset += d->offset; - updateState(Qt::GestureUpdated); + d->lastScaleFactor = d->scaleFactor; } - } else if (state() == Qt::NoGesture) { - d->delayManager->replay(); - consume = false; - reset(); + d->scaleFactor = scaleFactor; + d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor; + d->whatChanged |= QPinchGesture::ScaleFactorChanged; + + const qreal rotationAngle = -line.angle(); + if (d->isNewSequence) + d->lastRotationAngle = rotationAngle; + else + d->lastRotationAngle = d->rotationAngle; + d->rotationAngle = rotationAngle; + d->totalRotationAngle += d->rotationAngle - d->lastRotationAngle; + d->whatChanged |= QPinchGesture::RotationAngleChanged; + + d->isNewSequence = false; + result = QGestureRecognizer::GestureTriggered; + } else { + d->isNewSequence = true; + result = QGestureRecognizer::MaybeGesture; } - break;} + break; + } case QEvent::MouseButtonPress: case QEvent::MouseMove: case QEvent::MouseButtonRelease: - if (d->delayManager->isEnabled()) - consume = d->delayManager->append(d->gestureTarget, *event); + result = QGestureRecognizer::Ignore; break; default: - return false; + result = QGestureRecognizer::Ignore; + break; } -#else - Q_UNUSED(event); -#endif - return QGestureRecognizer::Ignore; + return result; +} + +void QPinchGestureRecognizer::reset(QGesture *state) +{ + QPinchGesture *pinch = static_cast(state); + QPinchGesturePrivate *d = pinch->d_func(); + + d->whatChanged = 0; + + d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF(); + d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 0; + d->totalRotationAngle = d->lastRotationAngle = d->rotationAngle = 0; + + d->isNewSequence = true; + + QGestureRecognizer::reset(state); } - */ QT_END_NAMESPACE diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index fec5c2f..827b2a2 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -69,6 +69,17 @@ public: void reset(QGesture *state); }; +class QPinchGestureRecognizer : public QGestureRecognizer +{ +public: + QPinchGestureRecognizer(); + + QGesture *createGesture(QObject *target); + + QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + QT_END_NAMESPACE #endif // QSTANDARDGESTURES_P_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index ac2808c..00d9a99 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -197,6 +197,7 @@ QWidgetPrivate::QWidgetPrivate(int version) , picture(0) #elif defined(Q_WS_WIN) , noPaintOnScreen(0) + , nativeGesturePanEnabled(0) #elif defined(Q_WS_MAC) , needWindowChange(0) , isGLWidget(0) diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 5bf7649..3a92735 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2071,17 +2071,6 @@ void QWidgetPrivate::winSetupGestures() gc[0].dwBlock = GC_PAN; } -// gc[1].dwID = GID_ZOOM; -// if (gestures.pinch) -// gc[1].dwWant = GC_ZOOM; -// else -// gc[1].dwBlock = GC_ZOOM; -// gc[2].dwID = GID_ROTATE; -// if (gestures.pinch) -// gc[2].dwWant = GC_ROTATE; -// else -// gc[2].dwBlock = GC_ROTATE; - qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); } } diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp index 12d3058..c3c8a28 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp @@ -56,16 +56,16 @@ QWinNativePanGestureRecognizer::QWinNativePanGestureRecognizer() { } -QGesture* QWinNativePanGestureRecognizer::createGesture(QObject *target) const +QGesture *QWinNativePanGestureRecognizer::createGesture(QObject *target) { if (!target) return new QPanGesture; // a special case - if (qobject_cast(target)) - return 0; if (!target->isWidgetType()) return 0; + if (qobject_cast(target)) + return 0; - QWidget *q = static_cast(target); + QWidget *q = static_cast(target); QWidgetPrivate *d = q->d_func(); d->nativeGesturePanEnabled = true; d->winSetupGestures(); diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h index a1e8511..1d723da 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h @@ -62,7 +62,7 @@ class QWinNativePanGestureRecognizer : public QGestureRecognizer public: QWinNativePanGestureRecognizer(); - QGesture* createGesture(QObject *target) const; + QGesture *createGesture(QObject *target); QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); -- cgit v0.12 From 4843b437b90800d238f14e7a4558045ddc37cd4b Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 2 Nov 2009 11:13:39 +0100 Subject: Made native Pan gesture work on Windows. Reviewed-by: trustme --- src/gui/kernel/qapplication.cpp | 1 + src/gui/kernel/qapplication_p.h | 1 + src/gui/kernel/qapplication_win.cpp | 36 ++++++++++----------- src/gui/kernel/qgesturemanager.cpp | 6 ++++ src/gui/kernel/qwidget_win.cpp | 4 ++- src/gui/widgets/qabstractscrollarea.cpp | 55 +++++++++++++++++++-------------- src/gui/widgets/qplaintextedit.cpp | 53 ++++++++++++++++--------------- src/gui/widgets/qtextedit.cpp | 6 ++-- 8 files changed, 90 insertions(+), 72 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 1ec51da..06787eb 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -186,6 +186,7 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T #endif gestureManager = 0; + gestureWidget = 0; if (!self) self = this; diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 0fa7269..2c57238 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -511,6 +511,7 @@ public: #endif QGestureManager *gestureManager; + QWidget *gestureWidget; QMap widgetForTouchPointId; QMap appCurrentTouchPoints; diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index d98ecbb..387c29b 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -2499,24 +2499,24 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam if (qAppPriv->GetGestureInfo) bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); if (bResult) { -// if (gi.dwID == GID_BEGIN) { -// // find the alien widget for the gesture position. -// // This might not be accurate as the position is the center -// // point of two fingers for multi-finger gestures. -// QPoint pt(gi.ptsLocation.x, gi.ptsLocation.y); -// QWidget *w = widget->childAt(widget->mapFromGlobal(pt)); -// qAppPriv->gestureWidget = w ? w : widget; -// } -// if (qAppPriv->gestureWidget) -// static_cast(qAppPriv->gestureWidget)->translateGestureEvent(msg, gi); -// if (qAppPriv->CloseGestureInfoHandle) -// qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); -// if (gi.dwID == GID_END) -// qAppPriv->gestureWidget = 0; -// } else { -// DWORD dwErr = GetLastError(); -// if (dwErr > 0) -// qWarning() << "translateGestureEvent: error = " << dwErr; + if (gi.dwID == GID_BEGIN) { + // find the alien widget for the gesture position. + // This might not be accurate as the position is the center + // point of two fingers for multi-finger gestures. + QPoint pt(gi.ptsLocation.x, gi.ptsLocation.y); + QWidget *w = widget->childAt(widget->mapFromGlobal(pt)); + qAppPriv->gestureWidget = w ? w : widget; + } + if (qAppPriv->gestureWidget) + static_cast(qAppPriv->gestureWidget)->translateGestureEvent(msg, gi); + if (qAppPriv->CloseGestureInfoHandle) + qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); + if (gi.dwID == GID_END) + qAppPriv->gestureWidget = 0; + } else { + DWORD dwErr = GetLastError(); + if (dwErr > 0) + qWarning() << "translateGestureEvent: error = " << dwErr; } result = true; break; diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 6ea350b..318d4b5 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -52,6 +52,9 @@ #ifdef Q_WS_MAC #include "qmacgesturerecognizer_mac_p.h" #endif +#if defined(Q_OS_WIN) +#include "qwinnativepangesturerecognizer_win_p.h" +#endif #include "qdebug.h" @@ -78,6 +81,9 @@ QGestureManager::QGestureManager(QObject *parent) #else registerGestureRecognizer(new QPanGestureRecognizer); registerGestureRecognizer(new QPinchGestureRecognizer); +#if defined(Q_OS_WIN) + registerGestureRecognizer(new QWinNativePanGestureRecognizer); +#endif #endif } diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 3a92735..22a94b9 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2036,7 +2036,7 @@ void QWidgetPrivate::winSetupGestures() if (!q || !q->isVisible()) return; QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - WId winid = q->effectiveWinId(); + WId winid = q->internalWinId(); bool needh = false; bool needv = false; @@ -2052,6 +2052,8 @@ void QWidgetPrivate::winSetupGestures() needv = (vbarpolicy == Qt::ScrollBarAlwaysOn || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; + if (!winid) + winid = q->winId(); // enforces the native winid on the viewport } if (winid && qAppPriv->SetGestureConfig) { GESTURECONFIG gc[1]; diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 0896256..7d81d5a 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -293,13 +293,16 @@ void QAbstractScrollAreaPrivate::init() q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); layoutChildren(); + viewport->grabGesture(Qt::PanGesture); } #ifdef Q_WS_WIN void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on) { singleFingerPanEnabled = on; - winSetupGestures(); + QWidgetPrivate *dd = static_cast(QObjectPrivate::get(viewport)); + if (dd) + dd->winSetupGestures(); } #endif // Q_WS_WIN @@ -539,6 +542,7 @@ void QAbstractScrollArea::setViewport(QWidget *widget) d->viewport->setParent(this); d->viewport->setFocusProxy(this); d->viewport->installEventFilter(d->viewportFilter.data()); + d->viewport->grabGesture(Qt::PanGesture); d->layoutChildren(); if (isVisible()) d->viewport->show(); @@ -935,6 +939,26 @@ bool QAbstractScrollArea::event(QEvent *e) case QEvent::TouchUpdate: case QEvent::TouchEnd: return false; + case QEvent::Gesture: + { + QGestureEvent *ge = static_cast(e); + QPanGesture *g = static_cast(ge->gesture(Qt::PanGesture)); + if (g) { + QScrollBar *hBar = horizontalScrollBar(); + QScrollBar *vBar = verticalScrollBar(); + QPointF delta = g->lastOffset(); + if (!delta.isNull()) { + if (QApplication::isRightToLeft()) + delta.rx() *= -1; + int newX = hBar->value() - delta.x(); + int newY = vBar->value() - delta.y(); + hBar->setValue(newX); + vBar->setValue(newY); + } + return true; + } + return false; + } case QEvent::StyleChange: case QEvent::LayoutDirectionChange: case QEvent::ApplicationLayoutDirectionChange: @@ -990,6 +1014,8 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e) #endif return QFrame::event(e); case QEvent::LayoutRequest: + case QEvent::Gesture: + case QEvent::GestureOverride: return event(e); default: break; @@ -1266,11 +1292,13 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y) void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() { layoutChildren(); -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN // Need to re-subscribe to gestures as the content changes to make sure we // enable/disable panning when needed. - winSetupGestures(); -#endif // Q_OS_WIN + QWidgetPrivate *dd = static_cast(QObjectPrivate::get(viewport)); + if (dd) + dd->winSetupGestures(); +#endif // Q_WS_WIN } QPoint QAbstractScrollAreaPrivate::contentsOffset() const @@ -1335,25 +1363,6 @@ void QAbstractScrollArea::setupViewport(QWidget *viewport) Q_UNUSED(viewport); } -//void QAbstractScrollAreaPrivate::_q_gestureTriggered() -//{ -// Q_Q(QAbstractScrollArea); -// QPanGesture *g = qobject_cast(q->sender()); -// if (!g) -// return; -// QScrollBar *hBar = q->horizontalScrollBar(); -// QScrollBar *vBar = q->verticalScrollBar(); -// QSizeF delta = g->lastOffset(); -// if (!delta.isNull()) { -// if (QApplication::isRightToLeft()) -// delta.rwidth() *= -1; -// int newX = hBar->value() - delta.width(); -// int newY = vBar->value() - delta.height(); -// hbar->setValue(newX); -// vbar->setValue(newY); -// } -//} - QT_END_NAMESPACE #include "moc_qabstractscrollarea.cpp" diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index fc61889..0e5ee46 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -730,9 +730,6 @@ QPlainTextEditPrivate::QPlainTextEditPrivate() backgroundVisible = false; centerOnScroll = false; inDrag = false; -#ifdef Q_WS_WIN - singleFingerPanEnabled = true; -#endif } @@ -789,6 +786,9 @@ void QPlainTextEditPrivate::init(const QString &txt) viewport->setCursor(Qt::IBeamCursor); #endif originalOffsetY = 0; +#ifdef Q_WS_WIN + setSingleFingerPanEnabled(true); +#endif } void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) @@ -1450,6 +1450,29 @@ bool QPlainTextEdit::event(QEvent *e) d->sendControlEvent(e); } #endif + else if (e->type() == QEvent::Gesture) { + QGestureEvent *ge = static_cast(e); + QPanGesture *g = static_cast(ge->gesture(Qt::PanGesture)); + if (g) { + QScrollBar *hBar = horizontalScrollBar(); + QScrollBar *vBar = verticalScrollBar(); + if (g->state() == Qt::GestureStarted) + d->originalOffsetY = vBar->value(); + QPointF totalOffset = g->totalOffset(); + if (!totalOffset.isNull()) { + if (QApplication::isRightToLeft()) + totalOffset.rx() *= -1; + // QPlainTextEdit scrolls by lines only in vertical direction + QFontMetrics fm(document()->defaultFont()); + int lineHeight = fm.height(); + int newX = hBar->value() - g->lastOffset().x(); + int newY = d->originalOffsetY - totalOffset.y()/lineHeight; + hBar->setValue(newX); + vBar->setValue(newY); + } + } + return true; + } return QAbstractScrollArea::event(e); } @@ -2929,30 +2952,6 @@ QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() cons (\a available is true) or unavailable (\a available is false). */ -//void QPlainTextEditPrivate::_q_gestureTriggered() -//{ -// Q_Q(QPlainTextEdit); -// QPanGesture *g = qobject_cast(q->sender()); -// if (!g) -// return; -// QScrollBar *hBar = q->horizontalScrollBar(); -// QScrollBar *vBar = q->verticalScrollBar(); -// if (g->state() == Qt::GestureStarted) -// originalOffsetY = vBar->value(); -// QSizeF totalOffset = g->totalOffset(); -// if (!totalOffset.isNull()) { -// if (QApplication::isRightToLeft()) -// totalOffset.rwidth() *= -1; -// // QPlainTextEdit scrolls by lines only in vertical direction -// QFontMetrics fm(q->document()->defaultFont()); -// int lineHeight = fm.height(); -// int newX = hBar->value() - g->lastOffset().width(); -// int newY = originalOffsetY - totalOffset.height()/lineHeight; -// hbar->setValue(newX); -// vbar->setValue(newY); -// } -//} - QT_END_NAMESPACE #include "moc_qplaintextedit.cpp" diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index f477fee..355b678 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -116,9 +116,6 @@ QTextEditPrivate::QTextEditPrivate() preferRichText = false; showCursorOnInitialShow = true; inDrag = false; -#ifdef Q_WS_WIN - setSingleFingerPanEnabled(true); -#endif } void QTextEditPrivate::createAutoBulletList() @@ -186,6 +183,9 @@ void QTextEditPrivate::init(const QString &html) #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); #endif +#ifdef Q_WS_WIN + setSingleFingerPanEnabled(true); +#endif } void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) -- cgit v0.12 From cfcfae65778f2e1e7fc3936c66689e3685f1cc77 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 28 Oct 2009 21:40:14 +0100 Subject: Modified gesture events propagation. By default if the gesture is ignored, only gestures in the started state are propagated, and accepting a gesture in the started state adds an implicit grab meaning all the following events in the gesture sequence will be delivered to that widget. This is similar to the way QTouchEvent is propagated. Also added a hint, which specifies if gestures in any state can be propagated to the widget which has enabled the hint. Reviewed-by: Thomas Zander --- src/corelib/global/qnamespace.h | 12 +++- src/corelib/global/qnamespace.qdoc | 18 ++++- src/gui/graphicsview/qgraphicsscene.cpp | 13 +++- src/gui/kernel/qapplication.cpp | 7 +- src/gui/kernel/qgesturemanager.cpp | 16 ++++- tests/auto/gestures/tst_gestures.cpp | 121 +++++++++++++++++++++++++------- 6 files changed, 150 insertions(+), 37 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index aeaca54..561ffc1 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1715,14 +1715,19 @@ public: LastGestureType = ~0u }; - enum GestureContext + enum GestureContextFlag { WidgetGesture = 0, WidgetWithChildrenGesture = 3, - ItemGesture = WidgetGesture, - ItemWithChildrenGesture = WidgetWithChildrenGesture + ItemGesture = WidgetGesture, + ItemWithChildrenGesture = WidgetWithChildrenGesture, + + GestureContext_Mask = 0x00ff, + AcceptPartialGesturesHint = 0x0100, + GestureContextHint_Mask = 0xff00 }; + Q_DECLARE_FLAGS(GestureContext, GestureContextFlag) enum NavigationMode { @@ -1757,6 +1762,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MatchFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TextInteractionFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodHints) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TouchPointStates) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureContext) typedef bool (*qInternalCallback)(void **); diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 3fcbe57..f2a8882 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2917,11 +2917,11 @@ QApplication::registerGestureRecognizer() function which generates a custom gesture ID in the range of values from CustomGesture to LastGestureType. - \sa QGesture, QWidget::grabGesture() + \sa QGesture, QWidget::grabGesture(), QGraphicsObject::grabGesture() */ /*! - \enum Qt::GestureContext + \enum Qt::GestureContextFlag \since 4.6 This enum type describes the context of a gesture. @@ -2937,7 +2937,19 @@ \value ItemWithChildrenGesture Gestures can start on the item or over any of its children. - \sa QWidget::grabGesture() + \value AcceptPartialGesturesHint Allows any ignored gesture events to be + propagated to parent widgets which have specified this hint. By default + only gestures that are in the Qt::GestureStarted state are propagated and + the widget only gets the full gesture sequence starting with a gesture in + the Qt::GestureStarted state and ending with a gesture in the + Qt::GestureFinished or Qt::GestureCanceled states. + + \value GestureContext_Mask A mask for extracting the context type of the + context flags. + \value GestureContextHint_Mask A mask for extracting additional hints for + the context. + + \sa QWidget::grabGesture(), QGraphicsObject::grabGesture() */ /*! diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 9279fe3..f5bb408 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5900,7 +5900,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func(); foreach(QGesture *g, alreadyIgnoredGestures) { - if (gid->gestureContext.contains(g->gestureType())) + QMap::iterator contextit = + gid->gestureContext.find(g->gestureType()); + bool deliver = contextit != gid->gestureContext.end() && + (g->state() == Qt::GestureStarted || + (contextit.value() & Qt::GestureContextHint_Mask) & Qt::AcceptPartialGesturesHint); + if (deliver) gestures += g; } if (gestures.isEmpty()) @@ -5913,8 +5918,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) sendEvent(item, &ev); QSet ignoredGestures; foreach (QGesture *g, gestures) { - if (!ev.isAccepted() && !ev.isAccepted(g)) + if (!ev.isAccepted() && !ev.isAccepted(g)) { ignoredGestures.insert(g); + } else { + if (g->state() == Qt::GestureStarted) + gestureTargets[g] = item; + } } if (!ignoredGestures.isEmpty()) { // get a list of items under the (current) hotspot of each ignored diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 06787eb..b9e7d52 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4161,7 +4161,12 @@ bool QApplication::notify(QObject *receiver, QEvent *e) for (int i = 0; i < allGestures.size();) { QGesture *g = allGestures.at(i); Qt::GestureType type = g->gestureType(); - if (wd->gestureContext.contains(type)) { + QMap::iterator contextit = + wd->gestureContext.find(type); + bool deliver = contextit != wd->gestureContext.end() && + (g->state() == Qt::GestureStarted || w == receiver || + (contextit.value() & Qt::GestureContextHint_Mask) & Qt::AcceptPartialGesturesHint); + if (deliver) { allGestures.removeAt(i); gestures.append(g); } else { diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 318d4b5..e4a1eb4 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -448,7 +448,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) { for (ContextIterator it = w->d_func()->gestureContext.begin(), e = w->d_func()->gestureContext.end(); it != e; ++it) { - if (it.value() == Qt::WidgetWithChildrenGesture) { + if ((it.value() & Qt::GestureContext_Mask) == Qt::WidgetWithChildrenGesture) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(w, it.key()); @@ -482,7 +482,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) typedef QMap::const_iterator ContextIterator; for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { - if (it.value() == Qt::ItemWithChildrenGesture) { + if ((it.value() & Qt::GestureContext_Mask) == Qt::ItemWithChildrenGesture) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(item, it.key()); @@ -525,7 +525,7 @@ void QGestureManager::getGestureTargets(const QSet &gestures, = w->d_func()->gestureContext.find(type); if (it != w->d_func()->gestureContext.end()) { // i.e. 'w' listens to gesture 'type' - Qt::GestureContext context = it.value(); + Qt::GestureContext context = it.value() & Qt::GestureContext_Mask; if (context == Qt::WidgetWithChildrenGesture && w != widget) { // conflicting gesture! (*conflicts)[widget].append(gestures[widget]); @@ -645,6 +645,16 @@ void QGestureManager::deliverEvents(const QSet &gestures, << "gestures:" << it.value(); QGestureEvent event(it.value()); QApplication::sendEvent(it.key(), &event); + bool eventAccepted = event.isAccepted(); + foreach (QGesture *gesture, event.allGestures()) { + if (gesture->state() == Qt::GestureStarted && + (eventAccepted || event.isAccepted(gesture))) { + QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0); + Q_ASSERT(w); + DEBUG() << "started gesture was delivered and accepted by" << w; + m_gestureTargets[gesture] = w; + } + } } } } diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 79de823..9b2bc57 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -543,7 +543,9 @@ void tst_Gestures::conflictingGestures() parent.reset(); child->reset(); - // nobody accepts the override, we will send normal events to the closest context (to the child) + // nobody accepts the override, we will send normal events to the closest + // context (i.e. to the child widget) and it will be propagated and + // accepted by the parent widget parent.acceptGestureOverride = false; child->acceptGestureOverride = false; child->ignoredGestures << CustomGesture::GestureType; @@ -552,6 +554,41 @@ void tst_Gestures::conflictingGestures() sendCustomGesture(&event, child); QCOMPARE(child->gestureOverrideEventsReceived, 1); + QCOMPARE(child->gestureEventsReceived, 1); + QCOMPARE(parent.gestureOverrideEventsReceived, 1); + QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); + + parent.reset(); + child->reset(); + + // nobody accepts the override, and nobody accepts the gesture event + parent.acceptGestureOverride = false; + child->acceptGestureOverride = false; + parent.ignoredGestures << CustomGesture::GestureType; + child->ignoredGestures << CustomGesture::GestureType; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(&event, child); + + QCOMPARE(child->gestureOverrideEventsReceived, 1); + QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureOverrideEventsReceived, 1); + QCOMPARE(parent.gestureEventsReceived, 1); + + parent.reset(); + child->reset(); + + // we set an attribute to make sure all gesture events are propagated + parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint); + parent.acceptGestureOverride = false; + child->acceptGestureOverride = false; + parent.ignoredGestures << CustomGesture::GestureType; + child->ignoredGestures << CustomGesture::GestureType; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(&event, child); + + QCOMPARE(child->gestureOverrideEventsReceived, 1); QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(parent.gestureOverrideEventsReceived, 1); QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); @@ -851,7 +888,7 @@ void tst_Gestures::graphicsItemTreeGesture() QCOMPARE(item1_child2->gestureEventsReceived, 0); QCOMPARE(item1_child2->gestureOverrideEventsReceived, 0); QCOMPARE(item1->gestureOverrideEventsReceived, 1); - QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureEventsReceived, 1); } void tst_Gestures::explicitGraphicsObjectTarget() @@ -966,7 +1003,39 @@ void tst_Gestures::gestureOverChildGraphicsItem() event.hasHotSpot = true; sendCustomGesture(&event, item0, &scene); - QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item2_child1->gestureEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item2->gestureEventsReceived, 1); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + + item0->reset(); item1->reset(); item2->reset(); item2_child1->reset(); + item2->grabGesture(CustomGesture::GestureType); + item2->ignoredGestures << CustomGesture::GestureType; + item1->ignoredGestures << CustomGesture::GestureType; + + event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + + QCOMPARE(item2_child1->gestureEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, 1); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + + item0->reset(); item1->reset(); item2->reset(); item2_child1->reset(); + item2->grabGesture(CustomGesture::GestureType); + item2->ignoredGestures << CustomGesture::GestureType; + item1->ignoredGestures << CustomGesture::GestureType; + item1->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint); + + event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + QCOMPARE(item2_child1->gestureEventsReceived, 0); QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); @@ -1025,15 +1094,16 @@ void tst_Gestures::multipleGesturesInTree() Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1 3] - A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | - B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // B [ 2 3] - B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | - C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // C [1 2 3] - C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // | - C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // D [1 3] - D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); + Qt::GestureContext context = Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint; + A->grabGesture(FirstGesture, context); // A [1 3] + A->grabGesture(ThirdGesture, context); // | + B->grabGesture(SecondGesture, context); // B [ 2 3] + B->grabGesture(ThirdGesture, context); // | + C->grabGesture(FirstGesture, context); // C [1 2 3] + C->grabGesture(SecondGesture, context); // | + C->grabGesture(ThirdGesture, context); // D [1 3] + D->grabGesture(FirstGesture, context); + D->grabGesture(ThirdGesture, context); // make sure all widgets ignore events, so they get propagated. A->ignoredGestures << FirstGesture << ThirdGesture; @@ -1100,19 +1170,20 @@ void tst_Gestures::multipleGesturesInComplexTree() Qt::GestureType SixthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); Qt::GestureType SeventhGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1,3,4] - A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | - A->grabGesture(FourthGesture, Qt::WidgetWithChildrenGesture); // B [2,3,5] - B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // | - B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // C [1,2,3,6] - B->grabGesture(FifthGesture, Qt::WidgetWithChildrenGesture); // | - C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // D [1,3,7] - C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); - C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); - C->grabGesture(SixthGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(SeventhGesture, Qt::WidgetWithChildrenGesture); + Qt::GestureContext context = Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint; + A->grabGesture(FirstGesture, context); // A [1,3,4] + A->grabGesture(ThirdGesture, context); // | + A->grabGesture(FourthGesture, context); // B [2,3,5] + B->grabGesture(SecondGesture, context); // | + B->grabGesture(ThirdGesture, context); // C [1,2,3,6] + B->grabGesture(FifthGesture, context); // | + C->grabGesture(FirstGesture, context); // D [1,3,7] + C->grabGesture(SecondGesture, context); + C->grabGesture(ThirdGesture, context); + C->grabGesture(SixthGesture, context); + D->grabGesture(FirstGesture, context); + D->grabGesture(ThirdGesture, context); + D->grabGesture(SeventhGesture, context); // make sure all widgets ignore events, so they get propagated. QSet allGestureTypes; -- cgit v0.12 From 93e9bc06427c6a8e1b6d6f939cf53ae5c95e0827 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 2 Nov 2009 19:26:44 +0100 Subject: Gesture api review. Changes to the gesture api after the review. Reviewed-by: Jasmin Blanchette --- doc/src/frameworks-technologies/gestures.qdoc | 14 +- examples/gestures/imagegestures/imagewidget.cpp | 6 +- src/corelib/global/qnamespace.h | 17 +- src/corelib/global/qnamespace.qdoc | 36 ++-- src/gui/graphicsview/qgraphicsitem.cpp | 6 +- src/gui/graphicsview/qgraphicsitem.h | 2 +- src/gui/graphicsview/qgraphicsitem_p.h | 2 +- src/gui/graphicsview/qgraphicsscene.cpp | 16 +- src/gui/kernel/qapplication.cpp | 54 +----- src/gui/kernel/qapplication.h | 4 - src/gui/kernel/qapplication_p.h | 2 - src/gui/kernel/qevent.cpp | 22 ++- src/gui/kernel/qevent.h | 4 +- src/gui/kernel/qgesture.cpp | 89 +++++---- src/gui/kernel/qgesture.h | 21 +- src/gui/kernel/qgesture_p.h | 10 +- src/gui/kernel/qgesturemanager.cpp | 44 +++-- src/gui/kernel/qgesturemanager_p.h | 3 +- src/gui/kernel/qgesturerecognizer.cpp | 86 ++++++--- src/gui/kernel/qgesturerecognizer.h | 25 ++- src/gui/kernel/qstandardgestures.cpp | 63 +++--- src/gui/kernel/qstandardgestures_p.h | 9 +- src/gui/kernel/qwidget.cpp | 8 +- src/gui/kernel/qwidget.h | 2 +- src/gui/kernel/qwidget_p.h | 2 +- src/gui/widgets/qplaintextedit.cpp | 8 +- tests/auto/gestures/tst_gestures.cpp | 212 ++++++++++----------- tests/manual/gestures/graphicsview/gestures.cpp | 24 +-- tests/manual/gestures/graphicsview/gestures.h | 8 +- tests/manual/gestures/graphicsview/main.cpp | 10 +- .../graphicsview/mousepangesturerecognizer.cpp | 25 +-- .../graphicsview/mousepangesturerecognizer.h | 4 +- tests/manual/gestures/scrollarea/main.cpp | 20 +- .../scrollarea/mousepangesturerecognizer.cpp | 25 +-- .../scrollarea/mousepangesturerecognizer.h | 4 +- 35 files changed, 441 insertions(+), 446 deletions(-) diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index f64e301..2fa8dab 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -122,7 +122,7 @@ \section2 Filtering Input Events - The \l{QGestureRecognizer::}{filterEvent()} function must be reimplemented. + The \l{QGestureRecognizer::}{recognize()} function must be reimplemented. This function handles and filters the incoming input events for the target objects and determines whether or not they correspond to the gesture the recognizer is looking for. @@ -132,15 +132,15 @@ persistent information about the state of the recognition process in the QGesture object supplied. - Your \l{QGestureRecognizer::}{filterEvent()} function must return a value of - Qt::GestureState that indicates the state of recognition for a given gesture and + Your \l{QGestureRecognizer::}{recognize()} function must return a value of + QGestureRecognizer::Result that indicates the state of recognition for a given gesture and target object. This determines whether or not a gesture event will be delivered to a target object. \section2 Custom Gestures If you choose to represent a gesture by a custom QGesture subclass, you will need to - reimplement the \l{QGestureRecognizer::}{createGesture()} function to construct + reimplement the \l{QGestureRecognizer::}{create()} function to construct instances of your gesture class instead of standard QGesture instances. Alternatively, you may want to use standard QGesture instances, but add additional dynamic properties to them to express specific details of the gesture you want to handle. @@ -152,7 +152,7 @@ \l{QGestureRecognizer::}{reset()} function to perform these special tasks. Note that QGesture objects are only created once for each combination of target object - and gesture type, and they are reused every time the user attempts to perform the + and gesture type, and they might be reused every time the user attempts to perform the same gesture type on the target object. As a result, it can be useful to reimplement the \l{QGestureRecognizer::}{reset()} function to clean up after each previous attempt at recognizing a gesture. @@ -162,8 +162,8 @@ To use a gesture recognizer, construct an instance of your QGestureRecognizer subclass, and register it with the application with - QApplication::registerGestureRecognizer(). A recognizer for a given type of - gesture can be removed with QApplication::unregisterGestureRecognizer(). + QGestureRecognizer::registerRecognizer(). A recognizer for a given type of + gesture can be removed with QGestureRecognizer::unregisterRecognizer(). \section1 Further Reading diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index c798fcc..da9daae 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -132,13 +132,13 @@ void ImageWidget::panTriggered(QPanGesture *gesture) void ImageWidget::pinchTriggered(QPinchGesture *gesture) { - QPinchGesture::WhatChanged whatChanged = gesture->whatChanged(); - if (whatChanged & QPinchGesture::RotationAngleChanged) { + QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags(); + if (changeFlags & QPinchGesture::RotationAngleChanged) { qreal value = gesture->property("rotationAngle").toReal(); qreal lastValue = gesture->property("lastRotationAngle").toReal(); rotationAngle += value - lastValue; } - if (whatChanged & QPinchGesture::ScaleFactorChanged) { + if (changeFlags & QPinchGesture::ScaleFactorChanged) { qreal value = gesture->property("scaleFactor").toReal(); qreal lastValue = gesture->property("lastScaleFactor").toReal(); scaleFactor += value - lastValue; diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 561ffc1..efa6cc7 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1715,19 +1715,12 @@ public: LastGestureType = ~0u }; - enum GestureContextFlag + enum GestureFlag { - WidgetGesture = 0, - WidgetWithChildrenGesture = 3, - - ItemGesture = WidgetGesture, - ItemWithChildrenGesture = WidgetWithChildrenGesture, - - GestureContext_Mask = 0x00ff, - AcceptPartialGesturesHint = 0x0100, - GestureContextHint_Mask = 0xff00 + DontStartGestureOnChildren = 0x01, + ReceivePartialGestures = 0x02 }; - Q_DECLARE_FLAGS(GestureContext, GestureContextFlag) + Q_DECLARE_FLAGS(GestureFlags, GestureFlag) enum NavigationMode { @@ -1762,7 +1755,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MatchFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TextInteractionFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodHints) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TouchPointStates) -Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureContext) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureFlags) typedef bool (*qInternalCallback)(void **); diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f2a8882..a00a72b 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2910,45 +2910,35 @@ \value PanGesture A Pan gesture. \value PinchGesture A Pinch gesture. \value SwipeGesture A Swipe gesture. - \value CustomGesture User-defined gesture ID. - \value LastGestureType Last user gesture ID. + \value CustomGesture A flag that can be used to test if the gesture is a + user-defined gesture ID. + \omitvalue LastGestureType User-defined gestures are registered with the - QApplication::registerGestureRecognizer() function which generates a custom gesture ID - in the range of values from CustomGesture to LastGestureType. + QGestureRecognizer::registerRecognizer() function which generates a custom + gesture ID with the Qt::CustomGesture flag set. \sa QGesture, QWidget::grabGesture(), QGraphicsObject::grabGesture() */ /*! - \enum Qt::GestureContextFlag + \enum Qt::GestureFlag \since 4.6 - This enum type describes the context of a gesture. + This enum type describes additional flags that can be used when subscribing + to a gesture. - For a QGesture to trigger, the gesture recognizer should filter events for - a widget tree. This enum describes for which widget the gesture recognizer - should filter events: + \value DontStartGestureOnChildren By default gestures can start on the + widget or over any of its children. Use this flag to disable this and allow + a gesture to start on the widget only. - \value WidgetGesture Gestures can only start over the widget itself. - \value WidgetWithChildrenGesture Gestures can start on the widget or over - any of its children. - \value ItemGesture Gestures can only start over the item itself. - \value ItemWithChildrenGesture Gestures can start on the item or over - any of its children. - - \value AcceptPartialGesturesHint Allows any ignored gesture events to be + \value ReceivePartialGestures Allows any ignored gesture events to be propagated to parent widgets which have specified this hint. By default only gestures that are in the Qt::GestureStarted state are propagated and - the widget only gets the full gesture sequence starting with a gesture in + the widget always gets the full gesture sequence starting with a gesture in the Qt::GestureStarted state and ending with a gesture in the Qt::GestureFinished or Qt::GestureCanceled states. - \value GestureContext_Mask A mask for extracting the context type of the - context flags. - \value GestureContextHint_Mask A mask for extracting additional hints for - the context. - \sa QWidget::grabGesture(), QGraphicsObject::grabGesture() */ diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 58d7e7d..72f08d5 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7320,14 +7320,14 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent } /*! - Subscribes the graphics object to the given \a gesture for the specified \a context. + Subscribes the graphics object to the given \a gesture with specific \a flags. \sa ungrabGesture(), QGestureEvent */ -void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) +void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) { QGraphicsItemPrivate * const d = QGraphicsItem::d_func(); - d->gestureContext.insert(gesture, context); + d->gestureContext.insert(gesture, flags); (void)QGestureManager::instance(); // create a gesture manager } diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index fc180f3..f091e34 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -555,7 +555,7 @@ public: using QObject::children; #endif - void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::ItemWithChildrenGesture); + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); void ungrabGesture(Qt::GestureType type); Q_SIGNALS: diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 183e95b..90e4631 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -453,7 +453,7 @@ public: QGraphicsItem *focusScopeItem; Qt::InputMethodHints imHints; QGraphicsItem::PanelModality panelModality; - QMap gestureContext; + QMap gestureContext; // Packed 32 bits quint32 acceptedMouseButtons : 5; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index f5bb408..aed2837 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1060,9 +1060,8 @@ bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event) bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event) { if (QGraphicsObject *object = item->toGraphicsObject()) { - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - if (qAppPriv->gestureManager) { - if (qAppPriv->gestureManager->filterEvent(object, event)) + if (qt_gestureManager) { + if (qt_gestureManager->filterEvent(object, event)) return true; } } @@ -5761,7 +5760,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QWidget *viewport = event->widget(); if (!viewport) return; - QList allGestures = event->allGestures(); + QList allGestures = event->gestures(); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" << "Delivering gestures:" << allGestures; @@ -5900,11 +5899,11 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func(); foreach(QGesture *g, alreadyIgnoredGestures) { - QMap::iterator contextit = + QMap::iterator contextit = gid->gestureContext.find(g->gestureType()); bool deliver = contextit != gid->gestureContext.end() && (g->state() == Qt::GestureStarted || - (contextit.value() & Qt::GestureContextHint_Mask) & Qt::AcceptPartialGesturesHint); + (contextit.value() & Qt::ReceivePartialGestures)); if (deliver) gestures += g; } @@ -6046,10 +6045,9 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidge } } - QGestureManager *gm = QApplicationPrivate::instance()->gestureManager; - Q_ASSERT(gm); // it would be very odd if we got called without a manager. + Q_ASSERT(qt_gestureManager); // it would be very odd if we got called without a manager. for (setIter = canceledGestures.begin(); setIter != canceledGestures.end(); ++setIter) { - gm->recycle(*setIter); + qt_gestureManager->recycle(*setIter); gestureTargets.remove(*setIter); } } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index b9e7d52..60ab05a 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -154,14 +154,6 @@ bool QApplicationPrivate::autoSipEnabled = false; bool QApplicationPrivate::autoSipEnabled = true; #endif -QGestureManager* QGestureManager::instance() -{ - QApplicationPrivate *d = qApp->d_func(); - if (!d->gestureManager) - d->gestureManager = new QGestureManager(qApp); - return d->gestureManager; -} - QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type) : QCoreApplicationPrivate(argc, argv) { @@ -185,7 +177,6 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T directPainters = 0; #endif - gestureManager = 0; gestureWidget = 0; if (!self) @@ -3632,12 +3623,12 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } // walk through parents and check for gestures - if (d->gestureManager) { + if (qt_gestureManager) { if (receiver->isWidgetType()) { - if (d->gestureManager->filterEvent(static_cast(receiver), e)) + if (qt_gestureManager->filterEvent(static_cast(receiver), e)) return true; } else if (QGesture *gesture = qobject_cast(receiver)) { - if (d->gestureManager->filterEvent(gesture, e)) + if (qt_gestureManager->filterEvent(gesture, e)) return true; } } @@ -4150,7 +4141,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) if (receiver->isWidgetType()) { QWidget *w = static_cast(receiver); QGestureEvent *gestureEvent = static_cast(e); - QList allGestures = gestureEvent->allGestures(); + QList allGestures = gestureEvent->gestures(); bool eventAccepted = gestureEvent->isAccepted(); bool wasAccepted = eventAccepted; @@ -4161,11 +4152,11 @@ bool QApplication::notify(QObject *receiver, QEvent *e) for (int i = 0; i < allGestures.size();) { QGesture *g = allGestures.at(i); Qt::GestureType type = g->gestureType(); - QMap::iterator contextit = + QMap::iterator contextit = wd->gestureContext.find(type); bool deliver = contextit != wd->gestureContext.end() && (g->state() == Qt::GestureStarted || w == receiver || - (contextit.value() & Qt::GestureContextHint_Mask) & Qt::AcceptPartialGesturesHint); + (contextit.value() & Qt::ReceivePartialGestures)); if (deliver) { allGestures.removeAt(i); gestures.append(g); @@ -5616,39 +5607,6 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints); } -/*! - \since 4.6 - - Registers the given \a recognizer in the gesture framework and returns a gesture ID - for it. - - The application takes ownership of the \a recognizer and returns the gesture type - ID associated with it. For gesture recognizers which handle custom QGesture - objects (i.e., those which return Qt::CustomGesture in a QGesture::gestureType() - function) the return value is a gesture ID between Qt::CustomGesture and - Qt::LastGestureType, inclusive. - - \sa unregisterGestureRecognizer(), QGestureRecognizer::createGesture(), QGesture -*/ -Qt::GestureType QApplication::registerGestureRecognizer(QGestureRecognizer *recognizer) -{ - return QGestureManager::instance()->registerGestureRecognizer(recognizer); -} - -/*! - \since 4.6 - - Unregisters all gesture recognizers of the specified \a type. - - \sa registerGestureRecognizer() -*/ -void QApplication::unregisterGestureRecognizer(Qt::GestureType type) -{ - QApplicationPrivate *d = qApp->d_func(); - if (d->gestureManager) - d->gestureManager->unregisterGestureRecognizer(type); -} - QT_END_NAMESPACE #include "moc_qapplication.cpp" diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 5877ba4..e8c1281 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -86,7 +86,6 @@ class QSymbianEvent; class QApplication; class QApplicationPrivate; -class QGestureRecognizer; #if defined(qApp) #undef qApp #endif @@ -288,9 +287,6 @@ public: static Qt::NavigationMode navigationMode(); #endif - static Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer); - static void unregisterGestureRecognizer(Qt::GestureType type); - Q_SIGNALS: void lastWindowClosed(); void focusChanged(QWidget *old, QWidget *now); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 2c57238..8df4d08 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -84,7 +84,6 @@ class QInputContext; class QObject; class QWidget; class QSocketNotifier; -class QGestureManager; extern bool qt_is_gui_used; #ifndef QT_NO_CLIPBOARD @@ -510,7 +509,6 @@ public: void sendSyntheticEnterLeave(QWidget *widget); #endif - QGestureManager *gestureManager; QWidget *gestureWidget; QMap widgetForTouchPointId; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 6757fa2..763b681 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4202,7 +4202,7 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T \brief The QGestureEvent class provides the description of triggered gestures. The QGestureEvent class contains a list of gestures, which can be obtained using the - allGestures() function. + gestures() function. The gestures are either active or canceled. A list of those that are currently being executed can be obtained using the activeGestures() function. A list of those which @@ -4211,10 +4211,11 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T focus, for example, or because of a timeout, or for other reasons. If the event handler does not accept the event by calling the generic - QEvent::accept() function, all individual QGesture object that were not accepted - will be propagated up the parent widget chain until a widget accepts them - individually, by calling QGestureEvent::accept() for each of them, or an event - filter consumes the event. + QEvent::accept() function, all individual QGesture object that were not + accepted and in the Qt::GestureStarted state will be propagated up the + parent widget chain until a widget accepts them individually, by calling + QGestureEvent::accept() for each of them, or an event filter consumes the + event. \sa QGesture, QGestureRecognizer, QWidget::grabGesture(), QGraphicsObject::grabGesture() @@ -4240,7 +4241,7 @@ QGestureEvent::~QGestureEvent() /*! Returns all gestures that are delivered in the event. */ -QList QGestureEvent::allGestures() const +QList QGestureEvent::gestures() const { return d_func()->gestures; } @@ -4417,11 +4418,16 @@ QWidget *QGestureEvent::widget() const } /*! - Returns the scene-local coordinates if the \a gesturePoint is inside a graphics view. + Returns the scene-local coordinates if the \a gesturePoint is inside a + graphics view. + + This functional might be useful when the gesture event is delivered to a + QGraphicsObject to translate a point in screen coordinates to scene-local + coordinates. \sa QPointF::isNull(). */ -QPointF QGestureEvent::mapToScene(const QPointF &gesturePoint) const +QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const { QWidget *w = widget(); if (w) // we get the viewport as widget, not the graphics view diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index fb245c0..dfd0f33 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -827,7 +827,7 @@ public: QGestureEvent(const QList &gestures); ~QGestureEvent(); - QList allGestures() const; + QList gestures() const; QGesture *gesture(Qt::GestureType type) const; QList activeGestures() const; @@ -859,7 +859,7 @@ public: void setWidget(QWidget *widget); QWidget *widget() const; - QPointF mapToScene(const QPointF &gesturePoint) const; + QPointF mapToGraphicsScene(const QPointF &gesturePoint) const; private: QGestureEventPrivate *d_func(); diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index df99746..e322af2 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE Gesture objects are not constructed directly by developers. They are created by the QGestureRecognizer object that is registered with the application; see - QApplication::registerGestureRecognizer(). + QGestureRecognizer::registerRecognizer(). \section1 Gesture Properties @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE destroy particular instances of them and create new ones to replace them. The registered gesture recognizer monitors the input events for the target - object via its \l{QGestureRecognizer::}{filterEvent()} function, updating the + object via its \l{QGestureRecognizer::}{recognize()} function, updating the properties of the gesture object as required. The gesture object may be delivered to the target object in a QGestureEvent if @@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE Constructs a new gesture object with the given \a parent. QGesture objects are created by gesture recognizers in the - QGestureRecognizer::createGesture() function. + QGestureRecognizer::create() function. */ QGesture::QGesture(QObject *parent) : QObject(*new QGesturePrivate, parent) @@ -129,7 +129,7 @@ QGesture::~QGesture() \brief The point that is used to find the receiver for the gesture event. The hot-spot is a point in the global coordinate system, use - QWidget::mapFromGlobal() or QGestureEvent::mapToScene() to get a + QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a local hot-spot. The hot-spot should be set by the gesture recognizer to allow gesture event @@ -180,8 +180,10 @@ void QGesture::unsetHotSpot() automatically. \value CancelNone On accepting this gesture no other gestures will be affected. - \value CancelAllInContext On accepting this gesture all gestures that are active - in the context (Qt::GestureContext) will be cancelled. + + \value CancelAllInContext On accepting this gesture all gestures that are + active in the context (respecting the Qt::GestureFlag that were specified + when subscribed to the gesture) will be cancelled. */ void QGesture::setGestureCancelPolicy(GestureCancelPolicy policy) @@ -208,15 +210,6 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const */ /*! - \property QPanGesture::totalOffset - \brief the total offset from the first input position to the current input - position - - The total offset measures the total change in position of the user's input - covered by the gesture on the input device. -*/ - -/*! \property QGesture::gestureCancelPolicy \brief the policy for deciding what happens on accepting a gesture @@ -241,11 +234,19 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const /*! \property QPanGesture::offset - \brief the offset from the previous input position to the current input + \brief the total offset from the first input position to the current input position - The offset measures the change in position of the user's input on the - input device. + The offset measures the total change in position of the user's input + covered by the gesture on the input device. +*/ + +/*! + \property QPanGesture::delta + \brief the offset from the previous input position to the current input + + This is essentially the same as the difference between offset() and + lastOffset(). */ /*! @@ -261,10 +262,6 @@ QPanGesture::QPanGesture(QObject *parent) d_func()->gestureType = Qt::PanGesture; } -QPointF QPanGesture::totalOffset() const -{ - return d_func()->totalOffset; -} QPointF QPanGesture::lastOffset() const { @@ -276,15 +273,15 @@ QPointF QPanGesture::offset() const return d_func()->offset; } -qreal QPanGesture::acceleration() const +QPointF QPanGesture::delta() const { - return d_func()->acceleration; + Q_D(const QPanGesture); + return d->offset - d->lastOffset; } - -void QPanGesture::setTotalOffset(const QPointF &value) +qreal QPanGesture::acceleration() const { - d_func()->totalOffset = value; + return d_func()->acceleration; } void QPanGesture::setLastOffset(const QPointF &value) @@ -326,7 +323,7 @@ void QPanGesture::setAcceleration(qreal value) */ /*! - \enum QPinchGesture::WhatChange + \enum QPinchGesture::ChangeFlag This enum describes the changes that can occur to the properties of the gesture object. @@ -335,19 +332,30 @@ void QPanGesture::setAcceleration(qreal value) \value RotationAngleChanged The rotation angle held by rotationAngle changed. \value CenterPointChanged The center point held by centerPoint changed. - \sa whatChanged + \sa changeFlags, totalChangeFlags +*/ + +/*! + \property QPinchGesture::totalChangeFlags + \brief the property of the gesture that has change + + This property indicates which of the other properties has changed since the + gesture has started. You can use this information to determine which aspect + of your user interface needs to be updated. + + \sa changeFlags, scaleFactor, rotationAngle, centerPoint */ /*! - \property QPinchGesture::whatChanged - \brief the property of the gesture that has changed + \property QPinchGesture::changeFlags + \brief the property of the gesture that has changed in the current step This property indicates which of the other properties has changed since the previous gesture event included information about this gesture. You can use this information to determine which aspect of your user interface needs to be updated. - \sa scaleFactor, rotationAngle, centerPoint + \sa totalChangeFlags, scaleFactor, rotationAngle, centerPoint */ /*! @@ -441,16 +449,25 @@ QPinchGesture::QPinchGesture(QObject *parent) d_func()->gestureType = Qt::PinchGesture; } -QPinchGesture::WhatChanged QPinchGesture::whatChanged() const +QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const +{ + return d_func()->totalChangeFlags; +} + +void QPinchGesture::setTotalChangeFlags(QPinchGesture::ChangeFlags value) { - return d_func()->whatChanged; + d_func()->totalChangeFlags = value; } -void QPinchGesture::setWhatChanged(QPinchGesture::WhatChanged value) +QPinchGesture::ChangeFlags QPinchGesture::changeFlags() const { - d_func()->whatChanged = value; + return d_func()->changeFlags; } +void QPinchGesture::setChangeFlags(QPinchGesture::ChangeFlags value) +{ + d_func()->changeFlags = value; +} QPointF QPinchGesture::startCenterPoint() const { diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 8614ecb..dd322ad 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -106,20 +106,19 @@ class Q_GUI_EXPORT QPanGesture : public QGesture Q_OBJECT Q_DECLARE_PRIVATE(QPanGesture) - Q_PROPERTY(QPointF totalOffset READ totalOffset WRITE setTotalOffset) Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset) Q_PROPERTY(QPointF offset READ offset WRITE setOffset) + Q_PROPERTY(QPointF delta READ delta STORED false) Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration) public: QPanGesture(QObject *parent = 0); - QPointF totalOffset() const; QPointF lastOffset() const; QPointF offset() const; + QPointF delta() const; qreal acceleration() const; - void setTotalOffset(const QPointF &value); void setLastOffset(const QPointF &value); void setOffset(const QPointF &value); void setAcceleration(qreal value); @@ -135,14 +134,15 @@ class Q_GUI_EXPORT QPinchGesture : public QGesture Q_DECLARE_PRIVATE(QPinchGesture) public: - enum WhatChange { + enum ChangeFlag { ScaleFactorChanged = 0x1, RotationAngleChanged = 0x2, CenterPointChanged = 0x4 }; - Q_DECLARE_FLAGS(WhatChanged, WhatChange) + Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) - Q_PROPERTY(WhatChanged whatChanged READ whatChanged WRITE setWhatChanged) + Q_PROPERTY(ChangeFlags totalChangeFlags READ totalChangeFlags WRITE setTotalChangeFlags) + Q_PROPERTY(ChangeFlags changeFlags READ changeFlags WRITE setChangeFlags) Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor) Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor) @@ -159,8 +159,11 @@ public: public: QPinchGesture(QObject *parent = 0); - WhatChanged whatChanged() const; - void setWhatChanged(WhatChanged value); + ChangeFlags totalChangeFlags() const; + void setTotalChangeFlags(ChangeFlags value); + + ChangeFlags changeFlags() const; + void setChangeFlags(ChangeFlags value); QPointF startCenterPoint() const; QPointF lastCenterPoint() const; @@ -188,7 +191,7 @@ public: QT_END_NAMESPACE -Q_DECLARE_METATYPE(QPinchGesture::WhatChanged) +Q_DECLARE_METATYPE(QPinchGesture::ChangeFlags) QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 73a6bcf..96fd64d 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -90,7 +90,6 @@ public: { } - QPointF totalOffset; QPointF lastOffset; QPointF offset; QPoint lastPosition; @@ -103,12 +102,15 @@ class QPinchGesturePrivate : public QGesturePrivate public: QPinchGesturePrivate() - : whatChanged(0), totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0), - totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0) + : totalChangeFlags(0), changeFlags(0), + totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0), + totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0), + isNewSequence(true) { } - QPinchGesture::WhatChanged whatChanged; + QPinchGesture::ChangeFlags totalChangeFlags; + QPinchGesture::ChangeFlags changeFlags; QPointF startCenterPoint; QPointF lastCenterPoint; diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index e4a1eb4..d2939f0 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -67,6 +67,15 @@ QT_BEGIN_NAMESPACE +QGestureManager *qt_gestureManager = 0; + +QGestureManager* QGestureManager::instance() +{ + if (!qt_gestureManager) + qt_gestureManager = new QGestureManager(qApp); + return qt_gestureManager; +} + QGestureManager::QGestureManager(QObject *parent) : QObject(parent), state(NotGesture), m_lastCustomGestureId(0) { @@ -99,7 +108,7 @@ QGestureManager::~QGestureManager() Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer) { - QGesture *dummy = recognizer->createGesture(0); + QGesture *dummy = recognizer->create(0); if (!dummy) { qWarning("QGestureManager::registerGestureRecognizer: " "the recognizer fails to create a gesture object, skipping registration."); @@ -179,7 +188,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni } Q_ASSERT(recognizer); - QGesture *state = recognizer->createGesture(object); + QGesture *state = recognizer->create(object); if (!state) return 0; state->setParent(this); @@ -226,18 +235,19 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHashfilterEvent(state, target, event); + QGestureRecognizer::Result result = recognizer->recognize(state, target, event); QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask; - if (type == QGestureRecognizer::GestureTriggered) { + result &= QGestureRecognizer::ResultHint_Mask; + if (type == QGestureRecognizer::TriggerGesture) { DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state; triggeredGestures << state; - } else if (type == QGestureRecognizer::GestureFinished) { + } else if (type == QGestureRecognizer::FinishGesture) { DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state; finishedGestures << state; - } else if (type == QGestureRecognizer::MaybeGesture) { + } else if (type == QGestureRecognizer::MayBeGesture) { DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state; newMaybeGestures << state; - } else if (type == QGestureRecognizer::NotGesture) { + } else if (type == QGestureRecognizer::CancelGesture) { DEBUG() << "QGestureManager:Recognizer: not gesture: " << state; notGestures << state; } else if (type == QGestureRecognizer::Ignore) { @@ -434,7 +444,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) QSet types; QMultiHash contexts; QWidget *w = receiver; - typedef QMap::const_iterator ContextIterator; + typedef QMap::const_iterator ContextIterator; if (!w->d_func()->gestureContext.isEmpty()) { for(ContextIterator it = w->d_func()->gestureContext.begin(), e = w->d_func()->gestureContext.end(); it != e; ++it) { @@ -448,7 +458,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) { for (ContextIterator it = w->d_func()->gestureContext.begin(), e = w->d_func()->gestureContext.end(); it != e; ++it) { - if ((it.value() & Qt::GestureContext_Mask) == Qt::WidgetWithChildrenGesture) { + if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(w, it.key()); @@ -468,7 +478,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) QMultiHash contexts; QGraphicsObject *item = receiver; if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) { - typedef QMap::const_iterator ContextIterator; + typedef QMap::const_iterator ContextIterator; for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { types.insert(it.key()); @@ -479,10 +489,10 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) item = item->parentObject(); while (item) { - typedef QMap::const_iterator ContextIterator; + typedef QMap::const_iterator ContextIterator; for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { - if ((it.value() & Qt::GestureContext_Mask) == Qt::ItemWithChildrenGesture) { + if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(item, it.key()); @@ -521,12 +531,12 @@ void QGestureManager::getGestureTargets(const QSet &gestures, foreach (QWidget *widget, gestures.keys()) { QWidget *w = widget->parentWidget(); while (w) { - QMap::const_iterator it + QMap::const_iterator it = w->d_func()->gestureContext.find(type); if (it != w->d_func()->gestureContext.end()) { // i.e. 'w' listens to gesture 'type' - Qt::GestureContext context = it.value() & Qt::GestureContext_Mask; - if (context == Qt::WidgetWithChildrenGesture && w != widget) { + Qt::GestureFlags flags = it.value(); + if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) { // conflicting gesture! (*conflicts)[widget].append(gestures[widget]); break; @@ -620,7 +630,7 @@ void QGestureManager::deliverEvents(const QSet &gestures, QApplication::sendEvent(receiver, &event); bool eventAccepted = event.isAccepted(); - foreach(QGesture *gesture, event.allGestures()) { + foreach(QGesture *gesture, event.gestures()) { if (eventAccepted || event.isAccepted(gesture)) { QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0); Q_ASSERT(w); @@ -646,7 +656,7 @@ void QGestureManager::deliverEvents(const QSet &gestures, QGestureEvent event(it.value()); QApplication::sendEvent(it.key(), &event); bool eventAccepted = event.isAccepted(); - foreach (QGesture *gesture, event.allGestures()) { + foreach (QGesture *gesture, event.gestures()) { if (gesture->state() == Qt::GestureStarted && (eventAccepted || event.isAccepted(gesture))) { QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0); diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index d60aedc..27cc8fc 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -76,7 +76,6 @@ public: bool filterEvent(QGesture *receiver, QEvent *event); bool filterEvent(QGraphicsObject *receiver, QEvent *event); - // declared in qapplication.cpp static QGestureManager* instance(); void cleanupCachedGestures(QObject *target, Qt::GestureType type); @@ -141,6 +140,8 @@ private: void cancelGesturesForChildren(QGesture *originatingGesture); }; +extern QGestureManager *qt_gestureManager; + QT_END_NAMESPACE #endif // QGESTUREMANAGER_P_H diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 2673be3..ed0bdcc 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -42,6 +42,7 @@ #include "qgesturerecognizer.h" #include "private/qgesture_p.h" +#include "private/qgesturemanager_p.h" QT_BEGIN_NAMESPACE @@ -65,12 +66,12 @@ QT_BEGIN_NAMESPACE objects, and modifying the associated QGesture objects to include relevant information about the user's input. - Gestures are created when the framework calls createGesture() to handle user input + Gestures are created when the framework calls create() to handle user input for a particular instance of a QWidget or QGraphicsObject subclass. A QGesture object is created for each widget or item that is configured to use gestures. Once a QGesture has been created for a target object, the gesture recognizer will - receive events for it in its filterEvent() handler function. + receive events for it in its recognize() handler function. When a gesture is canceled, the reset() function is called, giving the recognizer the chance to update the appropriate properties in the corresponding QGesture object. @@ -79,20 +80,22 @@ QT_BEGIN_NAMESPACE To add support for new gestures, you need to derive from QGestureRecognizer to create a custom recognizer class, construct an instance of this class, and register it with - the application by calling QApplication::registerGestureRecognizer(). You can also + the application by calling QGestureRecognizer::registerRecognizer(). You can also subclass QGesture to create a custom gesture class, or rely on dynamic properties to express specific details of the gesture you want to handle. - Your custom QGestureRecognizer subclass needs to reimplement the filterEvent() function - to handle and filter the incoming input events for QWidget and QGraphicsObject subclasses. - Although the logic for gesture recognition is implemented in this function, you can - store persistent information about the state of the recognition process in the QGesture - object supplied. The filterEvent() function must return a value of Qt::GestureState that - indicates the state of recognition for a given gesture and target object. This determines - whether or not a gesture event will be delivered to a target object. + Your custom QGestureRecognizer subclass needs to reimplement the recognize() + function to handle and filter the incoming input events for QWidget and + QGraphicsObject subclasses. Although the logic for gesture recognition is + implemented in this function, you can store persistent information about the + state of the recognition process in the QGesture object supplied. The + recognize() function must return a value of QGestureRecognizer::Result that + indicates the state of recognition for a given gesture and target object. + This determines whether or not a gesture event will be delivered to a target + object. If you choose to represent a gesture by a custom QGesture subclass, you will need to - reimplement the createGesture() function to construct instances of your gesture class. + reimplement the create() function to construct instances of your gesture class. Similarly, you may need to reimplement the reset() function if your custom gesture objects need to be specially handled when a gesture is canceled. @@ -105,37 +108,37 @@ QT_BEGIN_NAMESPACE This enum describes the result of the current event filtering step in a gesture recognizer state machine. - The result consists of a state value (one of Ignore, NotGesture, - MaybeGesture, GestureTriggered, GestureFinished) and an optional hint + The result consists of a state value (one of Ignore, MayBeGesture, + TriggerGesture, FinishGesture, CancelGesture) and an optional hint (ConsumeEventHint). \value Ignore The event does not change the state of the recognizer. - \value NotGesture The event made it clear that it is not a gesture. If the - gesture recognizer was in GestureTriggered state before, then the gesture - is canceled and the appropriate QGesture object will be delivered to the - target as a part of a QGestureEvent. - - \value MaybeGesture The event changed the internal state of the recognizer, + \value MayBeGesture The event changed the internal state of the recognizer, but it isn't clear yet if it is a gesture or not. The recognizer needs to - filter more events to decide. Gesture recognizers in the MaybeGesture state + filter more events to decide. Gesture recognizers in the MayBeGesture state may be reset automatically if they take too long to recognize gestures. - \value GestureTriggered The gesture has been triggered and the appropriate + \value TriggerGesture The gesture has been triggered and the appropriate QGesture object will be delivered to the target as a part of a QGestureEvent. - \value GestureFinished The gesture has been finished successfully and the + \value FinishGesture The gesture has been finished successfully and the appropriate QGesture object will be delivered to the target as a part of a QGestureEvent. - \value ConsumeEventHint This hint specifies that the gesture framework should - consume the filtered event and not deliver it to the receiver. + \value CancelGesture The event made it clear that it is not a gesture. If + the gesture recognizer was in GestureTriggered state before, then the + gesture is canceled and the appropriate QGesture object will be delivered + to the target as a part of a QGestureEvent. + + \value ConsumeEventHint This hint specifies that the gesture framework + should consume the filtered event and not deliver it to the receiver. \omitvalue ResultState_Mask \omitvalue ResultHint_Mask - \sa QGestureRecognizer::filterEvent() + \sa QGestureRecognizer::recognize() */ /*! @@ -159,7 +162,7 @@ QGestureRecognizer::~QGestureRecognizer() Reimplement this function to create a custom QGesture-derived gesture object if necessary. */ -QGesture *QGestureRecognizer::createGesture(QObject *target) +QGesture *QGestureRecognizer::create(QObject *target) { Q_UNUSED(target); return new QGesture; @@ -183,7 +186,7 @@ void QGestureRecognizer::reset(QGesture *gesture) } /*! - \fn QGestureRecognizer::filterEvent(QGesture *gesture, QObject *watched, QEvent *event) + \fn QGestureRecognizer::recognize(QGesture *gesture, QObject *watched, QEvent *event) Handles the given \a event for the \a watched object, updating the state of the \a gesture object as required, and returns a suitable result for the current recognition step. @@ -194,7 +197,34 @@ void QGestureRecognizer::reset(QGesture *gesture) The result reflects how much of the gesture has been recognized. The state of the \a gesture object is set depending on the result. - \sa Qt::GestureState + \sa QGestureRecognizer::Result +*/ + +/*! + Registers the given \a recognizer in the gesture framework and returns a gesture ID + for it. + + The application takes ownership of the \a recognizer and returns the gesture type + ID associated with it. For gesture recognizers which handle custom QGesture + objects (i.e., those which return Qt::CustomGesture in a QGesture::gestureType() + function) the return value is a generated gesture ID with the Qt::CustomGesture + flag set. + + \sa unregisterRecognizer(), QGestureRecognizer::create(), QGesture */ +Qt::GestureType QGestureRecognizer::registerRecognizer(QGestureRecognizer *recognizer) +{ + return QGestureManager::instance()->registerGestureRecognizer(recognizer); +} + +/*! + Unregisters all gesture recognizers of the specified \a type. + + \sa registerRecognizer() +*/ +void QGestureRecognizer::unregisterRecognizer(Qt::GestureType type) +{ + QGestureManager::instance()->unregisterGestureRecognizer(type); +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h index a3c990d..4eebf7c 100644 --- a/src/gui/kernel/qgesturerecognizer.h +++ b/src/gui/kernel/qgesturerecognizer.h @@ -43,6 +43,7 @@ #define QGESTURERECOGNIZER_H #include +#include QT_BEGIN_HEADER @@ -58,30 +59,34 @@ class Q_GUI_EXPORT QGestureRecognizer public: enum ResultFlag { - Ignore = 0x0001, - NotGesture = 0x0002, - MaybeGesture = 0x0004, - GestureTriggered = 0x0008, // Gesture started or updated - GestureFinished = 0x0010, + Ignore = 0x0001, - ResultState_Mask = 0x00ff, + MayBeGesture = 0x0002, + TriggerGesture = 0x0004, + FinishGesture = 0x0008, + CancelGesture = 0x0010, + + ResultState_Mask = 0x00ff, ConsumeEventHint = 0x0100, // StoreEventHint = 0x0200, // ReplayStoredEventsHint = 0x0400, // DiscardStoredEventsHint = 0x0800, - ResultHint_Mask = 0xff00 + ResultHint_Mask = 0xff00 }; Q_DECLARE_FLAGS(Result, ResultFlag) QGestureRecognizer(); virtual ~QGestureRecognizer(); - virtual QGesture *createGesture(QObject *target); - virtual QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event) = 0; - + virtual QGesture *create(QObject *target); + virtual Result recognize(QGesture *state, QObject *watched, + QEvent *event) = 0; virtual void reset(QGesture *state); + + static Qt::GestureType registerRecognizer(QGestureRecognizer *recognizer); + static void unregisterRecognizer(Qt::GestureType type); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGestureRecognizer::Result) diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 57cf12d..ba00a90 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -52,7 +52,7 @@ QPanGestureRecognizer::QPanGestureRecognizer() { } -QGesture *QPanGestureRecognizer::createGesture(QObject *target) +QGesture *QPanGestureRecognizer::create(QObject *target) { if (target && target->isWidgetType()) { #if defined(Q_OS_WIN) @@ -66,21 +66,21 @@ QGesture *QPanGestureRecognizer::createGesture(QObject *target) return new QPanGesture; } -QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { - QPanGesture *q = static_cast(state); + QPanGesture *q = static_cast(state); QPanGesturePrivate *d = q->d_func(); - const QTouchEvent *ev = static_cast(event); + const QTouchEvent *ev = static_cast(event); QGestureRecognizer::Result result; switch (event->type()) { case QEvent::TouchBegin: { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; QTouchEvent::TouchPoint p = ev->touchPoints().at(0); d->lastPosition = p.pos().toPoint(); - d->lastOffset = d->totalOffset = d->offset = QPointF(); + d->lastOffset = d->offset = QPointF(); break; } case QEvent::TouchEnd: { @@ -90,13 +90,12 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); d->lastOffset = d->offset; d->offset = - QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), - p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2; - d->totalOffset += d->offset; + QPointF(p1.pos().x() - p1.startPos().x() + p2.pos().x() - p2.startPos().x(), + p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2; } - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; } else { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } break; } @@ -106,14 +105,13 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); d->lastOffset = d->offset; d->offset = - QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), - p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2; - d->totalOffset += d->offset; - if (d->totalOffset.x() > 10 || d->totalOffset.y() > 10 || - d->totalOffset.x() < -10 || d->totalOffset.y() < -10) { - result = QGestureRecognizer::GestureTriggered; + QPointF(p1.pos().x() - p1.startPos().x() + p2.pos().x() - p2.startPos().x(), + p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2; + if (d->offset.x() > 10 || d->offset.y() > 10 || + d->offset.x() < -10 || d->offset.y() < -10) { + result = QGestureRecognizer::TriggerGesture; } else { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; } } break; @@ -135,7 +133,7 @@ void QPanGestureRecognizer::reset(QGesture *state) QPanGesture *pan = static_cast(state); QPanGesturePrivate *d = pan->d_func(); - d->totalOffset = d->lastOffset = d->offset = QPointF(); + d->lastOffset = d->offset = QPointF(); d->lastPosition = QPoint(); d->acceleration = 0; @@ -151,7 +149,7 @@ QPinchGestureRecognizer::QPinchGestureRecognizer() { } -QGesture *QPinchGestureRecognizer::createGesture(QObject *target) +QGesture *QPinchGestureRecognizer::create(QObject *target) { if (target && target->isWidgetType()) { static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); @@ -159,7 +157,7 @@ QGesture *QPinchGestureRecognizer::createGesture(QObject *target) return new QPinchGesture; } -QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { QPinchGesture *q = static_cast(state); QPinchGesturePrivate *d = q->d_func(); @@ -170,19 +168,19 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, switch (event->type()) { case QEvent::TouchBegin: { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; break; } case QEvent::TouchEnd: { if (q->state() != Qt::NoGesture) { - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; } else { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } break; } case QEvent::TouchUpdate: { - d->whatChanged = 0; + d->changeFlags = 0; if (ev->touchPoints().size() == 2) { QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0); QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); @@ -201,7 +199,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, d->lastCenterPoint = d->centerPoint; d->centerPoint = centerPoint; - d->whatChanged |= QPinchGesture::CenterPointChanged; + d->changeFlags |= QPinchGesture::CenterPointChanged; const qreal scaleFactor = QLineF(p1.pos(), p2.pos()).length() / QLineF(d->startPosition[0], d->startPosition[1]).length(); @@ -212,7 +210,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, } d->scaleFactor = scaleFactor; d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor; - d->whatChanged |= QPinchGesture::ScaleFactorChanged; + d->changeFlags |= QPinchGesture::ScaleFactorChanged; const qreal rotationAngle = -line.angle(); if (d->isNewSequence) @@ -221,13 +219,14 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, d->lastRotationAngle = d->rotationAngle; d->rotationAngle = rotationAngle; d->totalRotationAngle += d->rotationAngle - d->lastRotationAngle; - d->whatChanged |= QPinchGesture::RotationAngleChanged; + d->changeFlags |= QPinchGesture::RotationAngleChanged; + d->totalChangeFlags |= d->changeFlags; d->isNewSequence = false; - result = QGestureRecognizer::GestureTriggered; + result = QGestureRecognizer::TriggerGesture; } else { d->isNewSequence = true; - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; } break; } @@ -245,10 +244,10 @@ QGestureRecognizer::Result QPinchGestureRecognizer::filterEvent(QGesture *state, void QPinchGestureRecognizer::reset(QGesture *state) { - QPinchGesture *pinch = static_cast(state); + QPinchGesture *pinch = static_cast(state); QPinchGesturePrivate *d = pinch->d_func(); - d->whatChanged = 0; + d->totalChangeFlags = d->changeFlags = 0; d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF(); d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 0; diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index 827b2a2..e6f346c 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -63,9 +63,8 @@ class QPanGestureRecognizer : public QGestureRecognizer public: QPanGestureRecognizer(); - QGesture *createGesture(QObject *target); - - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; @@ -74,9 +73,9 @@ class QPinchGestureRecognizer : public QGestureRecognizer public: QPinchGestureRecognizer(); - QGesture *createGesture(QObject *target); + QGesture *create(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 00d9a99..25284e4 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11711,20 +11711,20 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const */ /*! - Subscribes the widget to a given \a gesture with a \a context. + Subscribes the widget to a given \a gesture with specific \a flags. \sa ungrabGesture(), QGestureEvent \since 4.6 */ -void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) +void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) { Q_D(QWidget); - d->gestureContext.insert(gesture, context); + d->gestureContext.insert(gesture, flags); (void)QGestureManager::instance(); // create a gesture manager } /*! - Unsubscribes the widget to a given \a gesture type + Unsubscribes the widget from a given \a gesture type \sa grabGesture(), QGestureEvent \since 4.6 diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index fce3f09..05f0069 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -354,7 +354,7 @@ public: QGraphicsEffect *graphicsEffect() const; void setGraphicsEffect(QGraphicsEffect *effect); - void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::WidgetWithChildrenGesture); + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); void ungrabGesture(Qt::GestureType type); public Q_SLOTS: diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 616a972..dd859a7 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -631,7 +631,7 @@ public: #ifndef QT_NO_ACTION QList actions; #endif - QMap gestureContext; + QMap gestureContext; // Bit fields. uint high_attributes[3]; // the low ones are in QWidget::widget_attributes diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 0e5ee46..44feaaf 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -1458,15 +1458,15 @@ bool QPlainTextEdit::event(QEvent *e) QScrollBar *vBar = verticalScrollBar(); if (g->state() == Qt::GestureStarted) d->originalOffsetY = vBar->value(); - QPointF totalOffset = g->totalOffset(); - if (!totalOffset.isNull()) { + QPointF offset = g->offset(); + if (!offset.isNull()) { if (QApplication::isRightToLeft()) - totalOffset.rx() *= -1; + offset.rx() *= -1; // QPlainTextEdit scrolls by lines only in vertical direction QFontMetrics fm(document()->defaultFont()); int lineHeight = fm.height(); int newX = hBar->value() - g->lastOffset().x(); - int newY = d->originalOffsetY - totalOffset.y()/lineHeight; + int newY = d->originalOffsetY - offset.y()/lineHeight; hBar->setValue(newX); vBar->setValue(newY); } diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 9b2bc57..20b53f2 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -111,12 +111,12 @@ public: CustomEvent::EventType = QEvent::registerEventType(); } - QGesture* createGesture(QObject *) + QGesture* create(QObject *) { return new CustomGesture; } - QGestureRecognizer::Result filterEvent(QGesture *state, QObject*o , QEvent *event) + QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result = 0; @@ -128,13 +128,13 @@ public: if (e->hasHotSpot) g->setHotSpot(e->hotSpot); if (g->serial >= CustomGesture::SerialFinishedThreshold) - result |= QGestureRecognizer::GestureFinished; + result |= QGestureRecognizer::FinishGesture; else if (g->serial >= CustomGesture::SerialStartedThreshold) - result |= QGestureRecognizer::GestureTriggered; + result |= QGestureRecognizer::TriggerGesture; else if (g->serial >= CustomGesture::SerialMaybeThreshold) - result |= QGestureRecognizer::MaybeGesture; + result |= QGestureRecognizer::MayBeGesture; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; return result; } return QGestureRecognizer::Ignore; @@ -142,7 +142,7 @@ public: void reset(QGesture *state) { - CustomGesture *g = static_cast(state); + CustomGesture *g = static_cast(state); g->serial = 0; QGestureRecognizer::reset(state); } @@ -159,26 +159,26 @@ public: CustomEvent::EventType = QEvent::registerEventType(); } - QGesture* createGesture(QObject *) + QGesture* create(QObject *) { return new CustomGesture; } - QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event) + QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result = QGestureRecognizer::ConsumeEventHint; - CustomGesture *g = static_cast(state); - CustomEvent *e = static_cast(event); + CustomGesture *g = static_cast(state); + CustomEvent *e = static_cast(event); g->serial = e->serial; if (e->hasHotSpot) g->setHotSpot(e->hotSpot); if (g->serial >= CustomGesture::SerialFinishedThreshold) - result |= QGestureRecognizer::GestureFinished; + result |= QGestureRecognizer::FinishGesture; else if (g->serial >= CustomGesture::SerialMaybeThreshold) - result |= QGestureRecognizer::GestureTriggered; + result |= QGestureRecognizer::TriggerGesture; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; return result; } return QGestureRecognizer::Ignore; @@ -186,7 +186,7 @@ public: void reset(QGesture *state) { - CustomGesture *g = static_cast(state); + CustomGesture *g = static_cast(state); g->serial = 0; QGestureRecognizer::reset(state); } @@ -256,7 +256,7 @@ protected: } if (eventsPtr) { QGestureEvent *e = static_cast(event); - QList gestures = e->allGestures(); + QList gestures = e->gestures(); foreach(QGesture *g, gestures) { eventsPtr->all << g->gestureType(); switch(g->state()) { @@ -345,14 +345,14 @@ tst_Gestures::~tst_Gestures() void tst_Gestures::initTestCase() { - CustomGesture::GestureType = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + CustomGesture::GestureType = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); QVERIFY(CustomGesture::GestureType != Qt::GestureType(0)); QVERIFY(CustomGesture::GestureType != Qt::CustomGesture); } void tst_Gestures::cleanupTestCase() { - QApplication::unregisterGestureRecognizer(CustomGesture::GestureType); + QGestureRecognizer::unregisterRecognizer(CustomGesture::GestureType); } void tst_Gestures::init() @@ -366,7 +366,7 @@ void tst_Gestures::cleanup() void tst_Gestures::customGesture() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); CustomEvent event; sendCustomGesture(&event, &widget); @@ -387,7 +387,7 @@ void tst_Gestures::customGesture() void tst_Gestures::consumeEventHint() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); CustomGestureRecognizer::ConsumeEvents = true; CustomEvent event; @@ -400,7 +400,7 @@ void tst_Gestures::consumeEventHint() void tst_Gestures::autoCancelingGestures() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); // send partial gesture. The gesture will be in the "maybe" state, but will // never get enough events to fire, so Qt will have to kill it. CustomEvent ev; @@ -424,7 +424,7 @@ void tst_Gestures::gestureOverChild() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); CustomEvent event; sendCustomGesture(&event, child); @@ -440,7 +440,7 @@ void tst_Gestures::gestureOverChild() QCOMPARE(widget.gestureOverrideEventsReceived, 0); // enable gestures over the children - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + widget.grabGesture(CustomGesture::GestureType); widget.reset(); child->reset(); @@ -469,8 +469,8 @@ void tst_Gestures::multipleWidgetOnlyGestureInTree() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - child->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + parent.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + child->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; @@ -507,8 +507,8 @@ void tst_Gestures::conflictingGestures() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType); + child->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -579,7 +579,7 @@ void tst_Gestures::conflictingGestures() child->reset(); // we set an attribute to make sure all gesture events are propagated - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint); + parent.grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); parent.acceptGestureOverride = false; child->acceptGestureOverride = false; parent.ignoredGestures << CustomGesture::GestureType; @@ -596,7 +596,7 @@ void tst_Gestures::conflictingGestures() parent.reset(); child->reset(); - Qt::GestureType ContinuousGesture = QApplication::registerGestureRecognizer(new CustomContinuousGestureRecognizer); + Qt::GestureType ContinuousGesture = QGestureRecognizer::registerRecognizer(new CustomContinuousGestureRecognizer); static const int ContinuousGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; child->grabGesture(ContinuousGesture); // child accepts override. And it also receives another custom gesture. @@ -610,13 +610,13 @@ void tst_Gestures::conflictingGestures() QCOMPARE(parent.gestureOverrideEventsReceived, 0); QCOMPARE(parent.gestureEventsReceived, 0); - QApplication::unregisterGestureRecognizer(ContinuousGesture); + QGestureRecognizer::unregisterRecognizer(ContinuousGesture); } void tst_Gestures::finishedWithoutStarted() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); // the gesture will claim it finished, but it was never started. CustomEvent ev; @@ -636,9 +636,9 @@ void tst_Gestures::finishedWithoutStarted() void tst_Gestures::unknownGesture() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - widget.grabGesture(Qt::CustomGesture, Qt::WidgetGesture); - widget.grabGesture(Qt::GestureType(Qt::PanGesture+512), Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + widget.grabGesture(Qt::CustomGesture, Qt::DontStartGestureOnChildren); + widget.grabGesture(Qt::GestureType(Qt::PanGesture+512), Qt::DontStartGestureOnChildren); CustomEvent event; sendCustomGesture(&event, &widget); @@ -740,7 +740,7 @@ protected: } if (eventsPtr) { QGestureEvent *e = static_cast(event); - QList gestures = e->allGestures(); + QList gestures = e->gestures(); foreach(QGesture *g, gestures) { eventsPtr->all << g->gestureType(); switch(g->state()) { @@ -784,7 +784,7 @@ void tst_Gestures::graphicsItemGesture() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -858,7 +858,7 @@ void tst_Gestures::graphicsItemTreeGesture() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item1->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -916,10 +916,10 @@ void tst_Gestures::explicitGraphicsObjectTarget() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - item1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); - item2->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); - item2_child1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item2->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item2_child1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -976,7 +976,7 @@ void tst_Gestures::gestureOverChildGraphicsItem() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item1->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -1030,7 +1030,7 @@ void tst_Gestures::gestureOverChildGraphicsItem() item2->grabGesture(CustomGesture::GestureType); item2->ignoredGestures << CustomGesture::GestureType; item1->ignoredGestures << CustomGesture::GestureType; - item1->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint); + item1->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); event.hasHotSpot = true; @@ -1051,10 +1051,10 @@ void tst_Gestures::twoGesturesOnDifferentLevel() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType); + child->grabGesture(SecondGesture); CustomEvent event; // sending events that form a gesture to one widget, but they will be @@ -1079,7 +1079,7 @@ void tst_Gestures::twoGesturesOnDifferentLevel() for(int i = 0; i < child->events.all.size(); ++i) QCOMPARE(parent.events.all.at(i), CustomGesture::GestureType); - QApplication::unregisterGestureRecognizer(SecondGesture); + QGestureRecognizer::unregisterRecognizer(SecondGesture); } void tst_Gestures::multipleGesturesInTree() @@ -1091,19 +1091,19 @@ void tst_Gestures::multipleGesturesInTree() GestureWidget *D = new GestureWidget("D", C); Qt::GestureType FirstGesture = CustomGesture::GestureType; - Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - - Qt::GestureContext context = Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint; - A->grabGesture(FirstGesture, context); // A [1 3] - A->grabGesture(ThirdGesture, context); // | - B->grabGesture(SecondGesture, context); // B [ 2 3] - B->grabGesture(ThirdGesture, context); // | - C->grabGesture(FirstGesture, context); // C [1 2 3] - C->grabGesture(SecondGesture, context); // | - C->grabGesture(ThirdGesture, context); // D [1 3] - D->grabGesture(FirstGesture, context); - D->grabGesture(ThirdGesture, context); + Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType ThirdGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + + Qt::GestureFlags flags = Qt::ReceivePartialGestures; + A->grabGesture(FirstGesture, flags); // A [1 3] + A->grabGesture(ThirdGesture, flags); // | + B->grabGesture(SecondGesture, flags); // B [ 2 3] + B->grabGesture(ThirdGesture, flags); // | + C->grabGesture(FirstGesture, flags); // C [1 2 3] + C->grabGesture(SecondGesture, flags); // | + C->grabGesture(ThirdGesture, flags); // D [1 3] + D->grabGesture(FirstGesture, flags); + D->grabGesture(ThirdGesture, flags); // make sure all widgets ignore events, so they get propagated. A->ignoredGestures << FirstGesture << ThirdGesture; @@ -1150,8 +1150,8 @@ void tst_Gestures::multipleGesturesInTree() QCOMPARE(A->events.all.count(SecondGesture), 0); QCOMPARE(A->events.all.count(ThirdGesture), TotalGestureEventsCount); - QApplication::unregisterGestureRecognizer(SecondGesture); - QApplication::unregisterGestureRecognizer(ThirdGesture); + QGestureRecognizer::unregisterRecognizer(SecondGesture); + QGestureRecognizer::unregisterRecognizer(ThirdGesture); } void tst_Gestures::multipleGesturesInComplexTree() @@ -1163,27 +1163,27 @@ void tst_Gestures::multipleGesturesInComplexTree() GestureWidget *D = new GestureWidget("D", C); Qt::GestureType FirstGesture = CustomGesture::GestureType; - Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType FourthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType FifthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType SixthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType SeventhGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - - Qt::GestureContext context = Qt::WidgetWithChildrenGesture | Qt::AcceptPartialGesturesHint; - A->grabGesture(FirstGesture, context); // A [1,3,4] - A->grabGesture(ThirdGesture, context); // | - A->grabGesture(FourthGesture, context); // B [2,3,5] - B->grabGesture(SecondGesture, context); // | - B->grabGesture(ThirdGesture, context); // C [1,2,3,6] - B->grabGesture(FifthGesture, context); // | - C->grabGesture(FirstGesture, context); // D [1,3,7] - C->grabGesture(SecondGesture, context); - C->grabGesture(ThirdGesture, context); - C->grabGesture(SixthGesture, context); - D->grabGesture(FirstGesture, context); - D->grabGesture(ThirdGesture, context); - D->grabGesture(SeventhGesture, context); + Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType ThirdGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType FourthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType FifthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType SixthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType SeventhGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + + Qt::GestureFlags flags = Qt::ReceivePartialGestures; + A->grabGesture(FirstGesture, flags); // A [1,3,4] + A->grabGesture(ThirdGesture, flags); // | + A->grabGesture(FourthGesture, flags); // B [2,3,5] + B->grabGesture(SecondGesture, flags); // | + B->grabGesture(ThirdGesture, flags); // C [1,2,3,6] + B->grabGesture(FifthGesture, flags); // | + C->grabGesture(FirstGesture, flags); // D [1,3,7] + C->grabGesture(SecondGesture, flags); + C->grabGesture(ThirdGesture, flags); + C->grabGesture(SixthGesture, flags); + D->grabGesture(FirstGesture, flags); + D->grabGesture(ThirdGesture, flags); + D->grabGesture(SeventhGesture, flags); // make sure all widgets ignore events, so they get propagated. QSet allGestureTypes; @@ -1247,12 +1247,12 @@ void tst_Gestures::multipleGesturesInComplexTree() QCOMPARE(A->events.all.count(SixthGesture), 0); QCOMPARE(A->events.all.count(SeventhGesture), 0); - QApplication::unregisterGestureRecognizer(SecondGesture); - QApplication::unregisterGestureRecognizer(ThirdGesture); - QApplication::unregisterGestureRecognizer(FourthGesture); - QApplication::unregisterGestureRecognizer(FifthGesture); - QApplication::unregisterGestureRecognizer(SixthGesture); - QApplication::unregisterGestureRecognizer(SeventhGesture); + QGestureRecognizer::unregisterRecognizer(SecondGesture); + QGestureRecognizer::unregisterRecognizer(ThirdGesture); + QGestureRecognizer::unregisterRecognizer(FourthGesture); + QGestureRecognizer::unregisterRecognizer(FifthGesture); + QGestureRecognizer::unregisterRecognizer(SixthGesture); + QGestureRecognizer::unregisterRecognizer(SeventhGesture); } void tst_Gestures::testMapToScene() @@ -1261,7 +1261,7 @@ void tst_Gestures::testMapToScene() QList list; list << &gesture; QGestureEvent event(list); - QCOMPARE(event.mapToScene(gesture.hotSpot()), QPointF()); // not set, can't do much + QCOMPARE(event.mapToGraphicsScene(gesture.hotSpot()), QPointF()); // not set, can't do much QGraphicsScene scene; QGraphicsView view(&scene); @@ -1278,7 +1278,7 @@ void tst_Gestures::testMapToScene() QPoint origin = view.mapToGlobal(QPoint()); event.setWidget(view.viewport()); - QCOMPARE(event.mapToScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200))); + QCOMPARE(event.mapToGraphicsScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200))); } void tst_Gestures::ungrabGesture() // a method on QWidget @@ -1296,7 +1296,7 @@ void tst_Gestures::ungrabGesture() // a method on QWidget if (event->type() == QEvent::Gesture) { QGestureEvent *gestureEvent = static_cast(event); if (gestureEvent) - foreach (QGesture *g, gestureEvent->allGestures()) + foreach (QGesture *g, gestureEvent->gestures()) gestures.insert(g); } return GestureWidget::event(event); @@ -1307,8 +1307,8 @@ void tst_Gestures::ungrabGesture() // a method on QWidget MockGestureWidget *a = &parent; MockGestureWidget *b = new MockGestureWidget("B", a); - a->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - b->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + a->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + b->grabGesture(CustomGesture::GestureType); b->ignoredGestures << CustomGesture::GestureType; CustomEvent event; @@ -1375,14 +1375,14 @@ void tst_Gestures::autoCancelGestures() { if (event->type() == QEvent::Gesture) { QGestureEvent *ge = static_cast(event); - Q_ASSERT(ge->allGestures().count() == 1); // can't use QCOMPARE here... - ge->allGestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); + Q_ASSERT(ge->gestures().count() == 1); // can't use QCOMPARE here... + ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); } return GestureWidget::event(event); } }; - const Qt::GestureType secondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + const Qt::GestureType secondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); MockWidget parent("parent"); // this one sets the cancel policy to CancelAllInContext parent.resize(300, 100); @@ -1390,8 +1390,8 @@ void tst_Gestures::autoCancelGestures() GestureWidget *child = new GestureWidget("child", &parent); child->setGeometry(10, 10, 100, 80); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(secondGesture, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType); + child->grabGesture(secondGesture); parent.show(); QTest::qWaitForWindowShown(&parent); @@ -1425,14 +1425,14 @@ void tst_Gestures::autoCancelGestures2() bool event(QEvent *event) { if (event->type() == QEvent::Gesture) { QGestureEvent *ge = static_cast(event); - Q_ASSERT(ge->allGestures().count() == 1); // can't use QCOMPARE here... - ge->allGestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); + Q_ASSERT(ge->gestures().count() == 1); // can't use QCOMPARE here... + ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); } return GestureItem::event(event); } }; - const Qt::GestureType secondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + const Qt::GestureType secondGesture = QGestureRecognizer ::registerRecognizer(new CustomGestureRecognizer); QGraphicsScene scene; QGraphicsView view(&scene); @@ -1444,10 +1444,10 @@ void tst_Gestures::autoCancelGestures2() parent->setPos(0, 0); child->setPos(10, 10); scene.addItem(parent); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - view.viewport()->grabGesture(secondGesture, Qt::WidgetGesture); - parent->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(secondGesture, Qt::WidgetWithChildrenGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + view.viewport()->grabGesture(secondGesture, Qt::DontStartGestureOnChildren); + parent->grabGesture(CustomGesture::GestureType); + child->grabGesture(secondGesture); view.show(); QTest::qWaitForWindowShown(&view); diff --git a/tests/manual/gestures/graphicsview/gestures.cpp b/tests/manual/gestures/graphicsview/gestures.cpp index 5416457..4c21712 100644 --- a/tests/manual/gestures/graphicsview/gestures.cpp +++ b/tests/manual/gestures/graphicsview/gestures.cpp @@ -45,41 +45,41 @@ Qt::GestureType ThreeFingerSlideGesture::Type = Qt::CustomGesture; -QGesture *ThreeFingerSlideGestureRecognizer::createGesture(QObject *) +QGesture *ThreeFingerSlideGestureRecognizer::create(QObject *) { return new ThreeFingerSlideGesture; } -QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { ThreeFingerSlideGesture *d = static_cast(state); QGestureRecognizer::Result result; switch (event->type()) { case QEvent::TouchBegin: - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; case QEvent::TouchEnd: if (d->gestureFired) - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; case QEvent::TouchUpdate: if (d->state() != Qt::NoGesture) { QTouchEvent *ev = static_cast(event); if (ev->touchPoints().size() == 3) { d->gestureFired = true; - result = QGestureRecognizer::GestureTriggered; + result = QGestureRecognizer::TriggerGesture; } else { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; for (int i = 0; i < ev->touchPoints().size(); ++i) { const QTouchEvent::TouchPoint &pt = ev->touchPoints().at(i); const int distance = (pt.pos().toPoint() - pt.startPos().toPoint()).manhattanLength(); if (distance > 20) { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } } } } else { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } break; @@ -89,7 +89,7 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::filterEvent(QGestu if (d->state() != Qt::NoGesture) result = QGestureRecognizer::Ignore; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; break; default: result = QGestureRecognizer::Ignore; @@ -105,12 +105,12 @@ void ThreeFingerSlideGestureRecognizer::reset(QGesture *state) } -QGesture *RotateGestureRecognizer::createGesture(QObject *) +QGesture *RotateGestureRecognizer::create(QObject *) { return new QGesture; } -QGestureRecognizer::Result RotateGestureRecognizer::filterEvent(QGesture *, QObject *, QEvent *event) +QGestureRecognizer::Result RotateGestureRecognizer::recognize(QGesture *, QObject *, QEvent *event) { switch (event->type()) { case QEvent::TouchBegin: diff --git a/tests/manual/gestures/graphicsview/gestures.h b/tests/manual/gestures/graphicsview/gestures.h index 6140b12..8a31b71 100644 --- a/tests/manual/gestures/graphicsview/gestures.h +++ b/tests/manual/gestures/graphicsview/gestures.h @@ -59,8 +59,8 @@ public: class ThreeFingerSlideGestureRecognizer : public QGestureRecognizer { private: - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; @@ -70,8 +70,8 @@ public: RotateGestureRecognizer(); private: - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp index de92afe..f8433b5 100644 --- a/tests/manual/gestures/graphicsview/main.cpp +++ b/tests/manual/gestures/graphicsview/main.cpp @@ -66,11 +66,11 @@ protected: default: qDebug("view: Pan: "); break; } - const QPointF offset = pan->offset(); + const QPointF delta = pan->delta(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); - vbar->setValue(vbar->value() - offset.y()); - hbar->setValue(hbar->value() - offset.x()); + vbar->setValue(vbar->value() - delta.y()); + hbar->setValue(hbar->value() - delta.x()); ge->accept(pan); return true; } @@ -152,8 +152,8 @@ private: MainWindow::MainWindow() { - (void)QApplication::registerGestureRecognizer(new MousePanGestureRecognizer); - ThreeFingerSlideGesture::Type = QApplication::registerGestureRecognizer(new ThreeFingerSlideGestureRecognizer); + (void)QGestureRecognizer::registerRecognizer(new MousePanGestureRecognizer); + ThreeFingerSlideGesture::Type = QGestureRecognizer::registerRecognizer(new ThreeFingerSlideGestureRecognizer); tabWidget = new QTabWidget; diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp index 6cdbe12..82adfbd 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp @@ -51,12 +51,12 @@ MousePanGestureRecognizer::MousePanGestureRecognizer() { } -QGesture* MousePanGestureRecognizer::createGesture(QObject *) +QGesture* MousePanGestureRecognizer::create(QObject *) { return new QPanGesture; } -QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result MousePanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { QPanGesture *g = static_cast(state); QPoint globalPos; @@ -78,23 +78,19 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick || event->type() == QEvent::GraphicsSceneMousePress || event->type() == QEvent::GraphicsSceneMouseDoubleClick) { g->setHotSpot(globalPos); - g->setProperty("lastPos", globalPos); + g->setProperty("startPos", globalPos); g->setProperty("pressed", QVariant::fromValue(true)); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } else if (event->type() == QEvent::MouseMove || event->type() == QEvent::GraphicsSceneMouseMove) { if (g->property("pressed").toBool()) { - QPoint pos = globalPos; - QPoint lastPos = g->property("lastPos").toPoint(); + QPoint offset = globalPos - g->property("startPos").toPoint(); g->setLastOffset(g->offset()); - lastPos = pos - lastPos; - g->setOffset(QPointF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); - g->setProperty("lastPos", pos); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + g->setOffset(QPointF(offset.x(), offset.y())); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } else if (event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::GraphicsSceneMouseRelease) { - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; } return QGestureRecognizer::Ignore; } @@ -102,11 +98,10 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast(state); - g->setTotalOffset(QPointF()); g->setLastOffset(QPointF()); g->setOffset(QPointF()); g->setAcceleration(0); - g->setProperty("lastPos", QVariant()); + g->setProperty("startPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); QGestureRecognizer::reset(state); } diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h index b062fd0..6e04621 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h @@ -49,8 +49,8 @@ class MousePanGestureRecognizer : public QGestureRecognizer public: MousePanGestureRecognizer(); - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture* create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp index 9a5eb02..4f33b28 100644 --- a/tests/manual/gestures/scrollarea/main.cpp +++ b/tests/manual/gestures/scrollarea/main.cpp @@ -50,7 +50,7 @@ public: ScrollArea(QWidget *parent = 0) : QScrollArea(parent), outside(false) { - viewport()->grabGesture(Qt::PanGesture); + viewport()->grabGesture(Qt::PanGesture, Qt::ReceivePartialGestures); } protected: @@ -87,8 +87,8 @@ protected: if (outside) return; - const QPointF offset = pan->offset(); - const QPointF totalOffset = pan->totalOffset(); + const QPointF delta = pan->delta(); + const QPointF totalOffset = pan->offset(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); @@ -102,8 +102,8 @@ protected: outside = true; return; } - vbar->setValue(vbar->value() - offset.y()); - hbar->setValue(hbar->value() - offset.x()); + vbar->setValue(vbar->value() - delta.y()); + hbar->setValue(hbar->value() - delta.x()); event->accept(pan); } } @@ -147,8 +147,8 @@ protected: event->ignore(pan); if (outside) return; - const QPointF offset = pan->offset(); - const QPointF totalOffset = pan->totalOffset(); + const QPointF delta = pan->delta(); + const QPointF totalOffset = pan->offset(); if (orientation() == Qt::Horizontal) { if ((value() == minimum() && totalOffset.x() < -10) || (value() == maximum() && totalOffset.x() > 10)) { @@ -156,7 +156,7 @@ protected: return; } if (totalOffset.y() < 40 && totalOffset.y() > -40) { - setValue(value() + offset.x()); + setValue(value() + delta.x()); event->accept(pan); } else { outside = true; @@ -168,7 +168,7 @@ protected: return; } if (totalOffset.x() < 40 && totalOffset.x() > -40) { - setValue(value() - offset.y()); + setValue(value() - delta.y()); event->accept(pan); } else { outside = true; @@ -232,7 +232,7 @@ private: int main(int argc, char **argv) { QApplication app(argc, argv); - app.registerGestureRecognizer(new MousePanGestureRecognizer); + QGestureRecognizer::registerRecognizer(new MousePanGestureRecognizer); MainWindow w; w.show(); return app.exec(); diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp index ce5ef57..66fcf18 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp @@ -49,12 +49,12 @@ MousePanGestureRecognizer::MousePanGestureRecognizer() { } -QGesture* MousePanGestureRecognizer::createGesture(QObject *) +QGesture *MousePanGestureRecognizer::create(QObject *) { return new QPanGesture; } -QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result MousePanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { QPanGesture *g = static_cast(state); if (event->type() == QEvent::TouchBegin) { @@ -68,24 +68,20 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat if (g->property("ignoreMousePress").toBool()) return QGestureRecognizer::Ignore; g->setHotSpot(me->globalPos()); - g->setProperty("lastPos", me->globalPos()); + g->setProperty("startPos", me->globalPos()); g->setProperty("pressed", QVariant::fromValue(true)); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } else if (event->type() == QEvent::MouseMove) { if (g->property("pressed").toBool()) { - QPoint pos = me->globalPos(); - QPoint lastPos = g->property("lastPos").toPoint(); + QPoint offset = me->globalPos() - g->property("startPos").toPoint(); g->setLastOffset(g->offset()); - lastPos = pos - lastPos; - g->setOffset(QPointF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); - g->setProperty("lastPos", pos); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + g->setOffset(QPointF(offset.x(), offset.y())); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } else if (event->type() == QEvent::MouseButtonRelease) { if (g->property("pressed").toBool()) - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; } return QGestureRecognizer::Ignore; } @@ -93,11 +89,10 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast(state); - g->setTotalOffset(QPointF()); g->setLastOffset(QPointF()); g->setOffset(QPointF()); g->setAcceleration(0); - g->setProperty("lastPos", QVariant()); + g->setProperty("startPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); g->setProperty("ignoreMousePress", QVariant::fromValue(false)); QGestureRecognizer::reset(state); diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h index b062fd0..6e04621 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h @@ -49,8 +49,8 @@ class MousePanGestureRecognizer : public QGestureRecognizer public: MousePanGestureRecognizer(); - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture* create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; -- cgit v0.12 From a3b84f683e0baae34dc37c85a40dcae3e5306419 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 3 Nov 2009 11:24:02 +0100 Subject: QStyleSheetStyle: CE_PushButton Do not call the parent style if we have nothing to draw This fixes the focus rect that appears on buttons with GtkStyle if a stylesheet is used. Task-number: QTBUG-4488 Reviewed-by: Gabriel --- src/gui/styles/qstylesheetstyle.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index a224218..dfe5209 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3325,9 +3325,14 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q break; case CE_PushButton: - ParentStyle::drawControl(ce, opt, p, w); - return; - + if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { + if (rule.hasDrawable() || rule.hasBox() || rule.hasPosition() || rule.hasPalette() || + ((btn->features & QStyleOptionButton::HasMenu) && hasStyleRule(w, PseudoElement_PushButtonMenuIndicator))) { + ParentStyle::drawControl(ce, opt, p, w); + return; + } + } + break; case CE_PushButtonBevel: if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { QStyleOptionButton btnOpt(*btn); -- cgit v0.12 From c8a7b0430120b391e356a821390aaaebacbbb006 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 3 Nov 2009 11:15:38 +0100 Subject: Toolbar Icons are clipped on Leopard in Cocoa port. Scale the pixmap to correct size (16,16) before setting as the image for the Document Icon button. Reviewed-by: Denis --- src/gui/kernel/qwidget_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 79f55a1..9270220 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3026,7 +3026,8 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) if (icon.isNull()) { [iconButton setImage:nil]; } else { - NSImage *image = static_cast(qt_mac_create_nsimage(*pm)); + QPixmap scaled = pm->scaled(QSize(16,16), Qt::KeepAspectRatio, Qt::SmoothTransformation); + NSImage *image = static_cast(qt_mac_create_nsimage(scaled)); [iconButton setImage:image]; [image release]; } -- cgit v0.12 From 14a1a9af8ae1b3d2379e6f8c24536afb20b39509 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 3 Nov 2009 11:16:39 +0100 Subject: Cocoa: fix q3filedialog autotest Q3FileDialog does not exist in the cocoa port. Do ifdef this test out on cocoa Rev-by: prasanth --- tests/auto/q3filedialog/tst_q3filedialog.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/q3filedialog/tst_q3filedialog.cpp b/tests/auto/q3filedialog/tst_q3filedialog.cpp index 2585f60..e2686eb 100644 --- a/tests/auto/q3filedialog/tst_q3filedialog.cpp +++ b/tests/auto/q3filedialog/tst_q3filedialog.cpp @@ -59,7 +59,9 @@ public: virtual ~tst_Q3FileDialog(); private slots: +#ifndef QT_MAC_USE_COCOA void getSetCheck(); +#endif }; tst_Q3FileDialog::tst_Q3FileDialog() @@ -70,6 +72,7 @@ tst_Q3FileDialog::~tst_Q3FileDialog() { } +#ifndef QT_MAC_USE_COCOA class Preview : public QLabel, public Q3FilePreview { public: @@ -125,6 +128,7 @@ void tst_Q3FileDialog::getSetCheck() obj1.setPreviewMode(Q3FileDialog::PreviewMode(Q3FileDialog::Info)); QCOMPARE(obj1.previewMode(), Q3FileDialog::PreviewMode(Q3FileDialog::Info)); } +#endif QTEST_MAIN(tst_Q3FileDialog) #include "tst_q3filedialog.moc" -- cgit v0.12 From 1fd46b4495241ed03371fb5c86965b788791b363 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 11:45:16 +0100 Subject: Embed code examples in state machine overview If you put \snippet inside \code tags, it's interpreted as code, not as a tag. Reviewed-by: Trust me --- doc/src/frameworks-technologies/statemachine.qdoc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index ac10314..9614dd3 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -426,9 +426,8 @@ value of the property before any property assignments in states were executed.) Take the following code: - \code - \snippet doc/src/snippets/statemachine/main5.cpp 0 - \endcode + + \snippet doc/src/snippets/statemachine/main5.cpp 0 Lets say the property \c fooBar is 0.0 when the machine starts. When the machine is in state \c s1, the property will be 1.0, since the state explicitly assigns this value to it. When the @@ -437,9 +436,8 @@ If we are using nested states, the parent defines a value for the property which is inherited by all descendants that do not explicitly assign a value to the property. - \code + \snippet doc/src/snippets/statemachine/main5.cpp 2 - \endcode Here \c s1 has two children: \c s2 and \c s3. When \c s2 is entered, the property \c fooBar will have the value 2.0, since this is explicitly defined for the state. When the machine is in @@ -452,9 +450,8 @@ properties as they are assigned in states. Say we have the following code: - \code + \snippet doc/src/snippets/statemachine/main5.cpp 3 - \endcode Here we define two states of a user interface. In \c s1 the \c button is small, and in \c s2 it is bigger. If we click the button to transition from \c s1 to \c s2, the geometry of the button @@ -462,9 +459,7 @@ smooth, however, all we need to do is make a QPropertyAnimation and add this to the transition object. - \code \snippet doc/src/snippets/statemachine/main5.cpp 4 - \endcode Adding an animation for the property in question means that the property assignment will no longer take immediate effect when the state has been entered. Instead, the animation will start @@ -486,9 +481,8 @@ the value defined by a state. Say we have the following code: - \code + \snippet doc/src/snippets/statemachine/main5.cpp 5 - \endcode When \c button is clicked, the machine will transition into state \c s2, which will set the geometry of the button, and then pop up a message box to alert the user that the geometry has @@ -504,9 +498,8 @@ value, we can use the state's polished() signal. The polished() signal will be emitted when the the property is assigned its final value, whether this is done immediately or after the animation has finished playing. - \code + \snippet doc/src/snippets/statemachine/main5.cpp 6 - \endcode In this example, when \c button is clicked, the machine will enter \c s2. It will remain in state \c s2 until the \c geometry property has been set to \c QRect(0, 0, 50, 50). Then it will -- cgit v0.12 From 1db4a133a9d35e00bad50541fb8d64079a7debea Mon Sep 17 00:00:00 2001 From: Liang QI Date: Tue, 3 Nov 2009 12:05:50 +0100 Subject: Fix tst_qwebpage and tst_qwebframe compilation on Symbian. RevBy: TrustMe --- src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro | 2 +- src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 4 ++++ src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro | 2 +- src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index 4c92e91..df447d8 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -5,6 +5,6 @@ SOURCES += tst_qwebframe.cpp RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/resources\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/resources\\\" symbian:TARGET.UID3 = 0xA000E53D diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 100f272..f8c3440 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -38,6 +38,10 @@ #endif #include "../util.h" +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + //TESTED_CLASS= //TESTED_FILES= diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index 101837a..7d581cd 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -5,6 +5,6 @@ SOURCES += tst_qwebpage.cpp RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian:TARGET.UID3 = 0xA000E53E diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 21b3bc7..51611b0 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -37,6 +37,10 @@ #include #include +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + // Will try to wait for the condition while allowing event processing #define QTRY_COMPARE(__expr, __expected) \ do { \ -- cgit v0.12 From 68be6457f6732437b485812ab2db11c147a24b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 3 Nov 2009 12:15:53 +0100 Subject: Removed usage of CompositionMode_Source in QGraphicsView for X11. Due to the rendering model in XRender ((src IN mask) OP dest) we can't support the PorterDuff composition modes natively under X11. They just behave differently than what we've defined them to do in QPainter, and there is no apparent workaround. Task-number: QTBUG-4829 Reviewed-by: Gunnar --- src/gui/graphicsview/qgraphicsview.cpp | 8 +++++++- src/gui/painting/qpainter.cpp | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 710c745..8945f51 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -281,6 +281,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < #include #include #ifdef Q_WS_X11 +#include #include #endif @@ -3294,7 +3295,12 @@ void QGraphicsView::paintEvent(QPaintEvent *event) backgroundPainter.setClipRegion(d->backgroundPixmapExposed, Qt::ReplaceClip); if (viewTransformed) backgroundPainter.setTransform(viewTransform); - backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source); +#ifdef Q_WS_X11 +#undef X11 + if (backgroundPainter.paintEngine()->type() != QPaintEngine::X11) +#define X11 qt_x11Data +#endif + backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source); drawBackground(&backgroundPainter, exposedSceneRect); d->backgroundPixmapExposed = QRegion(); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index cddad7d..8d6cad3 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2275,8 +2275,9 @@ void QPainter::setBrushOrigin(const QPointF &p) /*! Sets the composition mode to the given \a mode. - \warning You can only set the composition mode for QPainter - objects that operates on a QImage. + \warning Only a QPainter operating on a QImage fully supports all + composition modes. The RasterOp modes are supported for X11 as + described in compositionMode(). \sa compositionMode() */ -- cgit v0.12 From cb396cf4851b961fb42e21866d7467efb3642a04 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 3 Nov 2009 12:45:44 +0100 Subject: Fixed compile error on Symbian emulator. RevBy: Trust me --- src/gui/itemviews/qabstractitemview.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h index 7a0509b..ea5d259 100644 --- a/src/gui/itemviews/qabstractitemview.h +++ b/src/gui/itemviews/qabstractitemview.h @@ -363,6 +363,7 @@ private: friend class QTreeViewPrivate; // needed to compile with MSVC friend class QAccessibleItemRow; friend class QListModeViewBase; + friend class QListViewPrivate; // needed to compile for Symbian emulator }; Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractItemView::EditTriggers) -- cgit v0.12 From dc89c842779f87ce69882ba54fa8d5bb79e0edbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 3 Nov 2009 14:02:03 +0200 Subject: QS60Style: impossible to open menu from styled QToolButton QS60Style ignores toolButton's menu indicator rect. This means that the button's menu cannot be triggered by the user, as the style does not draw the indicator at all. With this fix, style calculates a rect (including margins) for menu indicator and draws that (arrow down) into toolButton (by making the button bevel larger). Task-number: QTBUG-5266 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 949dfcb..350a8e6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -994,6 +994,10 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast(option)) { const State bflags = toolBtn->state; const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget)); + QRect menuRect = QRect(); + if (toolBtn->subControls & SC_ToolButtonMenu) + menuRect = subControlRect(control, toolBtn, SC_ToolButtonMenu, widget); + QStyleOptionToolButton toolButton = *toolBtn; if (sub&SC_ToolButton) { @@ -1006,7 +1010,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom toolBar = qobject_cast(widget->parentWidget()); if (bflags & (State_Sunken | State_On | State_Raised)) { - tool.rect = button; + tool.rect = button.unite(menuRect); tool.state = bflags; // todo: I'd like to move extension button next to where last button is @@ -1061,6 +1065,12 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } else { drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); } + + if (toolButton.subControls & SC_ToolButtonMenu) { + tool.rect = menuRect; + tool.state = bflags; + drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); + } } } @@ -2232,7 +2242,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases case PE_FrameLineEdit: - case PE_IndicatorButtonDropDown: case PE_IndicatorDockWidgetResizeHandle: case PE_PanelTipLabel: case PE_PanelScrollAreaCorner: @@ -2561,6 +2570,29 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple } } break; + case CC_ToolButton: + if (const QStyleOptionToolButton *toolButton = qstyleoption_cast(option)) { + const int indicatorRect = pixelMetric(PM_MenuButtonIndicator, toolButton, widget) + + 2*pixelMetric(PM_ButtonMargin, toolButton, widget); + ret = toolButton->rect; + const bool popup = (toolButton->features & + (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay)) + == QStyleOptionToolButton::MenuButtonPopup; + switch (scontrol) { + case SC_ToolButton: + if (popup) + ret.adjust(0, 0, -indicatorRect, 0); + break; + case SC_ToolButtonMenu: + if (popup) + ret.adjust(ret.width() - indicatorRect, ret.height() - indicatorRect, 0, 0); + break; + default: + break; + } + ret = visualRect(toolButton->direction, toolButton->rect, ret); + } + break; default: ret = QCommonStyle::subControlRect(control, option, scontrol, widget); } -- cgit v0.12 From 0ae2258c6cf89349e795b6af95455e29d2a1fa70 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 30 Oct 2009 17:28:51 +0000 Subject: Fix for unresponsive sliders after orientation switch or full-screen video playback During the switch to full-screen video playback, the following happens: 1. Double-tapping to enable full-screen results in a call to QSymbianControl::HandleLongTapL 2. This modifies the global variable QApplication::mouse_buttons, OR'ing in Qt::RightButton 3. QWidgetPrivate::create_sys, called as a result of the call to setWindowFlags made by Phonon::VideoWIdget::setFullScreen, schedules a delayed deletion of the same control as in step (1) above 4. The control gets deleted before it receives a HandlePointerEventL for the long tap release, which would have removed Qt::RightButton from the mouse_button bitmask 5. In subsequent calls to QSlider::mousePressEvent, the test (ev->buttons() ^ ev->button()) is false, which results in the event being ignored. Ideally, we would fix this by propagating the m_previousEventLongPress flag from the deleted QSymbianControl to the newly created one. However, this does not work because the new control does not receive the HandlePointerEventL callback for the long press release. We therefore fix the bug by checking for m_previousEventLondPress in the QSymbianControl destructor; if it is set, we clear the Qt::RightButton bit from the QApplication::mouse_buttons mask. Note that QTBUG-5309 (Cannot interact with sliders after orientation switch during audio playback) is still seen after applying this patch. Task-number: QTBUG-5242, QTBUG-5308 Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 689429e..e2106ea 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -357,6 +357,9 @@ QSymbianControl::~QSymbianControl() setFocusSafely(false); S60->appUi()->RemoveFromStack(this); delete m_longTapDetector; + + if(m_previousEventLongTap) + QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & ~Qt::RightButton; } void QSymbianControl::setWidget(QWidget *w) -- cgit v0.12 From 159350b766299fee1bfa44410c19500335267fd8 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 13:04:39 +0100 Subject: Fixed crash in QPixmap::fromImage with an Indexed8 without a colortable. Reviewed-by: Trond --- src/gui/image/qpixmap_mac.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index 15350e8..9209d45 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -305,11 +305,15 @@ void QMacPixmapData::fromImage(const QImage &img, } break; } - case QImage::Format_Indexed8: - for (int x = 0; x < w; ++x) { - *(drow+x) = PREMUL(image.color(*(srow + x))); + case QImage::Format_Indexed8: { + int numColors = image.numColors(); + if (numColors > 0) { + for (int x = 0; x < w; ++x) { + int index = *(srow + x); + *(drow+x) = PREMUL(image.color(qMin(index, numColors))); + } } - break; + } break; case QImage::Format_RGB32: for (int x = 0; x < w; ++x) *(drow+x) = *(((quint32*)srow) + x) | 0xFF000000; -- cgit v0.12 From 0c7190fa5b6fd5d401854f689676eee8d8591b75 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 2 Nov 2009 14:08:48 +0000 Subject: Fixed state bug in Phonon MMF backend This fixes a bug introduced by 58efa8aa, which meant that, when a new clip was opened: 1. Playback did not start automatically 2. The current volume setting in the app UI was not applied to the MMF client API Task-number: QTBUG-4999 Reviewed-by: trustme --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 998e861..b8c6fb0 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -373,12 +373,12 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) { TRACE_CONTEXT(AbstractMediaPlayer::changeState, EAudioInternal); - // TODO: add some invariants to check that the transition is valid - AbstractPlayer::changeState(newState); - const Phonon::State oldPhononState = phononState(privateState()); const Phonon::State newPhononState = phononState(newState); + // TODO: add some invariants to check that the transition is valid + AbstractPlayer::changeState(newState); + if (LoadingState == oldPhononState && StoppedState == newPhononState) { // Ensure initial volume is set on MMF API before starting playback doVolumeChanged(); -- cgit v0.12 From 8ffbb2e7bd2ba0b92aef8d7212ddd47bdcc4411e Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 3 Nov 2009 07:43:11 +0000 Subject: Fixed volume calculation in Phonon MMF backend Task-number: QTBUG-4777 Reviewed-by: trustme --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index b8c6fb0..b443194 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -318,7 +318,8 @@ void MMF::AbstractMediaPlayer::doVolumeChanged() case PausedState: case PlayingState: case BufferingState: { - const int err = setDeviceVolume(m_volume * m_mmfMaxVolume); + const qreal volume = (m_volume * m_mmfMaxVolume) + 0.5; + const int err = setDeviceVolume(volume); if (KErrNone != err) { setError(NormalError); -- cgit v0.12 From 6a89291da7e1322ad81c4939cc9d69db01957a4c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 2 Nov 2009 13:58:52 +0000 Subject: Fix for defect introduced by dd48c27f This change causes some applications to crash due to a null pointer dereference in QSoftKeyManagerPrivate::updateSoftKeys_sys. f3854db6 fixes the crash, but introduces incorrect behaviour: the softkey labels are not updated. To see this: 1. Launch qmediaplayer 2. Open a video clip 3. Video clip starts playing but softkeys still have labels "Open" and "Cancel" Reviewed-by: Janne Anttila --- src/gui/kernel/qsoftkeymanager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index fac936f..8612e64 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -237,7 +237,10 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList &softkeys) } } - Qt::WindowType sourceWindowType = QSoftKeyManagerPrivate::softKeySource->window()->windowType(); + const Qt::WindowType sourceWindowType = QSoftKeyManagerPrivate::softKeySource + ? QSoftKeyManagerPrivate::softKeySource->window()->windowType() + : Qt::Widget; + if (needsExitButton && sourceWindowType != Qt::Dialog && sourceWindowType != Qt::Popup) QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QSoftKeyManager::tr("Exit")))); -- cgit v0.12 From 6ec05db9b819a23ebac5a5908b8e3ca56b251e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 3 Nov 2009 12:39:46 +0100 Subject: Made QPainter::drawText() respect Qt::TextDontClip flag. The flag was not respected in the vertical direction for any text lines completely outside the bounding rect. Task-number: QTBUG-1666 Reviewed-by: Trond --- src/gui/painting/qpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 8d6cad3..e0423f3 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7604,7 +7604,7 @@ start_lengthVariant: l.setPosition(QPointF(0., height)); height += l.height(); width = qMax(width, l.naturalTextWidth()); - if (!brect && height >= r.height()) + if (!dontclip && !brect && height >= r.height()) break; } textLayout.endLayout(); -- cgit v0.12 From 0a24f29a0f53716f9c9e000f5bb55ac5d925df5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 3 Nov 2009 12:11:50 +0100 Subject: Fixed some compiler warnings. Reviewed-by: Trond --- src/gui/painting/qpainterpath_p.h | 9 ++++---- .../gl2paintengineex/qglengineshadermanager.cpp | 9 ++------ src/opengl/qglpixmapfilter.cpp | 24 +--------------------- 3 files changed, 7 insertions(+), 35 deletions(-) diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 112c2bd..54b9392 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -132,10 +132,9 @@ public: QPainterPathData() : cStart(0), fillRule(Qt::OddEvenFill), - pathConverter(0), dirtyBounds(false), - dirtyControlBounds(false) - + dirtyControlBounds(false), + pathConverter(0) { ref = 1; require_moveTo = false; @@ -146,10 +145,10 @@ public: QPainterPathPrivate(), cStart(other.cStart), fillRule(other.fillRule), bounds(other.bounds), controlBounds(other.controlBounds), - pathConverter(0), dirtyBounds(other.dirtyBounds), dirtyControlBounds(other.dirtyControlBounds), - convex(other.convex) + convex(other.convex), + pathConverter(0) { ref = 1; require_moveTo = false; diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 34c448f..40a6241 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -153,13 +153,8 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) // Check that all the elements have been filled: for (int i = 0; i < TotalSnippetCount; ++i) { if (qShaderSnippets[i] == 0) { - QByteArray msg; - msg.append("Fatal: Shader Snippet for "); - msg.append(snippetNameStr(SnippetName(i))); - msg.append(" ("); - msg.append(QByteArray::number(i)); - msg.append(") is missing!"); - qFatal(msg.constData()); + qFatal("Shader snippet for %s (#%d) is missing!", + snippetNameStr(SnippetName(i)).constData(), i); } } #endif diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index ff19e06..8768fbc 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -316,28 +316,6 @@ static const char *qt_gl_texture_sampling_helper = " return texture2D(src, srcCoords).a;\n" "}\n"; -static const char *qt_gl_clamped_texture_sampling_helper = - "highp vec4 texture_dimensions;\n" // x = width, y = height, z = 0.5/width, w = 0.5/height - "lowp float clampedTexture2DAlpha(lowp sampler2D src, highp vec2 srcCoords) {\n" - " highp vec2 clampedCoords = clamp(srcCoords, texture_dimensions.zw, vec2(1.0) - texture_dimensions.zw);\n" - " highp vec2 t = clamp(min(srcCoords, vec2(1.0) - srcCoords) * srcDim + 0.5, 0.0, 1.0);\n" - " return texture2D(src, clampedCoords).a * t.x * t.y;\n" - "}\n" - "lowp vec4 clampedTexture2D(lowp sampler2D src, highp vec2 srcCoords) {\n" - " highp vec2 clampedCoords = clamp(srcCoords, texture_dimensions.zw, vec2(1.0) - texture_dimensions.zw);\n" - " highp vec2 t = clamp(min(srcCoords, vec2(1.0) - srcCoords) * srcDim + 0.5, 0.0, 1.0);\n" - " return texture2D(src, clampedCoords) * t.x * t.y;\n" - "}\n"; - -static QByteArray qt_gl_convertToClamped(const QByteArray &source) -{ - QByteArray result; - result.append(qt_gl_clamped_texture_sampling_helper); - result.append(QByteArray(source).replace("texture2DAlpha", "clampedTexture2DAlpha") - .replace("texture2D", "clampedTexture2D")); - return result; -} - QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint) : m_animatedBlur(false) , m_haveCached(false) @@ -433,7 +411,7 @@ QGLBlurTextureCache::~QGLBlurTextureCache() blurTextureCaches.removeAt(blurTextureCaches.indexOf(this)); } -void QGLBlurTextureCache::timerEvent(QTimerEvent *event) +void QGLBlurTextureCache::timerEvent(QTimerEvent *) { killTimer(timerId); timerId = 0; -- cgit v0.12 From 51c9b68425c1d3fe64a08e6ef0357fbd6bdd8f8a Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 3 Nov 2009 12:55:19 +0100 Subject: Compile fix after the last gesture api change Reviewed-by: trustme --- examples/gestures/imagegestures/imagewidget.cpp | 6 +-- src/gui/kernel/qgesture_p.h | 2 +- src/gui/kernel/qmacgesturerecognizer_mac.mm | 57 ++++++++++------------ src/gui/kernel/qmacgesturerecognizer_mac_p.h | 13 +++-- src/gui/kernel/qstandardgestures.cpp | 2 - .../kernel/qwinnativepangesturerecognizer_win.cpp | 23 ++++----- .../kernel/qwinnativepangesturerecognizer_win_p.h | 5 +- 7 files changed, 50 insertions(+), 58 deletions(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index da9daae..f615129 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -124,9 +124,9 @@ void ImageWidget::panTriggered(QPanGesture *gesture) setCursor(Qt::ArrowCursor); } #endif - QPointF lastOffset = gesture->offset(); - horizontalOffset += lastOffset.x(); - verticalOffset += lastOffset.y(); + QPointF delta = gesture->delta(); + horizontalOffset += delta.x(); + verticalOffset += delta.y(); update(); } diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 96fd64d..ae2e287 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -92,7 +92,7 @@ public: QPointF lastOffset; QPointF offset; - QPoint lastPosition; + QPoint startPosition; qreal acceleration; }; diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm index 7019580..d842322 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac.mm +++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm @@ -53,13 +53,13 @@ QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer() { } -QGesture *QMacSwipeGestureRecognizer::createGesture(QObject * /*target*/) +QGesture *QMacSwipeGestureRecognizer::create(QObject * /*target*/) { return new QSwipeGesture; } QGestureRecognizer::Result -QMacSwipeGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent *event) +QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event) { if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) { QNativeGestureEvent *ev = static_cast(event); @@ -67,7 +67,7 @@ QMacSwipeGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent case QNativeGestureEvent::Swipe: { QSwipeGesture *g = static_cast(gesture); g->setSwipeAngle(ev->angle); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; break; } default: break; @@ -90,13 +90,13 @@ QMacPinchGestureRecognizer::QMacPinchGestureRecognizer() { } -QGesture *QMacPinchGestureRecognizer::createGesture(QObject * /*target*/) +QGesture *QMacPinchGestureRecognizer::create(QObject * /*target*/) { return new QPinchGesture; } QGestureRecognizer::Result -QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent *event) +QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event) { if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) { QPinchGesture *g = static_cast(gesture); @@ -106,26 +106,26 @@ QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent reset(gesture); g->setStartCenterPoint(static_cast(obj)->mapFromGlobal(ev->position)); g->setCenterPoint(g->startCenterPoint()); - g->setWhatChanged(QPinchGesture::CenterPointChanged); - return QGestureRecognizer::MaybeGesture | QGestureRecognizer::ConsumeEventHint; + g->setChangeFlags(QPinchGesture::CenterPointChanged); + g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags()); + return QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint; case QNativeGestureEvent::Rotate: { g->setLastScaleFactor(g->scaleFactor()); g->setLastRotationAngle(g->rotationAngle()); g->setRotationAngle(g->rotationAngle() + ev->percentage); - g->setWhatChanged(QPinchGesture::RotationAngleChanged); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; - break; + g->setChangeFlags(QPinchGesture::RotationAngleChanged); + g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags()); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } case QNativeGestureEvent::Zoom: g->setLastScaleFactor(g->scaleFactor()); g->setLastRotationAngle(g->rotationAngle()); g->setScaleFactor(g->scaleFactor() + ev->percentage); - g->setWhatChanged(QPinchGesture::ScaleFactorChanged); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; - break; + g->setChangeFlags(QPinchGesture::ScaleFactorChanged); + g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags()); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; case QNativeGestureEvent::GestureEnd: - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; - break; + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; default: break; } @@ -137,7 +137,8 @@ QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent void QMacPinchGestureRecognizer::reset(QGesture *gesture) { QPinchGesture *g = static_cast(gesture); - g->setWhatChanged(0); + g->setChangeFlags(0); + g->setTotalChangeFlags(0); g->setScaleFactor(1.0f); g->setTotalScaleFactor(1.0f); g->setLastScaleFactor(1.0f); @@ -158,7 +159,7 @@ QMacPanGestureRecognizer::QMacPanGestureRecognizer() : _panCanceled(true) { } -QGesture *QMacPanGestureRecognizer::createGesture(QObject *target) +QGesture *QMacPanGestureRecognizer::create(QObject *target) { if (!target) return new QPanGesture; @@ -172,7 +173,7 @@ QGesture *QMacPanGestureRecognizer::createGesture(QObject *target) } QGestureRecognizer::Result -QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent *event) +QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *event) { const int panBeginDelay = 300; const int panBeginRadius = 3; @@ -185,10 +186,9 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent if (ev->touchPoints().size() == 1) { reset(gesture); _startPos = QCursor::pos(); - _lastPos = _startPos; _panTimer.start(panBeginDelay, target); _panCanceled = false; - return QGestureRecognizer::MaybeGesture; + return QGestureRecognizer::MayBeGesture; } break;} case QEvent::TouchEnd: { @@ -197,7 +197,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent const QTouchEvent *ev = static_cast(event); if (ev->touchPoints().size() == 1) - return QGestureRecognizer::GestureFinished; + return QGestureRecognizer::FinishGesture; break;} case QEvent::TouchUpdate: { if (_panCanceled) @@ -212,23 +212,21 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent if ((p - _startPos).manhattanLength() > panBeginRadius) { _panCanceled = true; _panTimer.stop(); - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } } else { const QPointF p = QCursor::pos(); - const QPointF posOffset = p - _lastPos; + const QPointF posOffset = p - _startPos; g->setLastOffset(g->offset()); g->setOffset(QPointF(posOffset.x(), posOffset.y())); - g->setTotalOffset(g->lastOffset() + g->offset()); - _lastPos = p; - return QGestureRecognizer::GestureTriggered; + return QGestureRecognizer::TriggerGesture; } } else if (_panTimer.isActive()) { // I only want to cancel the pan if the user is pressing // more than one finger, and the pan hasn't started yet: _panCanceled = true; _panTimer.stop(); - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } break;} case QEvent::Timer: { @@ -239,8 +237,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent break; // Begin new pan session! _startPos = QCursor::pos(); - _lastPos = _startPos; - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } break; } default: @@ -254,11 +251,9 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture) { QPanGesture *g = static_cast(gesture); _startPos = QPointF(); - _lastPos = QPointF(); _panCanceled = true; g->setOffset(QPointF(0, 0)); g->setLastOffset(QPointF(0, 0)); - g->setTotalOffset(QPointF(0, 0)); g->setAcceleration(qreal(1)); QGestureRecognizer::reset(gesture); } diff --git a/src/gui/kernel/qmacgesturerecognizer_mac_p.h b/src/gui/kernel/qmacgesturerecognizer_mac_p.h index bdc2e08..2dac56a 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac_p.h +++ b/src/gui/kernel/qmacgesturerecognizer_mac_p.h @@ -64,8 +64,8 @@ class QMacSwipeGestureRecognizer : public QGestureRecognizer public: QMacSwipeGestureRecognizer(); - QGesture *createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event); void reset(QGesture *gesture); }; @@ -74,8 +74,8 @@ class QMacPinchGestureRecognizer : public QGestureRecognizer public: QMacPinchGestureRecognizer(); - QGesture *createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event); void reset(QGesture *gesture); }; @@ -86,12 +86,11 @@ class QMacPanGestureRecognizer : public QObject, public QGestureRecognizer public: QMacPanGestureRecognizer(); - QGesture *createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event); void reset(QGesture *gesture); private: QPointF _startPos; - QPointF _lastPos; QBasicTimer _panTimer; bool _panCanceled; }; diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index ba00a90..dfd49eb 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -79,7 +79,6 @@ QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, QOb case QEvent::TouchBegin: { result = QGestureRecognizer::MayBeGesture; QTouchEvent::TouchPoint p = ev->touchPoints().at(0); - d->lastPosition = p.pos().toPoint(); d->lastOffset = d->offset = QPointF(); break; } @@ -134,7 +133,6 @@ void QPanGestureRecognizer::reset(QGesture *state) QPanGesturePrivate *d = pan->d_func(); d->lastOffset = d->offset = QPointF(); - d->lastPosition = QPoint(); d->acceleration = 0; QGestureRecognizer::reset(state); diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp index c3c8a28..5fceb13 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp @@ -56,7 +56,7 @@ QWinNativePanGestureRecognizer::QWinNativePanGestureRecognizer() { } -QGesture *QWinNativePanGestureRecognizer::createGesture(QObject *target) +QGesture *QWinNativePanGestureRecognizer::create(QObject *target) { if (!target) return new QPanGesture; // a special case @@ -73,7 +73,9 @@ QGesture *QWinNativePanGestureRecognizer::createGesture(QObject *target) return new QPanGesture; } -QGestureRecognizer::Result QWinNativePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QWinNativePanGestureRecognizer::recognize(QGesture *state, + QObject *, + QEvent *event) { QPanGesture *q = static_cast(state); QPanGesturePrivate *d = q->d_func(); @@ -85,26 +87,25 @@ QGestureRecognizer::Result QWinNativePanGestureRecognizer::filterEvent(QGesture case QNativeGestureEvent::GestureBegin: break; case QNativeGestureEvent::Pan: - result = QGestureRecognizer::GestureTriggered; + result = QGestureRecognizer::TriggerGesture; event->accept(); break; case QNativeGestureEvent::GestureEnd: if (q->state() == Qt::NoGesture) return QGestureRecognizer::Ignore; // some other gesture has ended - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; break; default: return QGestureRecognizer::Ignore; } if (q->state() == Qt::NoGesture) { - d->lastOffset = d->totalOffset = d->offset = QPointF(); + d->lastOffset = d->offset = QPointF(); + d->startPosition = ev->position; } else { d->lastOffset = d->offset; - d->offset = QPointF(ev->position.x() - d->lastPosition.x(), - ev->position.y() - d->lastPosition.y()); - d->totalOffset += d->offset; + d->offset = QPointF(ev->position.x() - d->startPosition.x(), + ev->position.y() - d->startPosition.y()); } - d->lastPosition = ev->position; } return result; } @@ -114,8 +115,8 @@ void QWinNativePanGestureRecognizer::reset(QGesture *state) QPanGesture *pan = static_cast(state); QPanGesturePrivate *d = pan->d_func(); - d->totalOffset = d->lastOffset = d->offset = QPointF(); - d->lastPosition = QPoint(); + d->lastOffset = d->offset = QPointF(); + d->startPosition = QPoint(); d->acceleration = 0; QGestureRecognizer::reset(state); diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h index 1d723da..8fb0d50 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h @@ -62,9 +62,8 @@ class QWinNativePanGestureRecognizer : public QGestureRecognizer public: QWinNativePanGestureRecognizer(); - QGesture *createGesture(QObject *target); - - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; -- cgit v0.12 From f080d232ef072976b28ca4b448dcb210b5941b2e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 2 Nov 2009 22:30:09 +0100 Subject: fix canReadLine() erroneously returning true the indexOf() call did not consider actualReadBufferSize and thus scanned uninitialized memory for newlines. Reviewed-by: phartman --- src/corelib/tools/qringbuffer_p.h | 27 +++++++++++++++++++++++++++ src/network/socket/qlocalsocket_win.cpp | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index c44346c..7c766cb 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -287,6 +287,33 @@ public: return -1; } + inline int indexOf(char c, int maxLength) const { + int index = 0; + int remain = qMin(size(), maxLength); + for (int i = 0; remain && i < buffers.size(); ++i) { + int start = 0; + int end = buffers.at(i).size(); + + if (i == 0) + start = head; + if (i == tailBuffer) + end = tail; + if (remain < end - start) { + end = start + remain; + remain = 0; + } else { + remain -= end - start; + } + const char *ptr = buffers.at(i).data() + start; + for (int j = start; j < end; ++j) { + if (*ptr++ == c) + return index; + ++index; + } + } + return -1; + } + inline int read(char *data, int maxLength) { int bytesToRead = qMin(size(), maxLength); int readSoFar = 0; diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 8a745ab..d812d88 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -363,7 +363,8 @@ bool QLocalSocket::canReadLine() const Q_D(const QLocalSocket); if (state() != ConnectedState) return false; - return (d->readBuffer.indexOf('\n') != -1 || QIODevice::canReadLine()); + return (QIODevice::canReadLine() + || d->readBuffer.indexOf('\n', d->actualReadBufferSize) != -1); } void QLocalSocket::close() -- cgit v0.12 From ddbccf7f066d26d3420c9ed18d8c930200814ce1 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 30 Oct 2009 12:14:39 +0100 Subject: Add the Symbian Foundation OS versions Symbian^1 - SV_SF_1 Symbian^2 - SV_SF_2 etc. This is for the benefit of developers working with the Symbian master codelines. Reviewed-by: axis --- src/corelib/global/qglobal.cpp | 22 +++++++++++++++------- src/corelib/global/qglobal.h | 17 +++++++++++++---- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 33c6a34..5578091 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -960,7 +960,7 @@ QT_BEGIN_NAMESPACE \relates Turns the major, minor and patch numbers of a version into an - integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can + integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can be compared with another similarly processed version id. \sa QT_VERSION @@ -1795,7 +1795,7 @@ QSysInfo::S60Version QSysInfo::s60Version() TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents); if (err == KErrNone) { err = contents->Sort(EDescending|ESortByName); - if (err == KErrNone) { + if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) { TInt major = (*contents)[0].iName[9] - '0'; TInt minor = (*contents)[0].iName[11] - '0'; if (major == 3) { @@ -1808,6 +1808,12 @@ QSysInfo::S60Version QSysInfo::s60Version() if (minor == 0) { return cachedS60Version = SV_S60_5_0; } + else if (minor == 1) { + return cachedS60Version = SV_S60_5_1; + } + else if (minor == 2) { + return cachedS60Version = SV_S60_5_2; + } } } delete contents; @@ -1822,12 +1828,10 @@ QSysInfo::S60Version QSysInfo::s60Version() return cachedS60Version = SV_S60_3_2; # elif defined(__S60_50__) return cachedS60Version = SV_S60_5_0; -# else - return cachedS60Version = SV_S60_Unknown; # endif -# else - return cachedS60Version = SV_S60_Unknown; # endif + //If reaching here, it was not possible to determine the version + return cachedS60Version = SV_S60_Unknown; } QSysInfo::SymbianVersion QSysInfo::symbianVersion() { @@ -1838,6 +1842,10 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion() return SV_9_3; case SV_S60_5_0: return SV_9_4; + case SV_S60_5_1: + return SV_9_4; + case SV_S60_5_2: + return SV_9_4; default: return SV_Unknown; } @@ -2572,7 +2580,7 @@ void qsrand() seed = GetTickCount(); srand(seed); -#else +#else // Symbian? #endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index cbb8fda..95f09ea 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1478,17 +1478,26 @@ public: #ifdef Q_OS_SYMBIAN enum SymbianVersion { SV_Unknown = 0x0000, + //These are the Symbian Ltd versions 9.2-9.4 SV_9_2 = 10, SV_9_3 = 20, - SV_9_4 = 30 + SV_9_4 = 30, + //Following values are the symbian foundation versions, i.e. Symbian^1 == SV_SF_1 + SV_SF_1 = SV_9_4, + SV_SF_2 = 40, + SV_SF_3 = 50, + SV_SF_4 = 60 }; static SymbianVersion symbianVersion(); enum S60Version { SV_S60_None = 0, SV_S60_Unknown = 1, - SV_S60_3_1 = 10, - SV_S60_3_2 = 20, - SV_S60_5_0 = 30 + SV_S60_3_1 = SV_9_2, + SV_S60_3_2 = SV_9_3, + SV_S60_5_0 = SV_9_4, + //versions beyond 5.0 are to be confirmed - it is better to use symbian version + SV_S60_5_1 = SV_SF_2, + SV_S60_5_2 = SV_SF_3 }; static S60Version s60Version(); #endif -- cgit v0.12 From 92a393940d2dc3a9e2cd4f27e4ca62643c816f6f Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 30 Oct 2009 17:43:45 +0100 Subject: Fix crash in QApplication autotest introduced by native pixmaps (S60 3.1) Problem was caused by S60 closing a handle under our feet when QApplication is destroyed. To avoid this, we open our own handle for the global lock instead of using the shared one inside CFbsBitmap. Also the global unlock/relock is not needed on S60 3.2 so this can be eliminated and save a few cycles (the function call was a no-op before) Reviewed-by: Jani Hautakangas --- src/gui/image/qpixmap_s60.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 7086341..5c7e93f 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -73,27 +73,27 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, used to lock the global bitmap heap. Only used in S60 v3.1 and S60 v3.2. */ +_LIT(KFBSERVLargeBitmapAccessName,"FbsLargeBitmapAccess"); class QSymbianFbsClient { public: - QSymbianFbsClient() : heapLock(0), heapLocked(false) + QSymbianFbsClient() : heapLocked(false) { - QT_TRAP_THROWING(heapLock = new(ELeave) CFbsBitmap); - heapLock->Create(TSize(0,0), S60->screenDevice()->DisplayMode()); + heapLock.OpenGlobal(KFBSERVLargeBitmapAccessName); } ~QSymbianFbsClient() { - delete heapLock; + heapLock.Close(); } bool lockHeap() { bool wasLocked = heapLocked; - if (heapLock && !heapLocked) { - heapLock->LockHeap(ETrue); + if (heapLock.Handle() && !heapLocked) { + heapLock.Wait(); heapLocked = true; } @@ -104,8 +104,8 @@ public: { bool wasLocked = heapLocked; - if (heapLock && heapLocked) { - heapLock->UnlockHeap(ETrue); + if (heapLock.Handle() && heapLocked) { + heapLock.Signal(); heapLocked = false; } @@ -115,7 +115,7 @@ public: private: - CFbsBitmap *heapLock; + RMutex heapLock; bool heapLocked; }; @@ -169,7 +169,7 @@ public: inline void beginDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) + if (symbianVersion == QSysInfo::SV_9_2) heapWasLocked = qt_symbianFbsClient()->lockHeap(); else bitmap->LockHeap(ETrue); @@ -177,7 +177,7 @@ public: inline void endDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) { + if (symbianVersion == QSysInfo::SV_9_2) { if (!heapWasLocked) qt_symbianFbsClient()->unlockHeap(); } else { -- cgit v0.12 From 5308b1c607c1209822078d8aae329308c8017636 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 09:47:25 +0100 Subject: Fix for potential crash in S60 style Leaving function called without a TRAP Reviewed-by: Sami Merila --- src/gui/styles/qs60style_s60.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 678844c..0cd87bd 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1382,13 +1382,13 @@ QSize QS60StylePrivate::naviPaneSize() QSize QS60StyleModeSpecifics::naviPaneSize() { CAknNavigationControlContainer* naviContainer; - if (S60->statusPane()) - naviContainer = static_cast - (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); - if (naviContainer) - return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight); - else - return QSize(0,0); + if (S60->statusPane()) { + TRAPD(err, naviContainer = static_cast + (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi)))); + if (err==KErrNone) + return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight); + } + return QSize(0,0); } #endif // Q_WS_S60 -- cgit v0.12 From 3769f290ccc20ff92dd43038743f96097d9fabd0 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 13:03:11 +0100 Subject: Fix cleanupstack crash on exit in Symbian OS 9.2 Destroying the control environment also pops items from the original cleanup stack which is not owned by the control environment. This is a platform issue (and does not occur in 9.3 & 9.4). To avoid this causing a panic, the s60main is changed to not push items on the cleanup stack (instead, it TRAPs the call to main(), and deletes its allocations manually). A further 9.2 cleanup stack crash was caused when application construction fails (because of missing resource files). The resulting exception would bypass deleting the control environment, and return from main with the wrong cleanup stack active. This is resolved by doing the TRAP / cleanup / throw manually instead of using qt_trap_throwing (The control environment cannot be pushed to the cleanup stack, because it owns the cleanup stack at that time). This isn't a 9.2 specific bug, but rather is revealed by 9.2 because the missing resource file is non fatal in 9.3 and 9.4. Fixes many autotests which have crashed on S60 3.1 since the cleanup stack swapping patch. Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 11 ++++++++++- src/s60main/qts60main_mcrt0.cpp | 8 +++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e5ee2f1..1b0659a 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1052,8 +1052,17 @@ void qt_init(QApplicationPrivate * /* priv */, int) // After this construction, CEikonEnv will be available from CEikonEnv::Static(). // (much like our qApp). CEikonEnv* coe = new CEikonEnv; - QT_TRAP_THROWING(coe->ConstructAppFromCommandLineL(factory,*commandLine)); + //not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there. + if(err == KErrNone) + TRAP(err, coe->ConstructAppFromCommandLineL(factory,*commandLine)); delete commandLine; + if(err != KErrNone) { + qWarning() << "qt_init: Eikon application construct failed (" + << err + << "), maybe missing resource file on S60 3.1?"; + delete coe; + qt_symbian_throwIfError(err); + } S60->s60InstalledTrapHandler = User::SetTrapHandler(origTrapHandler); diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index d30e07a..edc2fb8 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -83,12 +83,10 @@ GLDEF_C TInt QtMainWrapper() char **envp = 0; // get args & environment __crt0(argc, argv, envp); - CleanupArrayDelete::PushL(argv); - CleanupArrayDelete::PushL(envp); //Call user(application)'s main - int ret = 0; - QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);); - CleanupStack::PopAndDestroy(2, argv); + TRAPD(ret, QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);)); + delete[] argv; + delete[] envp; return ret; } -- cgit v0.12 From 5919feba122d0e5a696a72a3d1e2eff6928824f8 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 13:49:32 +0100 Subject: Fix qclipboard autotest on s60 3.1 It launches 2 subprocesses that use QApplication. Added the resource files to deployment so that construction does not fail Reviewed-by: axis --- tests/auto/qclipboard/test/test.pro | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro index 508eba1..62a38af 100644 --- a/tests/auto/qclipboard/test/test.pro +++ b/tests/auto/qclipboard/test/test.pro @@ -13,7 +13,18 @@ win32 { wince*|symbian*: { copier.sources = ../copier/copier.exe copier.path = copier - paster.sources = ../paster/paster.exe + paster.sources = ../paster/paster.exe paster.path = paster - DEPLOYMENT = copier paster + + symbian*: { + load(data_caging_paths) + rsc.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc + rsc.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc + rsc.path = $$APP_RESOURCE_DIR + reg_resource.sources = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/copier_reg.rsc + reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc + reg_resource.path = $$REG_RESOURCE_IMPORT_DIR + } + + DEPLOYMENT = copier paster rsc reg_resource } \ No newline at end of file -- cgit v0.12 From 95f7076937065a78029fc50d506fba58f8c6199c Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 13:51:49 +0100 Subject: Fix qdatetime autotest regression My previous addition to the test case to validate local time was too strict for all platforms. Reviewed-by: Paul --- tests/auto/qdatetime/tst_qdatetime.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index c53780e..1140402 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -450,11 +450,12 @@ void tst_QDateTime::toString_enumformat() qDebug() << str3; QVERIFY(!str3.isEmpty()); //check for date/time components in any order - QVERIFY(str3.contains("1995")); + //year may be 2 or 4 digits + QVERIFY(str3.contains("95")); //day and month may be in numeric or word form QVERIFY(str3.contains("12")); QVERIFY(str3.contains("34")); - QVERIFY(str3.contains("56")); + //seconds may be absent } void tst_QDateTime::addDays() -- cgit v0.12 From 4c011468bb93a3d0b8e5cc0d9dd16e7528079119 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 14:05:00 +0100 Subject: Compile... Reviewed-by: TrustMe --- src/gui/styles/qwindowsxpstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 9fd9ce9..fe7f5d7 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -2926,10 +2926,10 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } // Draw arrow p->save(); - p->setPen(option->palette.dark()); + p->setPen(option->palette.dark().color()); p->drawLine(menuarea.left(), menuarea.top() + 3, menuarea.left(), menuarea.bottom() - 3); - p->setPen(option->palette.light()); + p->setPen(option->palette.light().color()); p->drawLine(menuarea.left() - 1, menuarea.top() + 3, menuarea.left() - 1, menuarea.bottom() - 3); -- cgit v0.12 From 4d0735b98a9bd6b440adf63725e6062b601ed442 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 14:05:31 +0100 Subject: Check for QPixmap::isNull() in QPainter::drawPixmap() Reviewed-by: Samuel --- src/gui/painting/qpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 8d6cad3..cbae5b6 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5164,7 +5164,7 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) Q_D(QPainter); - if (!d->engine) + if (!d->engine || pm.isNull()) return; #ifndef QT_NO_DEBUG -- cgit v0.12 From 381247326743888075979664f50ea804d6123c42 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 3 Nov 2009 13:56:42 +0100 Subject: Fixed an input method bug when erasing the last character. Previously we didn't update the editor contents if the new preedit string was empty. However, it could be empty because the user just erased it, so the bug was fixed by checking whether the preedit string in the event and in the editor are different. RevBy: Denis Dzyubenko --- src/gui/text/qtextcontrol.cpp | 3 ++- src/gui/widgets/qlinecontrol.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 3f6545c..9497b6f 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1831,7 +1831,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) e->ignore(); return; } - bool isGettingInput = !e->commitString().isEmpty() || !e->preeditString().isEmpty() + bool isGettingInput = !e->commitString().isEmpty() + || e->preeditString() != cursor.block().layout()->preeditAreaText() || e->replacementLength() > 0; if (isGettingInput) { diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 8f17e98..0fc94c9 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -401,7 +401,8 @@ void QLineControl::moveCursor(int pos, bool mark) void QLineControl::processInputMethodEvent(QInputMethodEvent *event) { int priorState = 0; - bool isGettingInput = !event->commitString().isEmpty() || !event->preeditString().isEmpty() + bool isGettingInput = !event->commitString().isEmpty() + || event->preeditString() != preeditAreaText() || event->replacementLength() > 0; bool cursorPositionChanged = false; -- cgit v0.12 From 53e486c0e8d23d535711debdd3a71c8ef2211c58 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Nov 2009 14:41:22 +0100 Subject: Fixed tst_qgraphicsitem::hitTestGraphicsEffectItem, caching makes testcase invalid... Reviewed-by: Samuel --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 684ad4f..3bc6db5 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7676,20 +7676,6 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() QCOMPARE(items.size(), 1); QCOMPARE(items.at(0), static_cast(item3)); - item1->repaints = 0; - item2->repaints = 0; - item3->repaints = 0; - - view.viewport()->update(75, 75, 20, 20); - QTest::qWait(50); - - // item1 is the effect source and must therefore be repainted. - // item2 intersects with the exposed region - // item3 is just another child outside the exposed region - QCOMPARE(item1->repaints, 1); - QCOMPARE(item2->repaints, 1); - QCOMPARE(item3->repaints, 0); - scene.setItemIndexMethod(QGraphicsScene::NoIndex); QTest::qWait(100); -- cgit v0.12 From 03c5d276c6ffc16c43ac554aa2e22b5824c35c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 3 Nov 2009 16:03:10 +0200 Subject: Inclusion of QtOpenVg overwrites all other modules in s60install.pro The pro-file is missing '+' when it is adding QtOpenVg support for sis file. Task-number: None Reviewed-by: Janne Koskinen --- src/s60installs/s60installs.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 9c53167..90c9f27 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -107,7 +107,7 @@ symbian: { graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems contains(QT_CONFIG, openvg) { - qtlibraries.sources = QtOpenVG.dll + qtlibraries.sources += QtOpenVG.dll graphicssystems_plugins.sources += qvggraphicssystem.dll } -- cgit v0.12 From 8325c15b21cd49287160c8dfb31ebf56ba3090ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 3 Nov 2009 15:34:35 +0100 Subject: Fix memory leak in the Mac accessibility module. Remove duplicate AXUIElement initialization in QAElment. (The duplicate code was erroneously merged in with the cocoa port.) RevBy: Richard Moe Gustavsen --- src/gui/accessible/qaccessible_mac.mm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm index 46ef1e5..a875a5c 100644 --- a/src/gui/accessible/qaccessible_mac.mm +++ b/src/gui/accessible/qaccessible_mac.mm @@ -504,11 +504,6 @@ QAElement::QAElement(const QAElement &element) } QAElement::QAElement(HIObjectRef object, int child) - :elementRef( -#ifndef QT_MAC_USE_COCOA - AXUIElementCreateWithHIObjectAndIdentifier(object, child) -#endif -) { #ifndef QT_MAC_USE_COCOA if (object == 0) { -- cgit v0.12 From 9bd330756bc8e0fac9919da0b1068096ee91cb24 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 3 Nov 2009 15:09:09 +0100 Subject: Pressing return in a QWizard would erase the active password entry. When echo mode was set to PasswordEchoOnEdit in a QLineEdit, and its text selected, pressing the return key would erase the text and start editing it instead of validating the password. Auto-test included. Reviewed-by: Olivier Task-number: QTBUG-4401 --- src/gui/widgets/qlinecontrol.cpp | 23 ++++++++++++----------- tests/auto/qlineedit/tst_qlineedit.cpp | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 7f9ff82..26b9c95 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1509,6 +1509,18 @@ void QLineControl::processKeyEvent(QKeyEvent* event) } #endif // QT_NO_COMPLETER + if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { + if (hasAcceptableInput() || fixup()) { + emit accepted(); + emit editingFinished(); + } + if (inlineCompletionAccepted) + event->accept(); + else + event->ignore(); + return; + } + if (echoMode() == QLineEdit::PasswordEchoOnEdit && !passwordEchoEditing() && !isReadOnly() @@ -1529,17 +1541,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event) clear(); } - if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { - if (hasAcceptableInput() || fixup()) { - emit accepted(); - emit editingFinished(); - } - if (inlineCompletionAccepted) - event->accept(); - else - event->ignore(); - return; - } bool unknown = false; if (false) { diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index c676959..b4dfbba 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -260,6 +260,7 @@ private slots: void task233101_cursorPosAfterInputMethod(); void task241436_passwordEchoOnEditRestoreEchoMode(); void task248948_redoRemovedSelection(); + void taskQTBUG_4401_enterKeyClearsPassword(); protected slots: #ifdef QT3_SUPPORT @@ -3532,5 +3533,20 @@ void tst_QLineEdit::task248948_redoRemovedSelection() QCOMPARE(testWidget->text(), QLatin1String("ab")); } +void tst_QLineEdit::taskQTBUG_4401_enterKeyClearsPassword() +{ + QString password("Wanna guess?"); + + testWidget->setText(password); + testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit); + testWidget->setFocus(); + testWidget->selectAll(); + QApplication::setActiveWindow(testWidget); + QTRY_VERIFY(testWidget->hasFocus()); + + QTest::keyPress(testWidget, Qt::Key_Enter); + QTRY_COMPARE(testWidget->text(), password); +} + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" -- cgit v0.12 From fc45c07c27100591750ad5c360fde535e15b9dbd Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 3 Nov 2009 16:45:10 +0200 Subject: Made xmlpatterns autotests compile for Symbian Fixed xmlpatterns autotests so that they compile for Symbian with both RVCT and NokiaX86 compilers. Reviewed-by: Janne Koskinen --- src/xmlpatterns/acceltree/qacceltree_p.h | 2 +- src/xmlpatterns/acceltree/qcompressedwhitespace_p.h | 2 +- tests/auto/checkxmlfiles/checkxmlfiles.pro | 2 +- tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp | 2 +- tests/auto/qxmlquery/tst_qxmlquery.cpp | 14 +++++++------- tests/auto/qxmlschema/tst_qxmlschema.cpp | 4 ++-- tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp | 12 ++++++------ tests/auto/qxmlserializer/tst_qxmlserializer.cpp | 4 ++-- tests/auto/xmlpatterns.pri | 5 +++-- tests/auto/xmlpatterns/tst_xmlpatterns.cpp | 10 +++++++++- tests/auto/xmlpatterns/xmlpatterns.pro | 6 +++--- tests/auto/xmlpatternsdiagnosticsts/test/test.pro | 4 ++-- tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro | 5 +++-- tests/auto/xmlpatternsxqts/lib/Global.h | 2 +- tests/auto/xmlpatternsxqts/lib/lib.pro | 6 ++++++ 15 files changed, 48 insertions(+), 32 deletions(-) diff --git a/src/xmlpatterns/acceltree/qacceltree_p.h b/src/xmlpatterns/acceltree/qacceltree_p.h index 8da61c9..ee7d6f6 100644 --- a/src/xmlpatterns/acceltree/qacceltree_p.h +++ b/src/xmlpatterns/acceltree/qacceltree_p.h @@ -89,7 +89,7 @@ namespace QPatternist * @see Accelerating * XPath Evaluation in Any RDBMS, Torsten Grust */ - class AccelTree : public QAbstractXmlNodeModel + class Q_AUTOTEST_EXPORT AccelTree : public QAbstractXmlNodeModel { friend class AccelTreePrivate; public: diff --git a/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h b/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h index bb547bd..27e3c22 100644 --- a/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h +++ b/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h @@ -84,7 +84,7 @@ namespace QPatternist * * @author Frans Englich */ - class CompressedWhitespace + class Q_AUTOTEST_EXPORT CompressedWhitespace { public: /** diff --git a/tests/auto/checkxmlfiles/checkxmlfiles.pro b/tests/auto/checkxmlfiles/checkxmlfiles.pro index c368c02..d53c11c 100644 --- a/tests/auto/checkxmlfiles/checkxmlfiles.pro +++ b/tests/auto/checkxmlfiles/checkxmlfiles.pro @@ -12,7 +12,7 @@ addFiles.sources = \ $$QT_SOURCE_TREE/examples/sql/masterdetail/albumdetails.xml \ $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/globalVariables/globals.gccxml \ $$QT_SOURCE_TREE/doc/src/diagrams/stylesheet/treeview.svg \ - $$QT_SOURCE_TREE/doc/src/diagrams/designer-mainwindow-actions.ui \ + $$QT_SOURCE_TREE/doc/src/diagrams/designer-manual/designer-mainwindow-actions.ui \ $$QT_SOURCE_TREE/demos/undo/undo.qrc addFiles.path = xmlfiles DEPLOYMENT += addFiles diff --git a/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp b/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp index cb6bd4d..c19deb6 100644 --- a/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp +++ b/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp @@ -178,7 +178,7 @@ void tst_QXmlNodeModelIndex::model() const /* Check default value. */ { const QXmlNodeModelIndex index; - QCOMPARE(index.model(), static_cast(0)); + QCOMPARE(index.model(), static_cast(0)); } } diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index 8a9d4ef..49f2b08 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -345,8 +345,8 @@ void tst_QXmlQuery::copyConstructor() const query1.setInitialTemplateName(name); const QXmlQuery query2(query1); - QCOMPARE(query2.messageHandler(), &silencer); - QCOMPARE(query2.uriResolver(), &resolver); + QCOMPARE(query2.messageHandler(), static_cast(&silencer)); + QCOMPARE(query2.uriResolver(), static_cast(&resolver)); QCOMPARE(query2.queryLanguage(), QXmlQuery::XSLT20); QCOMPARE(query2.initialTemplateName(), name); QCOMPARE(query2.networkAccessManager(), &networkManager); @@ -522,7 +522,7 @@ void tst_QXmlQuery::assignmentOperator() const QVERIFY(copy.isValid()); QCOMPARE(copy.uriResolver(), static_cast(&returnURI)); - QCOMPARE(copy.messageHandler(), &silencer); + QCOMPARE(copy.messageHandler(), static_cast(&silencer)); QCOMPARE(testName.localName(copy.namePool()), QString::fromLatin1("somethingToCheck")); QXmlResultItems result; @@ -559,7 +559,7 @@ void tst_QXmlQuery::assignmentOperator() const /* Check that the copy picked up the new things. */ QVERIFY(copy.isValid()); QCOMPARE(copy.uriResolver(), static_cast(&secondUriResolver)); - QCOMPARE(copy.messageHandler(), &secondSilencer); + QCOMPARE(copy.messageHandler(), static_cast(&secondSilencer)); QXmlResultItems resultCopy; copy.evaluateTo(&resultCopy); @@ -577,7 +577,7 @@ void tst_QXmlQuery::assignmentOperator() const /* Check that the original is unchanged. */ QVERIFY(original.isValid()); QCOMPARE(original.uriResolver(), static_cast(&returnURI)); - QCOMPARE(original.messageHandler(), &silencer); + QCOMPARE(original.messageHandler(), static_cast(&silencer)); QXmlResultItems resultOriginal; original.evaluateTo(&resultOriginal); @@ -931,7 +931,7 @@ void tst_QXmlQuery::setMessageHandler() const QXmlQuery query; MessageSilencer silencer; query.setMessageHandler(&silencer); - QCOMPARE(&silencer, query.messageHandler()); + QCOMPARE(static_cast(&silencer), query.messageHandler()); } void tst_QXmlQuery::evaluateToReceiver() @@ -1691,7 +1691,7 @@ void tst_QXmlQuery::setUriResolver() const TestURIResolver resolver; QXmlQuery query; query.setUriResolver(&resolver); - QCOMPARE(query.uriResolver(), &resolver); + QCOMPARE(query.uriResolver(), static_cast(&resolver)); } } diff --git a/tests/auto/qxmlschema/tst_qxmlschema.cpp b/tests/auto/qxmlschema/tst_qxmlschema.cpp index 79f5587..ec91f88 100644 --- a/tests/auto/qxmlschema/tst_qxmlschema.cpp +++ b/tests/auto/qxmlschema/tst_qxmlschema.cpp @@ -357,7 +357,7 @@ void tst_QXmlSchema::messageHandler() const QXmlSchema schema; schema.setMessageHandler(&handler); - QCOMPARE(schema.messageHandler(), &handler); + QCOMPARE(schema.messageHandler(), static_cast(&handler)); } } @@ -394,7 +394,7 @@ void tst_QXmlSchema::uriResolver() const QXmlSchema schema; schema.setUriResolver(&resolver); - QCOMPARE(schema.uriResolver(), &resolver); + QCOMPARE(schema.uriResolver(), static_cast(&resolver)); } } diff --git a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp index 519f864..9fc784b 100644 --- a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp +++ b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp @@ -149,8 +149,8 @@ void tst_QXmlSchemaValidator::propertyInitialization() const schema.setNetworkAccessManager(&manager); QXmlSchemaValidator validator(schema); - QCOMPARE(validator.messageHandler(), &handler); - QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.messageHandler(), static_cast(&handler)); + QCOMPARE(validator.uriResolver(), static_cast(&resolver)); QCOMPARE(validator.networkAccessManager(), &manager); } } @@ -384,7 +384,7 @@ void tst_QXmlSchemaValidator::messageHandler() const QXmlSchemaValidator validator(schema); validator.setMessageHandler(&handler); - QCOMPARE(validator.messageHandler(), &handler); + QCOMPARE(validator.messageHandler(), static_cast(&handler)); } /* Test that we return the message handler that was set, even if the schema changed in between. */ @@ -399,7 +399,7 @@ void tst_QXmlSchemaValidator::messageHandler() const const QXmlSchema schema2; validator.setSchema(schema2); - QCOMPARE(validator.messageHandler(), &handler); + QCOMPARE(validator.messageHandler(), static_cast(&handler)); } } @@ -452,7 +452,7 @@ void tst_QXmlSchemaValidator::uriResolver() const QXmlSchemaValidator validator(schema); validator.setUriResolver(&resolver); - QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.uriResolver(), static_cast(&resolver)); } /* Test that we return the uri resolver that was set, even if the schema changed in between. */ @@ -467,7 +467,7 @@ void tst_QXmlSchemaValidator::uriResolver() const const QXmlSchema schema2; validator.setSchema(schema2); - QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.uriResolver(), static_cast(&resolver)); } } diff --git a/tests/auto/qxmlserializer/tst_qxmlserializer.cpp b/tests/auto/qxmlserializer/tst_qxmlserializer.cpp index aeca140..51044ff 100644 --- a/tests/auto/qxmlserializer/tst_qxmlserializer.cpp +++ b/tests/auto/qxmlserializer/tst_qxmlserializer.cpp @@ -148,7 +148,7 @@ void tst_QXmlSerializer::outputDevice() const { const QXmlQuery query; const QXmlSerializer serializer(query, &file); - QCOMPARE(serializer.outputDevice(), &file); + QCOMPARE(serializer.outputDevice(), static_cast< QIODevice *>(&file)); } } @@ -158,7 +158,7 @@ void tst_QXmlSerializer::serializationError() const QXmlQuery query; MessageSilencer silencer; query.setMessageHandler(&silencer); - + query.setQuery(queryString); QByteArray output; diff --git a/tests/auto/xmlpatterns.pri b/tests/auto/xmlpatterns.pri index 7cdd67f..8c8ccad 100644 --- a/tests/auto/xmlpatterns.pri +++ b/tests/auto/xmlpatterns.pri @@ -15,8 +15,9 @@ QT -= gui XMLPATTERNS_SDK = QtXmlPatternsSDK if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { - win32:XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}d - else: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}_debug + symbian: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK} + else:win32: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}d + else: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}_debug } INCLUDEPATH += \ diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp index 0dcb070..22f6693 100644 --- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp +++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp @@ -48,6 +48,10 @@ #include "../qxmlquery/TestFundament.h" #include "../network-settings.h" +#if defined(Q_OS_SYMBIAN) +#define SRCDIR "" +#endif + /*! \class tst_XmlPatterns \internal @@ -130,6 +134,8 @@ void tst_XmlPatterns::xquerySupport() #ifdef Q_OS_WINCE QSKIP("WinCE: This test uses unsupported WinCE functionality", SkipAll); +#elif defined(Q_OS_SYMBIAN) + QSKIP("Symbian: This test uses unsupported Symbian functionality (QProcess with std streams)", SkipAll); #endif QFETCH(int, expectedExitCode); @@ -218,7 +224,7 @@ void tst_XmlPatterns::xquerySupport() void tst_XmlPatterns::xquerySupport_data() const { -#ifdef Q_OS_WINCE +#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) return; #endif @@ -849,6 +855,8 @@ void tst_XmlPatterns::xsltSupport_data() const #ifdef Q_OS_WINCE QSKIP("WinCE: This test uses unsupported WinCE functionality", SkipAll); +#elif defined(Q_OS_SYMBIAN) + QSKIP("Symbian: This test uses unsupported Symbian functionality (QProcess with std streams)", SkipAll); #endif QTest::addColumn("expectedExitCode"); diff --git a/tests/auto/xmlpatterns/xmlpatterns.pro b/tests/auto/xmlpatterns/xmlpatterns.pro index 01e3b2b..54dd9aa 100644 --- a/tests/auto/xmlpatterns/xmlpatterns.pro +++ b/tests/auto/xmlpatterns/xmlpatterns.pro @@ -2,10 +2,10 @@ load(qttest_p4) SOURCES += tst_xmlpatterns.cpp \ ../qxmlquery/TestFundament.cpp -!wince* { -DEFINES += SRCDIR=\\\"$$PWD/\\\" -} else { +wince* { DEFINES += SRCDIR=\\\"./\\\" +} else:!symbian { +DEFINES += SRCDIR=\\\"$$PWD/\\\" } include (../xmlpatterns.pri) diff --git a/tests/auto/xmlpatternsdiagnosticsts/test/test.pro b/tests/auto/xmlpatternsdiagnosticsts/test/test.pro index aeff896..acd71e4 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/test/test.pro +++ b/tests/auto/xmlpatternsdiagnosticsts/test/test.pro @@ -25,8 +25,8 @@ INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternsxqts/lib/ \ ../../xmlpatternsxqts/test \ ../../xmlpatternsxqts/lib -wince*: { - catalog.sources = TestSuite Baseline.xml +wince*|symbian { + catalog.sources = ../TestSuite ../Baseline.xml catalog.path = . DEPLOYMENT += catalog } diff --git a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro index bcc988a..0f55078 100644 --- a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro +++ b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro @@ -11,8 +11,9 @@ SOURCES += ../xmlpatternsxqts/test/tst_suitetest.cpp PATTERNIST_SDK = QtXmlPatternsSDK if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { - win32:PATTERNIST_SDK = $${PATTERNIST_SDK}d - else: PATTERNIST_SDK = $${PATTERNIST_SDK}_debug + symbian: PATTERNIST_SDK = $${PATTERNIST_SDK} + else:win32: PATTERNIST_SDK = $${PATTERNIST_SDK}d + else: PATTERNIST_SDK = $${PATTERNIST_SDK}_debug } LIBS += -l$$PATTERNIST_SDK diff --git a/tests/auto/xmlpatternsxqts/lib/Global.h b/tests/auto/xmlpatternsxqts/lib/Global.h index eadb940..a620417 100644 --- a/tests/auto/xmlpatternsxqts/lib/Global.h +++ b/tests/auto/xmlpatternsxqts/lib/Global.h @@ -47,7 +47,7 @@ #include "private/qitem_p.h" #include "private/qnamepool_p.h" -#ifdef Q_WS_WIN +#if defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) # ifdef Q_PATTERNISTSDK_BUILDING #define Q_PATTERNISTSDK_EXPORT __declspec(dllexport) #else diff --git a/tests/auto/xmlpatternsxqts/lib/lib.pro b/tests/auto/xmlpatternsxqts/lib/lib.pro index cb9453a..f5b0a06 100644 --- a/tests/auto/xmlpatternsxqts/lib/lib.pro +++ b/tests/auto/xmlpatternsxqts/lib/lib.pro @@ -13,6 +13,12 @@ mac { INSTALLS += target } +symbian { + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = All -Tcb + MMP_RULES += EXPORTUNFROZEN +} + # We add gui, because xmlpatterns.pri pull it out. QT += xmlpatterns xml network testlib gui -- cgit v0.12 From a4e7db378ecd11bc858f76beb33c56ccebef6308 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 3 Nov 2009 15:59:41 +0100 Subject: Fixed fillRect on QImage::Format_ARGB32 images. With composition mode set to QPainter::CompositionMode_Source, the raster paint engine's fillRect function filled images which had non-premultiplied format with premultiplied colours. This was fixed by converting the premultiplied colour back to non-premultiplied before writing to the image. Task-number: QTBUG-5189 Reviewed-by: Trond --- src/gui/painting/qdrawhelper.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 53edbb0..41602a1 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7424,6 +7424,14 @@ QT_RECTFILL(qrgb444) QT_RECTFILL(qargb4444) #undef QT_RECTFILL +inline static void qt_rectfill_nonpremul_quint32(QRasterBuffer *rasterBuffer, + int x, int y, int width, int height, + quint32 color) +{ + qt_rectfill(reinterpret_cast(rasterBuffer->buffer()), + INV_PREMUL(color), x, y, width, height, rasterBuffer->bytesPerLine()); +} + // Map table for destination image format. Contains function pointers // for blends of various types unto the destination @@ -7466,7 +7474,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = qt_bitmapblit_quint32, qt_alphamapblit_quint32, qt_alphargbblit_quint32, - qt_rectfill_quint32 + qt_rectfill_nonpremul_quint32 }, // Format_ARGB32_Premultiplied { -- cgit v0.12 From 9f62759028b0bdb8fb7991c349d58a89323b8567 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 11:04:07 +0100 Subject: Change name of QStateMachine::animationsEnabled property to "animated" The name "animated" is consistent with naming in Qt otherwise, as in QTreeView::animated and QMainWindow::animated. Reviewed-by: Kent Hansen --- src/corelib/statemachine/qstatemachine.cpp | 14 +++++++------- src/corelib/statemachine/qstatemachine.h | 6 +++--- src/corelib/statemachine/qstatemachine_p.h | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 689967a..322e24a 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -164,7 +164,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_ANIMATION /*! - \property QStateMachine::animationsEnabled + \property QStateMachine::animated \brief whether animations are enabled @@ -188,7 +188,7 @@ QStateMachinePrivate::QStateMachinePrivate() globalRestorePolicy = QStateMachine::DoNotRestoreProperties; signalEventGenerator = 0; #ifndef QT_NO_ANIMATION - animationsEnabled = true; + animated = true; #endif } @@ -742,7 +742,7 @@ void QStateMachinePrivate::applyProperties(const QList &tr // Find the animations to use for the state change. QList selectedAnimations; - if (animationsEnabled) { + if (animated) { for (int i = 0; i < transitionList.size(); ++i) { QAbstractTransition *transition = transitionList.at(i); @@ -2116,19 +2116,19 @@ void QStateMachine::onExit(QEvent *event) /*! Returns whether animations are enabled for this state machine. */ -bool QStateMachine::animationsEnabled() const +bool QStateMachine::isAnimated() const { Q_D(const QStateMachine); - return d->animationsEnabled; + return d->animated; } /*! Sets whether animations are \a enabled for this state machine. */ -void QStateMachine::setAnimationsEnabled(bool enabled) +void QStateMachine::setAnimated(bool enabled) { Q_D(QStateMachine); - d->animationsEnabled = enabled; + d->animated = enabled; } /*! diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index 13b6fe2..f7ceba1 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -67,7 +67,7 @@ class Q_CORE_EXPORT QStateMachine : public QState Q_PROPERTY(RestorePolicy globalRestorePolicy READ globalRestorePolicy WRITE setGlobalRestorePolicy) Q_ENUMS(RestorePolicy) #ifndef QT_NO_ANIMATION - Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled) + Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated) #endif public: class SignalEvent : public QEvent @@ -133,8 +133,8 @@ public: bool isRunning() const; #ifndef QT_NO_ANIMATION - bool animationsEnabled() const; - void setAnimationsEnabled(bool enabled); + bool isAnimated() const; + void setAnimated(bool enabled); void addDefaultAnimation(QAbstractAnimation *animation); QList defaultAnimations() const; diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index 69b727d..f0d9c7c 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -200,7 +200,7 @@ public: QSet pendingErrorStatesForDefaultEntry; #ifndef QT_NO_ANIMATION - bool animationsEnabled; + bool animated; QPair, QList > initializeAnimation(QAbstractAnimation *abstractAnimation, diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 975b301..0df8d52 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1340,11 +1340,11 @@ void tst_QStateMachine::assignPropertyWithAnimation() // Single animation { QStateMachine machine; - QVERIFY(machine.animationsEnabled()); - machine.setAnimationsEnabled(false); - QVERIFY(!machine.animationsEnabled()); - machine.setAnimationsEnabled(true); - QVERIFY(machine.animationsEnabled()); + QVERIFY(machine.isAnimated()); + machine.setAnimated(false); + QVERIFY(!machine.isAnimated()); + machine.setAnimated(true); + QVERIFY(machine.isAnimated()); QObject obj; obj.setProperty("foo", 321); obj.setProperty("bar", 654); -- cgit v0.12 From b210026bda1fcd6d38b8a5a556aefe4fb5c4f891 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 12:05:55 +0100 Subject: Change name of DoNotRestoreProperties enum to DontRestoreProperties Using the abbreviated "Dont" is consistent with other negated enum names in Qt. Reviewed-by: Kent Hansen --- src/corelib/statemachine/qstatemachine.cpp | 8 ++++---- src/corelib/statemachine/qstatemachine.h | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 322e24a..0d07093 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -159,7 +159,7 @@ QT_BEGIN_NAMESPACE \brief the restore policy for states of this state machine. The default value of this property is - QStateMachine::DoNotRestoreProperties. + QStateMachine::DontRestoreProperties. */ #ifndef QT_NO_ANIMATION @@ -185,7 +185,7 @@ QStateMachinePrivate::QStateMachinePrivate() stop = false; stopProcessingReason = EventQueueEmpty; error = QStateMachine::NoError; - globalRestorePolicy = QStateMachine::DoNotRestoreProperties; + globalRestorePolicy = QStateMachine::DontRestoreProperties; signalEventGenerator = 0; #ifndef QT_NO_ANIMATION animated = true; @@ -1696,7 +1696,7 @@ QStateMachine::~QStateMachine() already been saved by the state machine, it will not be overwritten until the property has been successfully restored. - \value DoNotRestoreProperties The state machine should not save the initial values of properties + \value DontRestoreProperties The state machine should not save the initial values of properties and restore them later. \value RestoreProperties The state machine should save the initial values of properties and restore them later. @@ -1746,7 +1746,7 @@ QStateMachine::RestorePolicy QStateMachine::globalRestorePolicy() const /*! Sets the restore policy of the state machine to \a restorePolicy. The default - restore policy is QAbstractState::DoNotRestoreProperties. + restore policy is QAbstractState::DontRestoreProperties. \sa globalRestorePolicy() */ diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index f7ceba1..ff2b667 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -109,7 +109,7 @@ public: }; enum RestorePolicy { - DoNotRestoreProperties, + DontRestoreProperties, RestoreProperties }; diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 0df8d52..31ab3af 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -162,7 +162,7 @@ private slots: void defaultGlobalRestorePolicy(); void globalRestorePolicySetToRestore(); - void globalRestorePolicySetToDoNotRestore(); + void globalRestorePolicySetToDontRestore(); void noInitialStateForInitialState(); @@ -984,7 +984,7 @@ void tst_QStateMachine::customErrorStateNotInGraph() void tst_QStateMachine::restoreProperties() { QStateMachine machine; - QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DoNotRestoreProperties); + QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DontRestoreProperties); machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); QObject *object = new QObject(&machine); @@ -2736,10 +2736,10 @@ void tst_QStateMachine::restorePolicyNotInherited() }*/ -void tst_QStateMachine::globalRestorePolicySetToDoNotRestore() +void tst_QStateMachine::globalRestorePolicySetToDontRestore() { QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::DoNotRestoreProperties); + machine.setGlobalRestorePolicy(QStateMachine::DontRestoreProperties); QObject *propertyHolder = new QObject(&machine); propertyHolder->setProperty("a", 1); -- cgit v0.12 From 569e4b636fc91a9d5c6f6e4d65967327786adb3c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 13:13:35 +0100 Subject: Remove return type of QState::addTransition(QAbstractTransition*) Returning the input argument in a function can lead to confusion and serves no purpose here. Instead, we'll mirror the API from QMenu::addAction() overloads, where the overload that takes a preconstructed object has a void return type. Reviewed-by: Kent Hansen --- src/corelib/statemachine/qstate.cpp | 15 +++++---- src/corelib/statemachine/qstate.h | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 42 +++++++++++++++++--------- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index bcd8364..ea20619 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -286,15 +286,14 @@ void QState::setErrorState(QAbstractState *state) /*! Adds the given \a transition. The transition has this state as the source. - This state takes ownership of the transition. If the transition is successfully - added, the function will return the \a transition pointer. Otherwise it will return null. + This state takes ownership of the transition. */ -QAbstractTransition *QState::addTransition(QAbstractTransition *transition) +void QState::addTransition(QAbstractTransition *transition) { Q_D(QState); if (!transition) { qWarning("QState::addTransition: cannot add null transition"); - return 0; + return ; } transition->setParent(this); @@ -303,18 +302,17 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition) QAbstractState *t = targets.at(i).data(); if (!t) { qWarning("QState::addTransition: cannot add transition to null state"); - return 0; + return ; } if ((QAbstractStatePrivate::get(t)->machine() != d->machine()) && QAbstractStatePrivate::get(t)->machine() && d->machine()) { qWarning("QState::addTransition: cannot add transition " "to a state in a different state machine"); - return 0; + return ; } } if (machine() != 0 && machine()->configuration().contains(this)) QStateMachinePrivate::get(machine())->registerTransitions(this); - return transition; } /*! @@ -379,7 +377,8 @@ QAbstractTransition *QState::addTransition(QAbstractState *target) return 0; } UnconditionalTransition *trans = new UnconditionalTransition(target); - return addTransition(trans); + addTransition(trans); + return trans; } /*! diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 7a47447..781382d 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -76,7 +76,7 @@ public: QAbstractState *errorState() const; void setErrorState(QAbstractState *state); - QAbstractTransition *addTransition(QAbstractTransition *transition); + void addTransition(QAbstractTransition *transition); QSignalTransition *addTransition(QObject *sender, const char *signal, QAbstractState *target); QAbstractTransition *addTransition(QAbstractState *target); void removeTransition(QAbstractTransition *transition); diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 31ab3af..fb6567a 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -286,8 +286,8 @@ void tst_QStateMachine::transitionToRootState() machine.addState(initialState); machine.setInitialState(initialState); - QAbstractTransition *trans = initialState->addTransition(new EventTransition(QEvent::User, &machine)); - QVERIFY(trans != 0); + QAbstractTransition *trans = new EventTransition(QEvent::User, &machine); + initialState->addTransition(trans); QCOMPARE(trans->sourceState(), initialState); QCOMPARE(trans->targetState(), static_cast(&machine)); @@ -310,7 +310,7 @@ void tst_QStateMachine::transitionFromRootState() QState *root = &machine; QState *s1 = new QState(root); EventTransition *trans = new EventTransition(QEvent::User, s1); - QCOMPARE(root->addTransition(trans), static_cast(trans)); + root->addTransition(trans); QCOMPARE(trans->sourceState(), root); QCOMPARE(trans->targetState(), static_cast(s1)); } @@ -1155,7 +1155,7 @@ void tst_QStateMachine::stateEntryAndExit() QCOMPARE(t->targetState(), (QAbstractState*)s2); QCOMPARE(t->targetStates().size(), 1); QCOMPARE(t->targetStates().at(0), (QAbstractState*)s2); - QCOMPARE(s1->addTransition(t), (QAbstractTransition*)t); + s1->addTransition(t); QCOMPARE(t->sourceState(), (QState*)s1); QCOMPARE(t->machine(), &machine); @@ -1173,7 +1173,7 @@ void tst_QStateMachine::stateEntryAndExit() s2->removeTransition(trans); QCOMPARE(trans->sourceState(), (QState*)0); QCOMPARE(trans->targetState(), (QAbstractState*)s3); - QCOMPARE(s2->addTransition(trans), trans); + s2->addTransition(trans); QCOMPARE(trans->sourceState(), (QState*)s2); } @@ -3117,7 +3117,9 @@ void tst_QStateMachine::twoAnimatedTransitions() QState *s2 = new QState(&machine); s2->assignProperty(object, "foo", 5.0); QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3126,7 +3128,9 @@ void tst_QStateMachine::twoAnimatedTransitions() QState *s4 = new QState(&machine); s4->assignProperty(object, "foo", 2.0); QPropertyAnimation *fooAnimation2 = new QPropertyAnimation(object, "foo", s4); - s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation2); + trans = new EventTransition(QEvent::User, s4); + s3->addTransition(trans); + trans->addAnimation(fooAnimation2); QState *s5 = new QState(&machine); QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit())); @@ -3161,7 +3165,9 @@ void tst_QStateMachine::playAnimationTwice() QState *s2 = new QState(&machine); s2->assignProperty(object, "foo", 5.0); QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3169,7 +3175,9 @@ void tst_QStateMachine::playAnimationTwice() QState *s4 = new QState(&machine); s4->assignProperty(object, "foo", 2.0); - s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation); + trans = new EventTransition(QEvent::User, s4); + s3->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s5 = new QState(&machine); QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit())); @@ -3213,14 +3221,16 @@ void tst_QStateMachine::nestedTargetStateForAnimation() QState *s2Child2 = new QState(s2); s2Child2->assignProperty(object, "bar", 11.0); - QAbstractTransition *at = s2Child->addTransition(new EventTransition(QEvent::User, s2Child2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2Child2); + s2Child->addTransition(at); QPropertyAnimation *animation = new QPropertyAnimation(object, "bar", s2); animation->setDuration(2000); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(animation); - at = s1->addTransition(new EventTransition(QEvent::User, s2)); + at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); animation = new QPropertyAnimation(object, "foo", s2); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); @@ -3299,7 +3309,8 @@ void tst_QStateMachine::animatedGlobalRestoreProperty() QState *s4 = new QState(&machine); QObject::connect(s4, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", s2); connect(pa, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(pa); @@ -3341,7 +3352,9 @@ void tst_QStateMachine::specificTargetValueOfAnimation() QPropertyAnimation *anim = new QPropertyAnimation(object, "foo"); anim->setEndValue(10.0); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(anim); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(anim); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3495,7 +3508,8 @@ void tst_QStateMachine::overrideDefaultAnimationWithSpecific() QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); -- cgit v0.12 From 2596d721d64ad4d484176888cb166fbc43157ca9 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 13:39:40 +0100 Subject: Change name of modifiersMask property to "modifierMask" "modifierMask" is more correct English. Reviewed-by: Kent Hansen --- src/gui/statemachine/qbasickeyeventtransition.cpp | 24 +++++++++++----------- src/gui/statemachine/qbasickeyeventtransition_p.h | 6 +++--- .../statemachine/qbasicmouseeventtransition.cpp | 16 +++++++-------- .../statemachine/qbasicmouseeventtransition_p.h | 4 ++-- src/gui/statemachine/qkeyeventtransition.cpp | 18 ++++++++-------- src/gui/statemachine/qkeyeventtransition.h | 6 +++--- src/gui/statemachine/qmouseeventtransition.cpp | 18 ++++++++-------- src/gui/statemachine/qmouseeventtransition.h | 6 +++--- 8 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/gui/statemachine/qbasickeyeventtransition.cpp index 445a253..bf10e3d 100644 --- a/src/gui/statemachine/qbasickeyeventtransition.cpp +++ b/src/gui/statemachine/qbasickeyeventtransition.cpp @@ -68,14 +68,14 @@ public: QEvent::Type eventType; int key; - Qt::KeyboardModifiers modifiersMask; + Qt::KeyboardModifiers modifierMask; }; QBasicKeyEventTransitionPrivate::QBasicKeyEventTransitionPrivate() { eventType = QEvent::None; key = 0; - modifiersMask = Qt::NoModifier; + modifierMask = Qt::NoModifier; } QBasicKeyEventTransitionPrivate *QBasicKeyEventTransitionPrivate::get(QBasicKeyEventTransition *q) @@ -106,17 +106,17 @@ QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key, /*! Constructs a new event transition for events of the given \a type for the - given \a key, with the given \a modifiersMask and \a sourceState. + given \a key, with the given \a modifierMask and \a sourceState. */ QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key, - Qt::KeyboardModifiers modifiersMask, + Qt::KeyboardModifiers modifierMask, QState *sourceState) : QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState) { Q_D(QBasicKeyEventTransition); d->eventType = type; d->key = key; - d->modifiersMask = modifiersMask; + d->modifierMask = modifierMask; } /*! @@ -163,23 +163,23 @@ void QBasicKeyEventTransition::setKey(int key) } /*! - Returns the keyboard modifiers mask that this key event transition checks + Returns the keyboard modifier mask that this key event transition checks for. */ -Qt::KeyboardModifiers QBasicKeyEventTransition::modifiersMask() const +Qt::KeyboardModifiers QBasicKeyEventTransition::modifierMask() const { Q_D(const QBasicKeyEventTransition); - return d->modifiersMask; + return d->modifierMask; } /*! - Sets the keyboard modifiers mask that this key event transition will check + Sets the keyboard modifier mask that this key event transition will check for. */ -void QBasicKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QBasicKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QBasicKeyEventTransition); - d->modifiersMask = modifiersMask; + d->modifierMask = modifierMask; } /*! @@ -191,7 +191,7 @@ bool QBasicKeyEventTransition::eventTest(QEvent *event) if (event->type() == d->eventType) { QKeyEvent *ke = static_cast(event); return (ke->key() == d->key) - && ((ke->modifiers() & d->modifiersMask) == d->modifiersMask); + && ((ke->modifiers() & d->modifierMask) == d->modifierMask); } return false; } diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/gui/statemachine/qbasickeyeventtransition_p.h index 3c2ec7d..87d3dc7 100644 --- a/src/gui/statemachine/qbasickeyeventtransition_p.h +++ b/src/gui/statemachine/qbasickeyeventtransition_p.h @@ -69,7 +69,7 @@ public: QBasicKeyEventTransition(QState *sourceState = 0); QBasicKeyEventTransition(QEvent::Type type, int key, QState *sourceState = 0); QBasicKeyEventTransition(QEvent::Type type, int key, - Qt::KeyboardModifiers modifiersMask, + Qt::KeyboardModifiers modifierMask, QState *sourceState = 0); ~QBasicKeyEventTransition(); @@ -79,8 +79,8 @@ public: int key() const; void setKey(int key); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); protected: bool eventTest(QEvent *event); diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp index 694c319..4a977ba 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition.cpp +++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp @@ -69,7 +69,7 @@ public: QEvent::Type eventType; Qt::MouseButton button; - Qt::KeyboardModifiers modifiersMask; + Qt::KeyboardModifiers modifierMask; QPainterPath path; }; @@ -149,23 +149,23 @@ void QBasicMouseEventTransition::setButton(Qt::MouseButton button) } /*! - Returns the keyboard modifiers mask that this mouse event transition checks + Returns the keyboard modifier mask that this mouse event transition checks for. */ -Qt::KeyboardModifiers QBasicMouseEventTransition::modifiersMask() const +Qt::KeyboardModifiers QBasicMouseEventTransition::modifierMask() const { Q_D(const QBasicMouseEventTransition); - return d->modifiersMask; + return d->modifierMask; } /*! - Sets the keyboard modifiers mask that this mouse event transition will check + Sets the keyboard modifier mask that this mouse event transition will check for. */ -void QBasicMouseEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QBasicMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QBasicMouseEventTransition); - d->modifiersMask = modifiersMask; + d->modifierMask = modifierMask; } /*! @@ -195,7 +195,7 @@ bool QBasicMouseEventTransition::eventTest(QEvent *event) if (event->type() == d->eventType) { QMouseEvent *me = static_cast(event); return (me->button() == d->button) - && ((me->modifiers() & d->modifiersMask) == d->modifiersMask) + && ((me->modifiers() & d->modifierMask) == d->modifierMask) && (d->path.isEmpty() || d->path.contains(me->pos())); } return false; diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h index 512e0f8..8684fa3 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition_p.h +++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h @@ -79,8 +79,8 @@ public: Qt::MouseButton button() const; void setButton(Qt::MouseButton button); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); QPainterPath path() const; void setPath(const QPainterPath &path); diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/gui/statemachine/qkeyeventtransition.cpp index dee3168..a15e671 100644 --- a/src/gui/statemachine/qkeyeventtransition.cpp +++ b/src/gui/statemachine/qkeyeventtransition.cpp @@ -69,9 +69,9 @@ QT_BEGIN_NAMESPACE */ /*! - \property QKeyEventTransition::modifiersMask + \property QKeyEventTransition::modifierMask - \brief the keyboard modifiers mask that this key event transition checks for + \brief the keyboard modifier mask that this key event transition checks for */ class QKeyEventTransitionPrivate : public QEventTransitionPrivate @@ -133,23 +133,23 @@ void QKeyEventTransition::setKey(int key) } /*! - Returns the keyboard modifiers mask that this key event transition checks + Returns the keyboard modifier mask that this key event transition checks for. */ -Qt::KeyboardModifiers QKeyEventTransition::modifiersMask() const +Qt::KeyboardModifiers QKeyEventTransition::modifierMask() const { Q_D(const QKeyEventTransition); - return d->transition->modifiersMask(); + return d->transition->modifierMask(); } /*! - Sets the keyboard \a modifiers mask that this key event transition will - check for. + Sets the keyboard modifier mask that this key event transition will + check for to \a modifierMask. */ -void QKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QKeyEventTransition); - d->transition->setModifiersMask(modifiersMask); + d->transition->setModifierMask(modifierMask); } /*! diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/gui/statemachine/qkeyeventtransition.h index 8df8138..ab1c155 100644 --- a/src/gui/statemachine/qkeyeventtransition.h +++ b/src/gui/statemachine/qkeyeventtransition.h @@ -57,7 +57,7 @@ class Q_GUI_EXPORT QKeyEventTransition : public QEventTransition { Q_OBJECT Q_PROPERTY(int key READ key WRITE setKey) - Q_PROPERTY(Qt::KeyboardModifiers modifiersMask READ modifiersMask WRITE setModifiersMask) + Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask) public: QKeyEventTransition(QState *sourceState = 0); QKeyEventTransition(QObject *object, QEvent::Type type, int key, @@ -67,8 +67,8 @@ public: int key() const; void setKey(int key); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); protected: void onTransition(QEvent *event); diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp index 86cacf7..dbf9e19 100644 --- a/src/gui/statemachine/qmouseeventtransition.cpp +++ b/src/gui/statemachine/qmouseeventtransition.cpp @@ -70,9 +70,9 @@ QT_BEGIN_NAMESPACE */ /*! - \property QMouseEventTransition::modifiersMask + \property QMouseEventTransition::modifierMask - \brief the keyboard modifiers mask that this mouse event transition checks for + \brief the keyboard modifier mask that this mouse event transition checks for */ class QMouseEventTransitionPrivate : public QEventTransitionPrivate @@ -139,23 +139,23 @@ void QMouseEventTransition::setButton(Qt::MouseButton button) } /*! - Returns the keyboard modifiers mask that this mouse event transition checks + Returns the keyboard modifier mask that this mouse event transition checks for. */ -Qt::KeyboardModifiers QMouseEventTransition::modifiersMask() const +Qt::KeyboardModifiers QMouseEventTransition::modifierMask() const { Q_D(const QMouseEventTransition); - return d->transition->modifiersMask(); + return d->transition->modifierMask(); } /*! - Sets the keyboard \a modifiers mask that this mouse event transition will - check for. + Sets the keyboard modifier mask that this mouse event transition will + check for to \a modifierMask. */ -void QMouseEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QMouseEventTransition); - d->transition->setModifiersMask(modifiersMask); + d->transition->setModifierMask(modifierMask); } /*! diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h index 4e324ec..a6687b6 100644 --- a/src/gui/statemachine/qmouseeventtransition.h +++ b/src/gui/statemachine/qmouseeventtransition.h @@ -58,7 +58,7 @@ class Q_GUI_EXPORT QMouseEventTransition : public QEventTransition { Q_OBJECT Q_PROPERTY(Qt::MouseButton button READ button WRITE setButton) - Q_PROPERTY(Qt::KeyboardModifiers modifiersMask READ modifiersMask WRITE setModifiersMask) + Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask) public: QMouseEventTransition(QState *sourceState = 0); QMouseEventTransition(QObject *object, QEvent::Type type, @@ -68,8 +68,8 @@ public: Qt::MouseButton button() const; void setButton(Qt::MouseButton button); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); QPainterPath path() const; void setPath(const QPainterPath &path); -- cgit v0.12 From 19421cc33af4f439f4c7aea2de9f449987fbc420 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 13:53:19 +0100 Subject: Change name of QMouseEventTransition::path() to hitTestPath(). Make it clearer what the property actually does. Reviewed-by: Kent Hansen --- src/gui/statemachine/qbasicmouseeventtransition.cpp | 8 ++++---- src/gui/statemachine/qbasicmouseeventtransition_p.h | 4 ++-- src/gui/statemachine/qmouseeventtransition.cpp | 12 ++++++------ src/gui/statemachine/qmouseeventtransition.h | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp index 4a977ba..fe0dea9 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition.cpp +++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp @@ -169,18 +169,18 @@ void QBasicMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierM } /*! - Returns the path for this mouse event transition. + Returns the hit test path for this mouse event transition. */ -QPainterPath QBasicMouseEventTransition::path() const +QPainterPath QBasicMouseEventTransition::hitTestPath() const { Q_D(const QBasicMouseEventTransition); return d->path; } /*! - Sets the path for this mouse event transition. + Sets the hit test path for this mouse event transition. */ -void QBasicMouseEventTransition::setPath(const QPainterPath &path) +void QBasicMouseEventTransition::setHitTestPath(const QPainterPath &path) { Q_D(QBasicMouseEventTransition); d->path = path; diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h index 8684fa3..6754c55 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition_p.h +++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h @@ -82,8 +82,8 @@ public: Qt::KeyboardModifiers modifierMask() const; void setModifierMask(Qt::KeyboardModifiers modifiers); - QPainterPath path() const; - void setPath(const QPainterPath &path); + QPainterPath hitTestPath() const; + void setHitTestPath(const QPainterPath &path); protected: bool eventTest(QEvent *event); diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp index dbf9e19..f5c0cb1 100644 --- a/src/gui/statemachine/qmouseeventtransition.cpp +++ b/src/gui/statemachine/qmouseeventtransition.cpp @@ -159,25 +159,25 @@ void QMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) } /*! - Returns the path for this mouse event transition. + Returns the hit test path for this mouse event transition. */ -QPainterPath QMouseEventTransition::path() const +QPainterPath QMouseEventTransition::hitTestPath() const { Q_D(const QMouseEventTransition); - return d->transition->path(); + return d->transition->hitTestPath(); } /*! - Sets the \a path for this mouse event transition. + Sets the hit test path for this mouse event transition to \a path. If a valid path has been set, the transition will only trigger if the mouse event position (QMouseEvent::pos()) is inside the path. \sa QPainterPath::contains() */ -void QMouseEventTransition::setPath(const QPainterPath &path) +void QMouseEventTransition::setHitTestPath(const QPainterPath &path) { Q_D(QMouseEventTransition); - d->transition->setPath(path); + d->transition->setHitTestPath(path); } /*! diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h index a6687b6..e7f6a45 100644 --- a/src/gui/statemachine/qmouseeventtransition.h +++ b/src/gui/statemachine/qmouseeventtransition.h @@ -71,8 +71,8 @@ public: Qt::KeyboardModifiers modifierMask() const; void setModifierMask(Qt::KeyboardModifiers modifiers); - QPainterPath path() const; - void setPath(const QPainterPath &path); + QPainterPath hitTestPath() const; + void setHitTestPath(const QPainterPath &path); protected: void onTransition(QEvent *event); -- cgit v0.12 From ddd1c40712a6a50b0574341087118fe4db67c3b2 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 Nov 2009 14:19:41 +0100 Subject: Rename QState::polished() signal to "propertiesAssigned" "Polished" was never a very descriptive word, and it already has a meaning attached in the QStyle API. Additionally, "propertiesAssigned" has the benefit of giving the relation to the assignProperty() function as part of the name. Reviewed-by: Kent Hansen --- doc/src/examples/stickman.qdoc | 9 +++--- doc/src/frameworks-technologies/statemachine.qdoc | 10 +++---- doc/src/snippets/statemachine/main5.cpp | 2 +- examples/animation/stickman/lifecycle.cpp | 4 +-- src/corelib/statemachine/qstate.cpp | 16 +++++++---- src/corelib/statemachine/qstate.h | 2 +- src/corelib/statemachine/qstate_p.h | 2 +- src/corelib/statemachine/qstatemachine.cpp | 8 +++--- tests/auto/qstatemachine/tst_qstatemachine.cpp | 34 +++++++++++------------ 9 files changed, 47 insertions(+), 40 deletions(-) diff --git a/doc/src/examples/stickman.qdoc b/doc/src/examples/stickman.qdoc index e70c39b..c9e98d0 100644 --- a/doc/src/examples/stickman.qdoc +++ b/doc/src/examples/stickman.qdoc @@ -55,9 +55,9 @@ Animations are implemented as composite states. Each child state of the animation state represents a frame in the animation by setting the position of each joint in the stickman's skeleton to the positions defined for the particular frame. The frames are then bound together - with animated transitions that trigger on the source state's polished() signal. Thus, the - machine will enter the state representing the next frame in the animation immediately after it - has finished animating into the previous frame. + with animated transitions that trigger on the source state's propertiesAssigned() signal. Thus, + the machine will enter the state representing the next frame in the animation immediately after + it has finished animating into the previous frame. \image stickman-example1.png @@ -67,7 +67,8 @@ \snippet examples/animation/stickman/lifecycle.cpp 1 - The states are then bound together with signal transitions that listen to the polished() signal. + The states are then bound together with signal transitions that listen to the + propertiesAssigned() signal. \snippet examples/animation/stickman/lifecycle.cpp 2 diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index ac10314..708561d 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -501,9 +501,9 @@ message box will pop up before the geometry of the button has actually been set. To ensure that the message box does not pop up until the geometry actually reaches its final - value, we can use the state's polished() signal. The polished() signal will be emitted when the - the property is assigned its final value, whether this is done immediately or after the animation - has finished playing. + value, we can use the state's propertiesAssigned() signal. The propertiesAssigned() signal will be + emitted when the property is assigned its final value, whether this is done immediately or + after the animation has finished playing. \code \snippet doc/src/snippets/statemachine/main5.cpp 6 \endcode @@ -519,14 +519,14 @@ has been assigned the defined value. If the global restore policy is set to QStateMachine::RestoreProperties, the state will not emit - the polished() signal until these have been executed as well. + the propertiesAssigned() signal until these have been executed as well. \section1 What Happens If A State Is Exited Before The Animation Has Finished If a state has property assignments, and the transition into the state has animations for the properties, the state can potentially be exited before the properties have been assigned to the values defines by the state. This is true in particular when there are transitions out from the - state that do not depend on the state being polished, as described in the previous section. + state that do not depend on the propertiesAssigned signal, as described in the previous section. The State Machine API guarantees that a property assigned by the state machine either: \list diff --git a/doc/src/snippets/statemachine/main5.cpp b/doc/src/snippets/statemachine/main5.cpp index 346cbce..ff25b7b 100644 --- a/doc/src/snippets/statemachine/main5.cpp +++ b/doc/src/snippets/statemachine/main5.cpp @@ -145,7 +145,7 @@ int main(int argv, char **args) connect(s3, SIGNAL(entered()), messageBox, SLOT(exec())); s1->addTransition(button, SIGNAL(clicked()), s2); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); //![6] } diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index 250fb85..1b6f9cd 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -194,14 +194,14 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa topLevel->setInitialState(frameState); else //! [2] - previousState->addTransition(previousState, SIGNAL(polished()), frameState); + previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), frameState); //! [2] previousState = frameState; } // Loop - previousState->addTransition(previousState, SIGNAL(polished()), topLevel->initialState()); + previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), topLevel->initialState()); return topLevel; diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index ea20619..6d89248 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -139,10 +139,10 @@ void QStatePrivate::emitFinished() emit q->finished(); } -void QStatePrivate::emitPolished() +void QStatePrivate::emitPropertiesAssigned() { Q_Q(QState); - emit q->polished(); + emit q->propertiesAssigned(); } /*! @@ -228,7 +228,7 @@ QList QStatePrivate::transitions() const Instructs this state to set the property with the given \a name of the given \a object to the given \a value when the state is entered. - \sa polished() + \sa propertiesAssigned() */ void QState::assignProperty(QObject *object, const char *name, const QVariant &value) @@ -491,9 +491,15 @@ bool QState::event(QEvent *e) */ /*! - \fn QState::polished() + \fn QState::propertiesAssigned() - This signal is emitted when all properties have been assigned their final value. + This signal is emitted when all properties have been assigned their final value. If the state + assigns a value to one or more properties for which an animation exists (either set on the + transition or as a default animation on the state machine), then the signal will not be emitted + until all such animations have finished playing. + + If there are no relevant animations, or no property assignments defined for the state, then + the signal will be emitted immediately before the state is entered. \sa QState::assignProperty(), QAbstractTransition::addAnimation() */ diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 781382d..423f940 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -94,7 +94,7 @@ public: Q_SIGNALS: void finished(); - void polished(); + void propertiesAssigned(); protected: void onEntry(QEvent *event); diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h index 34c8838..7fe6279 100644 --- a/src/corelib/statemachine/qstate_p.h +++ b/src/corelib/statemachine/qstate_p.h @@ -94,7 +94,7 @@ public: QList transitions() const; void emitFinished(); - void emitPolished(); + void emitPropertiesAssigned(); QAbstractState *errorState; QAbstractState *initialState; diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 0d07093..0648d14 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -807,7 +807,7 @@ void QStateMachinePrivate::applyProperties(const QList &tr if (anim->state() == QAbstractAnimation::Running) { // The animation is still running. This can happen if the // animation is a group, and one of its children just finished, - // and that caused a state to emit its polished() signal, and + // and that caused a state to emit its propertiesAssigned() signal, and // that triggered a transition in the machine. // Just stop the animation so it is correctly restarted again. anim->stop(); @@ -829,7 +829,7 @@ void QStateMachinePrivate::applyProperties(const QList &tr } } - // Emit polished signal for entered states that have no animated properties. + // Emit propertiesAssigned signal for entered states that have no animated properties. for (int i = 0; i < enteredStates.size(); ++i) { QState *s = qobject_cast(enteredStates.at(i)); if (s @@ -837,7 +837,7 @@ void QStateMachinePrivate::applyProperties(const QList &tr && !animationsForState.contains(s) #endif ) - QStatePrivate::get(s)->emitPolished(); + QStatePrivate::get(s)->emitPropertiesAssigned(); } } @@ -1100,7 +1100,7 @@ void QStateMachinePrivate::_q_animationFinished() animations.removeOne(anim); if (animations.isEmpty()) { animationsForState.erase(it); - QStatePrivate::get(qobject_cast(state))->emitPolished(); + QStatePrivate::get(qobject_cast(state))->emitPropertiesAssigned(); } } diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index fb6567a..9a2b2ed 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -184,7 +184,7 @@ private slots: void twoAnimatedTransitions(); void playAnimationTwice(); void nestedTargetStateForAnimation(); - void polishedSignalTransitionsReuseAnimationGroup(); + void propertiesAssignedSignalTransitionsReuseAnimationGroup(); void animatedGlobalRestoreProperty(); void specificTargetValueOfAnimation(); @@ -1319,9 +1319,9 @@ void tst_QStateMachine::assignProperty() QCOMPARE(s1->objectName(), QString::fromLatin1("foo")); { - QSignalSpy polishedSpy(s1, SIGNAL(polished())); + QSignalSpy propertiesAssignedSpy(s1, SIGNAL(propertiesAssigned())); machine.start(); - QTRY_COMPARE(polishedSpy.count(), 1); + QTRY_COMPARE(propertiesAssignedSpy.count(), 1); } // nested states @@ -1371,7 +1371,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() QCOMPARE(trans->animations().size(), 1); QCOMPARE(trans->animations().at(0), (QAbstractAnimation*)&anim); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1399,7 +1399,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() anim2.setDuration(150); trans->addAnimation(&anim2); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1427,7 +1427,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() group.addAnimation(new QPropertyAnimation(&obj, "bar")); trans->addAnimation(&group); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1473,10 +1473,10 @@ void tst_QStateMachine::assignPropertyWithAnimation() anim2.setDuration(250); trans->addAnimation(&anim2); - s21->addTransition(s21, SIGNAL(polished()), s22); + s21->addTransition(s21, SIGNAL(propertiesAssigned()), s22); QFinalState *s3 = new QFinalState(&machine); - s22->addTransition(s2, SIGNAL(polished()), s3); + s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1513,13 +1513,13 @@ void tst_QStateMachine::assignPropertyWithAnimation() machine.setInitialState(group); machine.start(); QTRY_COMPARE(machine.configuration().contains(s1), true); - QSignalSpy polishedSpy(s2, SIGNAL(polished())); + QSignalSpy propertiesAssignedSpy(s2, SIGNAL(propertiesAssigned())); emitter.emitSignalWithNoArg(); QTRY_COMPARE(machine.configuration().contains(s2), true); - QVERIFY(polishedSpy.isEmpty()); + QVERIFY(propertiesAssignedSpy.isEmpty()); emitter.emitSignalWithNoArg(); // will cause animations from s1-->s2 to abort QTRY_COMPARE(machine.configuration().contains(s3), true); - QVERIFY(polishedSpy.isEmpty()); + QVERIFY(propertiesAssignedSpy.isEmpty()); QCOMPARE(obj.property("foo").toInt(), 911); QCOMPARE(obj.property("bar").toInt(), 789); } @@ -3089,7 +3089,7 @@ void tst_QStateMachine::twoAnimations() QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); machine.start(); @@ -3241,7 +3241,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() at->addAnimation(animation); QState *s3 = new QState(&machine); - s2->addTransition(s2Child, SIGNAL(polished()), s3); + s2->addTransition(s2Child, SIGNAL(propertiesAssigned()), s3); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3258,7 +3258,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() QCOMPARE(counter.counter, 2); } -void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup() +void tst_QStateMachine::propertiesAssignedSignalTransitionsReuseAnimationGroup() { QStateMachine machine; QObject *object = new QObject(&machine); @@ -3275,9 +3275,9 @@ void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup() QParallelAnimationGroup animationGroup; animationGroup.addAnimation(new QPropertyAnimation(object, "foo")); QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished())); - s1->addTransition(s1, SIGNAL(polished()), s2)->addAnimation(&animationGroup); - s2->addTransition(s2, SIGNAL(polished()), s3)->addAnimation(&animationGroup); - s3->addTransition(s3, SIGNAL(polished()), s4); + s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup); + s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4); machine.setInitialState(s1); QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished())); -- cgit v0.12 From d436493da1e01ac460f42ea0f58be00d8c6fdaea Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 3 Nov 2009 13:44:13 +0000 Subject: Revert "Fixed a crash in the QApplication autotest." This reverts commit f3854db64bcaa0f26faf5ff1414d3b9ccfc00e35. It is replaced by 6a89291d. Reviewed-by: Janne Anttila --- src/gui/kernel/qsoftkeymanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 26f0a39..a914220 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -197,8 +197,7 @@ bool QSoftKeyManager::event(QEvent *e) } while (source); QSoftKeyManagerPrivate::softKeySource = source; - if (source) - QSoftKeyManagerPrivate::updateSoftKeys_sys(softKeys); + QSoftKeyManagerPrivate::updateSoftKeys_sys(softKeys); return true; } return false; -- cgit v0.12 From 1a03f7a1163b8aea69b54066f25f6b935352b6d8 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 3 Nov 2009 15:41:08 +0000 Subject: Fixed crash opening audio clip when video clip currently open Task-number: QTBUG-5302 Reviewed-by: trustme --- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index d1d2337..fe469cf 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -110,6 +110,9 @@ MMF::VideoPlayer::~VideoPlayer() TRACE_CONTEXT(VideoPlayer::~VideoPlayer, EVideoApi); TRACE_ENTRY_0(); + if (m_videoOutput) + m_videoOutput->setObserver(0); + TRACE_EXIT_0(); } -- cgit v0.12 From edc9acd6a0c082b7d6c7810700e77a9d990014c6 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 3 Nov 2009 17:41:52 +0100 Subject: Fixed QPainterPath::addRoundedRect() for paths with Qt::WindingFill. QPainterPath::addRoundRect()/addRoundedRect() added the path in counter-clockwise order, while other methods added paths in clockwise order. For Qt::OddEvenFill, the order doesn't matter, but it matters for Qt::WindingFill. Fixed by adding rounded rects in clockwise order like the other shapes. Task-number: QTBUG-1537 Reviewed-by: Trond --- src/gui/painting/qpainterpath.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index c40bcee..8133793 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -3037,11 +3037,11 @@ void QPainterPath::addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadi bool first = d_func()->elements.size() < 2; - arcMoveTo(x, y, rxx2, ryy2, 90); - arcTo(x, y, rxx2, ryy2, 90, 90); - arcTo(x, y+h-ryy2, rxx2, ryy2, 2*90, 90); - arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 3*90, 90); - arcTo(x+w-rxx2, y, rxx2, ryy2, 0, 90); + arcMoveTo(x, y, rxx2, ryy2, 180); + arcTo(x, y, rxx2, ryy2, 180, -90); + arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90); + arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90); + arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90); closeSubpath(); d_func()->require_moveTo = true; @@ -3094,11 +3094,11 @@ void QPainterPath::addRoundRect(const QRectF &r, int xRnd, int yRnd) bool first = d_func()->elements.size() < 2; - arcMoveTo(x, y, rxx2, ryy2, 90); - arcTo(x, y, rxx2, ryy2, 90, 90); - arcTo(x, y+h-ryy2, rxx2, ryy2, 2*90, 90); - arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 3*90, 90); - arcTo(x+w-rxx2, y, rxx2, ryy2, 0, 90); + arcMoveTo(x, y, rxx2, ryy2, 180); + arcTo(x, y, rxx2, ryy2, 180, -90); + arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90); + arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90); + arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90); closeSubpath(); d_func()->require_moveTo = true; -- cgit v0.12 From 9d4420c1fd82e44698be05699ff446ee1c0aaf6d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 3 Nov 2009 20:31:01 +0100 Subject: qdoc: Fixed XHTML breakage caused by the Google search bar markup. Reviewed-by: Trust Me --- tools/qdoc3/test/qt-html-templates.qdocconf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 7ceacb2..8c039eb 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -35,7 +35,7 @@ HTML.footer = "


\n" \ \ "" \ "" \ - "" \ + "" \ \ - ""\ + ""\ "
" -- cgit v0.12 From 3bd0c26cbce7ff21e7e930f9cd058146c3fa601f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 3 Nov 2009 20:37:25 +0100 Subject: Doc: Added in-progress documentation for the Image Gestures example. Reviewed-by: Trust Me --- doc/src/examples/imagegestures.qdoc | 116 ++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 doc/src/examples/imagegestures.qdoc diff --git a/doc/src/examples/imagegestures.qdoc b/doc/src/examples/imagegestures.qdoc new file mode 100644 index 0000000..33c1ace --- /dev/null +++ b/doc/src/examples/imagegestures.qdoc @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example gestures/imagegestures + \title Image Gestures Example + + This example shows how to enable gestures for a widget and use gesture input + to perform actions. + + \image imagegestures-example.png Screenshot of the Image Gestures example. + + We use two classes to create the user interface for the application: \c MainWidget + and \c ImageWidget. The \c MainWidget class is simply used as a container for the + \c ImageWidget class, which we will configure to accept gesture input. Since we + are interested in the way gestures are used, we will concentrate on the + implementation of the \c ImageWidget class. + + \section1 ImageWidget Class Definition + + The \c ImageWidget class is a simple QWidget subclass that reimplements the general + QWidget::event() handler function in addition to several more specific event handlers: + + \snippet examples/gestures/imagegestures/imagewidget.h class definition begin + \dots + \snippet examples/gestures/imagegestures/imagewidget.h class definition end + + We also implement a private helper function, \c gestureEvent(), to help manage + gesture events delivered to the widget, and three functions to perform actions + based on gestures: \c panTriggered(), \c pinchTriggered() and \c swipeTriggered(). + + \section1 ImageWidget Class Implementation + + In the widget's constructor, we begin by setting up various parameters that will + be used to control the way images are displayed. + + \snippet examples/gestures/imagegestures/imagewidget.cpp constructor + + We enable three of the standard gestures for the widget by calling QWidget::grabGesture() + with the types of gesture we need. These will be recognized by the application's + default gesture recognizer, and events will be delivered to our widget. + + Since QWidget does not define a specific event handler for gestures, the widget + needs to reimplement the general QWidget::event() to receive gesture events. + + \snippet examples/gestures/imagegestures/imagewidget.cpp event handler + + We implement the event handler to delegate gesture events to a private function + specifically written for the task, and pass all other events to QWidget's + implementation. + + The \c gestureHandler() function examines the gestures supplied by the + newly-delivered QGestureEvent. Since only one gesture of a given type can be + used on a widget at any particular time, we can check for each gesture type + using the QGestureEvent::gesture() function: + + \snippet examples/gestures/imagegestures/imagewidget.cpp gesture event handler + + If a QGesture object is supplied for a certain type of gesture, we call a special + purpose function to deal with it, casting the gesture object to the appropriate + QGesture subclass. + + To illustrate how a standard gesture can be interpreted by an application, we + show the implementation of the \c swipeTriggered() function, which handles the + gesture associated with a brushing or swiping motion on the user's display or + input device: + + \snippet examples/gestures/imagegestures/imagewidget.cpp swipe function + + The QSwipeGesture class provides specialized functions and defines a enum + to make it more convenient for developers to discover which direction, if + any, the user swiped the display. Here, we simply navigate to the previous + image in the collection if the user swiped upwards or to the left; otherwise + we navigate to the next image in the collection. + + The other gestures are also handled by special purpose functions, but use + the values of properties held by the QGesture object passed to them. +*/ -- cgit v0.12 From 70a568a7c24772a12a14370b8bde5a3620a2bcfd Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 23:16:49 +0100 Subject: Fix compile error for Symbian WINSCW emulator Reviewed-by: Iain --- src/corelib/tools/qvector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 7402d77..930b006 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -92,7 +92,7 @@ struct QVectorTypedData : private QVectorData // as this would break strict aliasing rules. (in the case of shared_null) T array[1]; - static inline void free(QVectorTypedData *x, int alignment) { QVectorData::free(x, alignment); } + static inline void free(QVectorTypedData *x, int alignment) { QVectorData::free(static_cast(x), alignment); } }; class QRegion; -- cgit v0.12 From d03b2cd7e65aa097c555297473c3ee038bed0f71 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 3 Nov 2009 23:23:54 +0100 Subject: def files update New def file for XML patterns Some changes in GUI effects API Reviewed-by: Trust Me --- src/s60installs/bwins/QtCoreu.def | 25 ++- src/s60installs/bwins/QtGuiu.def | 192 ++++++++++++--------- src/s60installs/bwins/QtScriptu.def | 15 ++ src/s60installs/bwins/QtXmlPatternsu.def | 280 +++++++++++++++++++++++++++++++ src/s60installs/eabi/QtCoreu.def | 25 ++- src/s60installs/eabi/QtGuiu.def | 157 +++++++++-------- src/s60installs/eabi/QtScriptu.def | 17 ++ src/s60installs/eabi/QtXmlPatternsu.def | 253 ++++++++++++++++++++++++++++ 8 files changed, 817 insertions(+), 147 deletions(-) create mode 100644 src/s60installs/bwins/QtXmlPatternsu.def create mode 100644 src/s60installs/eabi/QtXmlPatternsu.def diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index cbaf523..9d3db41 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -3968,7 +3968,7 @@ EXPORTS ?constEnd@QByteArray@@QBEPBDXZ @ 3967 NONAME ; char const * QByteArray::constEnd(void) const ?setOvershoot@QEasingCurve@@QAEXM@Z @ 3968 NONAME ; void QEasingCurve::setOvershoot(float) ??6@YAAAVQDataStream@@AAV0@ABVQRectF@@@Z @ 3969 NONAME ; class QDataStream & operator<<(class QDataStream &, class QRectF const &) - ?detach_helper@QHashData@@QAEPAU1@P6AXPAUNode@1@PAX@ZP6AX0@ZH@Z @ 3970 NONAME ; struct QHashData * QHashData::detach_helper(void (*)(struct QHashData::Node *, void *), void (*)(struct QHashData::Node *), int) + ?detach_helper@QHashData@@QAEPAU1@P6AXPAUNode@1@PAX@ZP6AX0@ZH@Z @ 3970 NONAME ABSENT ; struct QHashData * QHashData::detach_helper(void (*)(struct QHashData::Node *, void *), void (*)(struct QHashData::Node *), int) ??0QSystemLocale@@AAE@_N@Z @ 3971 NONAME ; QSystemLocale::QSystemLocale(bool) ?data@QHBufC@@QBEPBVHBufC16@@XZ @ 3972 NONAME ; class HBufC16 const * QHBufC::data(void) const ?setFileName@QFile@@QAEXABVQString@@@Z @ 3973 NONAME ; void QFile::setFileName(class QString const &) @@ -4357,4 +4357,27 @@ EXPORTS ??6@YA?AVQDebug@@V0@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z @ 4356 NONAME ; class QDebug operator<<(class QDebug, class QFlags) ?staticMetaObject@QHistoryState@@2UQMetaObject@@B @ 4357 NONAME ; struct QMetaObject const QHistoryState::staticMetaObject ?unlock@QSharedMemory@@QAE_NXZ @ 4358 NONAME ; bool QSharedMemory::unlock(void) + ?allocate@QContiguousCacheData@@SAPAU1@HH@Z @ 4359 NONAME ; struct QContiguousCacheData * QContiguousCacheData::allocate(int, int) + ?allocate@QVectorData@@SAPAU1@HH@Z @ 4360 NONAME ; struct QVectorData * QVectorData::allocate(int, int) + ?allocateNode@QHashData@@QAEPAXH@Z @ 4361 NONAME ; void * QHashData::allocateNode(int) + ?buildDate@QLibraryInfo@@SA?AVQDate@@XZ @ 4362 NONAME ; class QDate QLibraryInfo::buildDate(void) + ?createData@QMapData@@SAPAU1@H@Z @ 4363 NONAME ; struct QMapData * QMapData::createData(int) + ?dequeueExternalEvent@QStateMachinePrivate@@QAEPAVQEvent@@XZ @ 4364 NONAME ; class QEvent * QStateMachinePrivate::dequeueExternalEvent(void) + ?dequeueInternalEvent@QStateMachinePrivate@@QAEPAVQEvent@@XZ @ 4365 NONAME ; class QEvent * QStateMachinePrivate::dequeueInternalEvent(void) + ?detach_helper2@QHashData@@QAEPAU1@P6AXPAUNode@1@PAX@ZP6AX0@ZHH@Z @ 4366 NONAME ; struct QHashData * QHashData::detach_helper2(void (*)(struct QHashData::Node *, void *), void (*)(struct QHashData::Node *), int, int) + ?free@QContiguousCacheData@@SAXPAU1@@Z @ 4367 NONAME ; void QContiguousCacheData::free(struct QContiguousCacheData *) + ?free@QVectorData@@SAXPAU1@H@Z @ 4368 NONAME ; void QVectorData::free(struct QVectorData *, int) + ?isExternalEventQueueEmpty@QStateMachinePrivate@@QAE_NXZ @ 4369 NONAME ; bool QStateMachinePrivate::isExternalEventQueueEmpty(void) + ?isInternalEventQueueEmpty@QStateMachinePrivate@@QAE_NXZ @ 4370 NONAME ; bool QStateMachinePrivate::isInternalEventQueueEmpty(void) + ?node_create@QMapData@@QAEPAUNode@1@QAPAU21@HH@Z @ 4371 NONAME ; struct QMapData::Node * QMapData::node_create(struct QMapData::Node * * const, int, int) + ?postExternalEvent@QStateMachinePrivate@@QAEXPAVQEvent@@@Z @ 4372 NONAME ; void QStateMachinePrivate::postExternalEvent(class QEvent *) + ?postInternalEvent@QStateMachinePrivate@@QAEXPAVQEvent@@@Z @ 4373 NONAME ; void QStateMachinePrivate::postInternalEvent(class QEvent *) + ?qFreeAligned@@YAXPAX@Z @ 4374 NONAME ; void qFreeAligned(void *) + ?qMallocAligned@@YAPAXII@Z @ 4375 NONAME ; void * qMallocAligned(unsigned int, unsigned int) + ?qReallocAligned@@YAPAXPAXIII@Z @ 4376 NONAME ; void * qReallocAligned(void *, unsigned int, unsigned int, unsigned int) + ?reallocate@QVectorData@@SAPAU1@PAU1@HHH@Z @ 4377 NONAME ; struct QVectorData * QVectorData::reallocate(struct QVectorData *, int, int, int) + ?toFinalState@QStateMachinePrivate@@SAPAVQFinalState@@PAVQAbstractState@@@Z @ 4378 NONAME ; class QFinalState * QStateMachinePrivate::toFinalState(class QAbstractState *) + ?toHistoryState@QStateMachinePrivate@@SAPAVQHistoryState@@PAVQAbstractState@@@Z @ 4379 NONAME ; class QHistoryState * QStateMachinePrivate::toHistoryState(class QAbstractState *) + ?toStandardState@QStateMachinePrivate@@SAPAVQState@@PAVQAbstractState@@@Z @ 4380 NONAME ; class QState * QStateMachinePrivate::toStandardState(class QAbstractState *) + ?toStandardState@QStateMachinePrivate@@SAPBVQState@@PBVQAbstractState@@@Z @ 4381 NONAME ; class QState const * QStateMachinePrivate::toStandardState(class QAbstractState const *) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 56ba18f..89b6d48 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -6,7 +6,7 @@ EXPORTS ?checkedAction@QActionGroup@@QBEPAVQAction@@XZ @ 5 NONAME ; class QAction * QActionGroup::checkedAction(void) const ?minimumSizeHint@QComboBox@@UBE?AVQSize@@XZ @ 6 NONAME ; class QSize QComboBox::minimumSizeHint(void) const ?setIcon@QStandardItem@@QAEXABVQIcon@@@Z @ 7 NONAME ; void QStandardItem::setIcon(class QIcon const &) - ?d_func@QGraphicsBloomEffect@@AAEPAVQGraphicsBloomEffectPrivate@@XZ @ 8 NONAME ; class QGraphicsBloomEffectPrivate * QGraphicsBloomEffect::d_func(void) + ?d_func@QGraphicsBloomEffect@@AAEPAVQGraphicsBloomEffectPrivate@@XZ @ 8 NONAME ABSENT ; class QGraphicsBloomEffectPrivate * QGraphicsBloomEffect::d_func(void) ?normalize@QVector2D@@QAEXXZ @ 9 NONAME ; void QVector2D::normalize(void) ?name@QColor@@QBE?AVQString@@XZ @ 10 NONAME ; class QString QColor::name(void) const ?openPersistentEditor@QListWidget@@QAEXPAVQListWidgetItem@@@Z @ 11 NONAME ; void QListWidget::openPersistentEditor(class QListWidgetItem *) @@ -96,7 +96,7 @@ EXPORTS ??0QIcon@@QAE@PAVQIconEngineV2@@@Z @ 95 NONAME ; QIcon::QIcon(class QIconEngineV2 *) ?qt_metacall@QFileSystemModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 96 NONAME ; int QFileSystemModel::qt_metacall(enum QMetaObject::Call, int, void * *) ?getStaticMetaObject@QGraphicsDropShadowEffect@@SAABUQMetaObject@@XZ @ 97 NONAME ; struct QMetaObject const & QGraphicsDropShadowEffect::getStaticMetaObject(void) - ?staticMetaObject@QGraphicsPixelizeEffect@@2UQMetaObject@@B @ 98 NONAME ; struct QMetaObject const QGraphicsPixelizeEffect::staticMetaObject + ?staticMetaObject@QGraphicsPixelizeEffect@@2UQMetaObject@@B @ 98 NONAME ABSENT ; struct QMetaObject const QGraphicsPixelizeEffect::staticMetaObject ?eraseRect@QPainter@@QAEXHHHH@Z @ 99 NONAME ; void QPainter::eraseRect(int, int, int, int) ?gotFocus@QFocusEvent@@QBE_NXZ @ 100 NONAME ; bool QFocusEvent::gotFocus(void) const ?setLayout@QWidget@@QAEXPAVQLayout@@@Z @ 101 NONAME ; void QWidget::setLayout(class QLayout *) @@ -130,7 +130,7 @@ EXPORTS ??_EQShortcutEvent@@UAE@I@Z @ 129 NONAME ; QShortcutEvent::~QShortcutEvent(unsigned int) ?tr@QTextBrowser@@SA?AVQString@@PBD0H@Z @ 130 NONAME ; class QString QTextBrowser::tr(char const *, char const *, int) ?setIconProvider@QFileSystemModel@@QAEXPAVQFileIconProvider@@@Z @ 131 NONAME ; void QFileSystemModel::setIconProvider(class QFileIconProvider *) - ?setStrength@QGraphicsBloomEffect@@QAEXM@Z @ 132 NONAME ; void QGraphicsBloomEffect::setStrength(float) + ?setStrength@QGraphicsBloomEffect@@QAEXM@Z @ 132 NONAME ABSENT ; void QGraphicsBloomEffect::setStrength(float) ?map@QMatrix4x4@@QBE?AVQVector4D@@ABV2@@Z @ 133 NONAME ; class QVector4D QMatrix4x4::map(class QVector4D const &) const ?clearSpans@QTableView@@QAEXXZ @ 134 NONAME ; void QTableView::clearSpans(void) ?tr@QPanGesture@@SA?AVQString@@PBD0@Z @ 135 NONAME ; class QString QPanGesture::tr(char const *, char const *) @@ -155,7 +155,7 @@ EXPORTS ?redoText@QUndoStack@@QBE?AVQString@@XZ @ 154 NONAME ; class QString QUndoStack::redoText(void) const ?dropEvent@QTableWidget@@MAEXPAVQDropEvent@@@Z @ 155 NONAME ; void QTableWidget::dropEvent(class QDropEvent *) ?setPalette@QToolTip@@SAXABVQPalette@@@Z @ 156 NONAME ; void QToolTip::setPalette(class QPalette const &) - ?tr@QGraphicsPixelizeEffect@@SA?AVQString@@PBD0@Z @ 157 NONAME ; class QString QGraphicsPixelizeEffect::tr(char const *, char const *) + ?tr@QGraphicsPixelizeEffect@@SA?AVQString@@PBD0@Z @ 157 NONAME ABSENT ; class QString QGraphicsPixelizeEffect::tr(char const *, char const *) ?read@QImageReader@@QAE?AVQImage@@XZ @ 158 NONAME ; class QImage QImageReader::read(void) ?tr@QPinchGesture@@SA?AVQString@@PBD0@Z @ 159 NONAME ; class QString QPinchGesture::tr(char const *, char const *) ?setRadius@QRadialGradient@@QAEXM@Z @ 160 NONAME ; void QRadialGradient::setRadius(float) @@ -408,7 +408,7 @@ EXPORTS ??1QMovie@@UAE@XZ @ 407 NONAME ; QMovie::~QMovie(void) ?setDrawBase@QTabBar@@QAEX_N@Z @ 408 NONAME ; void QTabBar::setDrawBase(bool) ?findNextPrevAnchor@QTextControl@@QAE_NABVQTextCursor@@_NAAV2@@Z @ 409 NONAME ; bool QTextControl::findNextPrevAnchor(class QTextCursor const &, bool, class QTextCursor &) - ?qt_metacast@QGraphicsGrayscaleEffect@@UAEPAXPBD@Z @ 410 NONAME ; void * QGraphicsGrayscaleEffect::qt_metacast(char const *) + ?qt_metacast@QGraphicsGrayscaleEffect@@UAEPAXPBD@Z @ 410 NONAME ABSENT ; void * QGraphicsGrayscaleEffect::qt_metacast(char const *) ?paintEvent@QToolButton@@MAEXPAVQPaintEvent@@@Z @ 411 NONAME ; void QToolButton::paintEvent(class QPaintEvent *) ?createHeuristicMask@QImage@@QBE?AV1@_N@Z @ 412 NONAME ; class QImage QImage::createHeuristicMask(bool) const ?supportsAnimation@QImageReader@@QBE_NXZ @ 413 NONAME ; bool QImageReader::supportsAnimation(void) const @@ -542,7 +542,7 @@ EXPORTS ?dotsPerMeterX@QImage@@QBEHXZ @ 541 NONAME ; int QImage::dotsPerMeterX(void) const ??0QStyleOptionComboBox@@QAE@ABV0@@Z @ 542 NONAME ; QStyleOptionComboBox::QStyleOptionComboBox(class QStyleOptionComboBox const &) ?setBackground@QWorkspace@@QAEXABVQBrush@@@Z @ 543 NONAME ; void QWorkspace::setBackground(class QBrush const &) - ?pixelSizeChanged@QGraphicsPixelizeEffect@@IAEXH@Z @ 544 NONAME ; void QGraphicsPixelizeEffect::pixelSizeChanged(int) + ?pixelSizeChanged@QGraphicsPixelizeEffect@@IAEXH@Z @ 544 NONAME ABSENT ; void QGraphicsPixelizeEffect::pixelSizeChanged(int) ?cursorForPosition@QTextEdit@@QBE?AVQTextCursor@@ABVQPoint@@@Z @ 545 NONAME ; class QTextCursor QTextEdit::cursorForPosition(class QPoint const &) const ??0QQuaternion@@QAE@XZ @ 546 NONAME ; QQuaternion::QQuaternion(void) ?modificationChanged@QPlainTextEdit@@IAEX_N@Z @ 547 NONAME ; void QPlainTextEdit::modificationChanged(bool) @@ -960,7 +960,7 @@ EXPORTS ?qt_metacall@QUndoView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 959 NONAME ; int QUndoView::qt_metacall(enum QMetaObject::Call, int, void * *) ?overlinePos@QFontMetrics@@QBEHXZ @ 960 NONAME ; int QFontMetrics::overlinePos(void) const ?modifiers@QKeyEvent@@QBE?AV?$QFlags@W4KeyboardModifier@Qt@@@@XZ @ 961 NONAME ; class QFlags QKeyEvent::modifiers(void) const - ?blurRadius@QPixmapDropShadowFilter@@QBEHXZ @ 962 NONAME ; int QPixmapDropShadowFilter::blurRadius(void) const + ?blurRadius@QPixmapDropShadowFilter@@QBEHXZ @ 962 NONAME ABSENT ; int QPixmapDropShadowFilter::blurRadius(void) const ?trUtf8@QButtonGroup@@SA?AVQString@@PBD0@Z @ 963 NONAME ; class QString QButtonGroup::trUtf8(char const *, char const *) ?staticMetaObject@QWidget@@2UQMetaObject@@B @ 964 NONAME ; struct QMetaObject const QWidget::staticMetaObject ?mapToScene@QGraphicsView@@QBE?AVQPointF@@ABVQPoint@@@Z @ 965 NONAME ; class QPointF QGraphicsView::mapToScene(class QPoint const &) const @@ -1049,7 +1049,7 @@ EXPORTS ?item@QTableWidget@@QBEPAVQTableWidgetItem@@HH@Z @ 1048 NONAME ; class QTableWidgetItem * QTableWidget::item(int, int) const ??0QRegion@@QAE@ABV0@@Z @ 1049 NONAME ; QRegion::QRegion(class QRegion const &) ?doLayout@QItemDelegate@@IBEXABVQStyleOptionViewItem@@PAVQRect@@11_N@Z @ 1050 NONAME ; void QItemDelegate::doLayout(class QStyleOptionViewItem const &, class QRect *, class QRect *, class QRect *, bool) const - ?brightnessChanged@QGraphicsBloomEffect@@IAEXH@Z @ 1051 NONAME ; void QGraphicsBloomEffect::brightnessChanged(int) + ?brightnessChanged@QGraphicsBloomEffect@@IAEXH@Z @ 1051 NONAME ABSENT ; void QGraphicsBloomEffect::brightnessChanged(int) ?type@QGraphicsProxyWidget@@UBEHXZ @ 1052 NONAME ; int QGraphicsProxyWidget::type(void) const ?numBytes@QImage@@QBEHXZ @ 1053 NONAME ; int QImage::numBytes(void) const ?clear@QMenuBar@@QAEXXZ @ 1054 NONAME ; void QMenuBar::clear(void) @@ -1450,7 +1450,7 @@ EXPORTS ?focusProxy@QWidget@@QBEPAV1@XZ @ 1449 NONAME ; class QWidget * QWidget::focusProxy(void) const ?closestLegalPosition@QSplitterHandle@@IAEHH@Z @ 1450 NONAME ; int QSplitterHandle::closestLegalPosition(int) ?setExtension@QGraphicsEllipseItem@@MAEXW4Extension@QGraphicsItem@@ABVQVariant@@@Z @ 1451 NONAME ; void QGraphicsEllipseItem::setExtension(enum QGraphicsItem::Extension, class QVariant const &) - ?tr@QGraphicsBloomEffect@@SA?AVQString@@PBD0H@Z @ 1452 NONAME ; class QString QGraphicsBloomEffect::tr(char const *, char const *, int) + ?tr@QGraphicsBloomEffect@@SA?AVQString@@PBD0H@Z @ 1452 NONAME ABSENT ; class QString QGraphicsBloomEffect::tr(char const *, char const *, int) ?docHandle@QTextObject@@QBEPAVQTextDocumentPrivate@@XZ @ 1453 NONAME ; class QTextDocumentPrivate * QTextObject::docHandle(void) const ??0QTextControl@@QAE@ABVQString@@PAVQObject@@@Z @ 1454 NONAME ; QTextControl::QTextControl(class QString const &, class QObject *) ?blockBoundingRect@QPlainTextDocumentLayout@@UBE?AVQRectF@@ABVQTextBlock@@@Z @ 1455 NONAME ; class QRectF QPlainTextDocumentLayout::blockBoundingRect(class QTextBlock const &) const @@ -1640,7 +1640,7 @@ EXPORTS ?angleChanged@QGraphicsRotation@@IAEXXZ @ 1639 NONAME ; void QGraphicsRotation::angleChanged(void) ?horizontalOffset@QTableView@@MBEHXZ @ 1640 NONAME ; int QTableView::horizontalOffset(void) const ?subWindowActivated@QMdiArea@@IAEXPAVQMdiSubWindow@@@Z @ 1641 NONAME ; void QMdiArea::subWindowActivated(class QMdiSubWindow *) - ??0QGraphicsGrayscaleEffect@@QAE@PAVQObject@@@Z @ 1642 NONAME ; QGraphicsGrayscaleEffect::QGraphicsGrayscaleEffect(class QObject *) + ??0QGraphicsGrayscaleEffect@@QAE@PAVQObject@@@Z @ 1642 NONAME ABSENT ; QGraphicsGrayscaleEffect::QGraphicsGrayscaleEffect(class QObject *) ?tr@QItemDelegate@@SA?AVQString@@PBD0H@Z @ 1643 NONAME ; class QString QItemDelegate::tr(char const *, char const *, int) ?isObscuredBy@QGraphicsPolygonItem@@UBE_NPBVQGraphicsItem@@@Z @ 1644 NONAME ; bool QGraphicsPolygonItem::isObscuredBy(class QGraphicsItem const *) const ?anchorClicked@QTextBrowser@@IAEXABVQUrl@@@Z @ 1645 NONAME ; void QTextBrowser::anchorClicked(class QUrl const &) @@ -1648,7 +1648,7 @@ EXPORTS ?enterEvent@QMenu@@MAEXPAVQEvent@@@Z @ 1647 NONAME ; void QMenu::enterEvent(class QEvent *) ?ensureInputCapabilitiesChanged@QCoeFepInputContext@@AAEXXZ @ 1648 NONAME ; void QCoeFepInputContext::ensureInputCapabilitiesChanged(void) ?tr@QSwipeGesture@@SA?AVQString@@PBD0@Z @ 1649 NONAME ; class QString QSwipeGesture::tr(char const *, char const *) - ?d_func@QGraphicsPixelizeEffect@@AAEPAVQGraphicsPixelizeEffectPrivate@@XZ @ 1650 NONAME ; class QGraphicsPixelizeEffectPrivate * QGraphicsPixelizeEffect::d_func(void) + ?d_func@QGraphicsPixelizeEffect@@AAEPAVQGraphicsPixelizeEffectPrivate@@XZ @ 1650 NONAME ABSENT ; class QGraphicsPixelizeEffectPrivate * QGraphicsPixelizeEffect::d_func(void) ?completer@QComboBox@@QBEPAVQCompleter@@XZ @ 1651 NONAME ; class QCompleter * QComboBox::completer(void) const ?testOption@QMdiSubWindow@@QBE_NW4SubWindowOption@1@@Z @ 1652 NONAME ; bool QMdiSubWindow::testOption(enum QMdiSubWindow::SubWindowOption) const ?mapRectToScene@QGraphicsItem@@QBE?AVQRectF@@ABV2@@Z @ 1653 NONAME ; class QRectF QGraphicsItem::mapRectToScene(class QRectF const &) const @@ -2133,7 +2133,7 @@ EXPORTS ?translate@QPainter@@QAEXABVQPoint@@@Z @ 2132 NONAME ; void QPainter::translate(class QPoint const &) ?tr@QStackedLayout@@SA?AVQString@@PBD0@Z @ 2133 NONAME ; class QString QStackedLayout::tr(char const *, char const *) ?dragLeaveEvent@QWidget@@MAEXPAVQDragLeaveEvent@@@Z @ 2134 NONAME ; void QWidget::dragLeaveEvent(class QDragLeaveEvent *) - ?trUtf8@QGraphicsGrayscaleEffect@@SA?AVQString@@PBD0@Z @ 2135 NONAME ; class QString QGraphicsGrayscaleEffect::trUtf8(char const *, char const *) + ?trUtf8@QGraphicsGrayscaleEffect@@SA?AVQString@@PBD0@Z @ 2135 NONAME ABSENT ; class QString QGraphicsGrayscaleEffect::trUtf8(char const *, char const *) ?format@QTextObject@@QBE?AVQTextFormat@@XZ @ 2136 NONAME ; class QTextFormat QTextObject::format(void) const ?addAction@QActionGroup@@QAEPAVQAction@@ABVQIcon@@ABVQString@@@Z @ 2137 NONAME ; class QAction * QActionGroup::addAction(class QIcon const &, class QString const &) ?update@QGraphicsEffect@@QAEXXZ @ 2138 NONAME ; void QGraphicsEffect::update(void) @@ -2602,7 +2602,7 @@ EXPORTS ?d_func@QToolButton@@AAEPAVQToolButtonPrivate@@XZ @ 2601 NONAME ; class QToolButtonPrivate * QToolButton::d_func(void) ?opaqueArea@QGraphicsEllipseItem@@UBE?AVQPainterPath@@XZ @ 2602 NONAME ; class QPainterPath QGraphicsEllipseItem::opaqueArea(void) const ?hitTestComplexControl@QCommonStyle@@UBE?AW4SubControl@QStyle@@W4ComplexControl@3@PBVQStyleOptionComplex@@ABVQPoint@@PBVQWidget@@@Z @ 2603 NONAME ; enum QStyle::SubControl QCommonStyle::hitTestComplexControl(enum QStyle::ComplexControl, class QStyleOptionComplex const *, class QPoint const &, class QWidget const *) const - ??0QGraphicsBloomEffect@@QAE@PAVQObject@@@Z @ 2604 NONAME ; QGraphicsBloomEffect::QGraphicsBloomEffect(class QObject *) + ??0QGraphicsBloomEffect@@QAE@PAVQObject@@@Z @ 2604 NONAME ABSENT ; QGraphicsBloomEffect::QGraphicsBloomEffect(class QObject *) ?alternateBase@QPalette@@QBEABVQBrush@@XZ @ 2605 NONAME ; class QBrush const & QPalette::alternateBase(void) const ?qt_metacast@QColumnView@@UAEPAXPBD@Z @ 2606 NONAME ; void * QColumnView::qt_metacast(char const *) ??_0QQuaternion@@QAEAAV0@M@Z @ 2607 NONAME ; class QQuaternion & QQuaternion::operator/=(float) @@ -2615,7 +2615,7 @@ EXPORTS ?options@QFileDialog@@QBE?AV?$QFlags@W4Option@QFileDialog@@@@XZ @ 2614 NONAME ; class QFlags QFileDialog::options(void) const ?dataChanged@QHeaderView@@MAEXABVQModelIndex@@0@Z @ 2615 NONAME ; void QHeaderView::dataChanged(class QModelIndex const &, class QModelIndex const &) ?hideText@QWhatsThis@@SAXXZ @ 2616 NONAME ; void QWhatsThis::hideText(void) - ?getStaticMetaObject@QGraphicsGrayscaleEffect@@SAABUQMetaObject@@XZ @ 2617 NONAME ; struct QMetaObject const & QGraphicsGrayscaleEffect::getStaticMetaObject(void) + ?getStaticMetaObject@QGraphicsGrayscaleEffect@@SAABUQMetaObject@@XZ @ 2617 NONAME ABSENT ; struct QMetaObject const & QGraphicsGrayscaleEffect::getStaticMetaObject(void) ?construct@QApplicationPrivate@@QAEXXZ @ 2618 NONAME ; void QApplicationPrivate::construct(void) ?mouseReleaseEvent@QSizeGrip@@MAEXPAVQMouseEvent@@@Z @ 2619 NONAME ; void QSizeGrip::mouseReleaseEvent(class QMouseEvent *) ?currentIndex@QTabBar@@QBEHXZ @ 2620 NONAME ; int QTabBar::currentIndex(void) const @@ -2664,7 +2664,7 @@ EXPORTS ?cleanIndex@QUndoStack@@QBEHXZ @ 2663 NONAME ; int QUndoStack::cleanIndex(void) const ?index@QFileSystemModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 2664 NONAME ; class QModelIndex QFileSystemModel::index(int, int, class QModelIndex const &) const ??1QStyleOptionFrameV3@@QAE@XZ @ 2665 NONAME ; QStyleOptionFrameV3::~QStyleOptionFrameV3(void) - ??1QGraphicsBloomEffect@@UAE@XZ @ 2666 NONAME ; QGraphicsBloomEffect::~QGraphicsBloomEffect(void) + ??1QGraphicsBloomEffect@@UAE@XZ @ 2666 NONAME ABSENT ; QGraphicsBloomEffect::~QGraphicsBloomEffect(void) ??1QAbstractTextDocumentLayout@@UAE@XZ @ 2667 NONAME ; QAbstractTextDocumentLayout::~QAbstractTextDocumentLayout(void) ?scaled@QPixmap@@QBE?AV1@HHW4AspectRatioMode@Qt@@W4TransformationMode@3@@Z @ 2668 NONAME ; class QPixmap QPixmap::scaled(int, int, enum Qt::AspectRatioMode, enum Qt::TransformationMode) const ??_EQGraphicsTransform@@UAE@I@Z @ 2669 NONAME ; QGraphicsTransform::~QGraphicsTransform(unsigned int) @@ -2682,7 +2682,7 @@ EXPORTS ?isBlockFormat@QTextFormat@@QBE_NXZ @ 2681 NONAME ; bool QTextFormat::isBlockFormat(void) const ??0QColormap@@QAE@ABV0@@Z @ 2682 NONAME ; QColormap::QColormap(class QColormap const &) ?rightPadding@QTextTableCellFormat@@QBEMXZ @ 2683 NONAME ; float QTextTableCellFormat::rightPadding(void) const - ?staticMetaObject@QGraphicsBloomEffect@@2UQMetaObject@@B @ 2684 NONAME ; struct QMetaObject const QGraphicsBloomEffect::staticMetaObject + ?staticMetaObject@QGraphicsBloomEffect@@2UQMetaObject@@B @ 2684 NONAME ABSENT ; struct QMetaObject const QGraphicsBloomEffect::staticMetaObject ?leading@QFontMetricsF@@QBEMXZ @ 2685 NONAME ; float QFontMetricsF::leading(void) const ?beginNativePainting@QPainter@@QAEXXZ @ 2686 NONAME ; void QPainter::beginNativePainting(void) ?addChildWidget@QLayout@@IAEXPAVQWidget@@@Z @ 2687 NONAME ; void QLayout::addChildWidget(class QWidget *) @@ -2733,7 +2733,7 @@ EXPORTS ?data_ptr@QPicture@@QAEAAV?$QExplicitlySharedDataPointer@VQPicturePrivate@@@@XZ @ 2732 NONAME ; class QExplicitlySharedDataPointer & QPicture::data_ptr(void) ?closeAllWindows@QApplication@@SAXXZ @ 2733 NONAME ; void QApplication::closeAllWindows(void) ?setMimeData@QDrag@@QAEXPAVQMimeData@@@Z @ 2734 NONAME ; void QDrag::setMimeData(class QMimeData *) - ?trUtf8@QGraphicsGrayscaleEffect@@SA?AVQString@@PBD0H@Z @ 2735 NONAME ; class QString QGraphicsGrayscaleEffect::trUtf8(char const *, char const *, int) + ?trUtf8@QGraphicsGrayscaleEffect@@SA?AVQString@@PBD0H@Z @ 2735 NONAME ABSENT ; class QString QGraphicsGrayscaleEffect::trUtf8(char const *, char const *, int) ?trUtf8@QStringListModel@@SA?AVQString@@PBD0H@Z @ 2736 NONAME ; class QString QStringListModel::trUtf8(char const *, char const *, int) ?trUtf8@QEventDispatcherS60@@SA?AVQString@@PBD0@Z @ 2737 NONAME ; class QString QEventDispatcherS60::trUtf8(char const *, char const *) ??0QMdiSubWindow@@QAE@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z @ 2738 NONAME ; QMdiSubWindow::QMdiSubWindow(class QWidget *, class QFlags) @@ -2801,7 +2801,7 @@ EXPORTS ??4QTextFormatCollection@@QAEAAV0@ABV0@@Z @ 2800 NONAME ; class QTextFormatCollection & QTextFormatCollection::operator=(class QTextFormatCollection const &) ?setDecMode@QLCDNumber@@QAEXXZ @ 2801 NONAME ; void QLCDNumber::setDecMode(void) ?setSelected@QTreeWidgetItem@@QAEX_N@Z @ 2802 NONAME ; void QTreeWidgetItem::setSelected(bool) - ??_EQGraphicsGrayscaleEffect@@UAE@I@Z @ 2803 NONAME ; QGraphicsGrayscaleEffect::~QGraphicsGrayscaleEffect(unsigned int) + ??_EQGraphicsGrayscaleEffect@@UAE@I@Z @ 2803 NONAME ABSENT ; QGraphicsGrayscaleEffect::~QGraphicsGrayscaleEffect(unsigned int) ?setTransformations@QGraphicsItem@@QAEXABV?$QList@PAVQGraphicsTransform@@@@@Z @ 2804 NONAME ; void QGraphicsItem::setTransformations(class QList const &) ?associatedWidgets@QAction@@QBE?AV?$QList@PAVQWidget@@@@XZ @ 2805 NONAME ; class QList QAction::associatedWidgets(void) const ??0QTransform@@QAE@W4Initialization@Qt@@@Z @ 2806 NONAME ; QTransform::QTransform(enum Qt::Initialization) @@ -2943,7 +2943,7 @@ EXPORTS ??1QTextDocumentFragment@@QAE@XZ @ 2942 NONAME ; QTextDocumentFragment::~QTextDocumentFragment(void) ?setInsertPolicy@QComboBox@@QAEXW4InsertPolicy@1@@Z @ 2943 NONAME ; void QComboBox::setInsertPolicy(enum QComboBox::InsertPolicy) ?setHorizontalSpacing@QGridLayout@@QAEXH@Z @ 2944 NONAME ; void QGridLayout::setHorizontalSpacing(int) - ?setPixelSize@QGraphicsPixelizeEffect@@QAEXH@Z @ 2945 NONAME ; void QGraphicsPixelizeEffect::setPixelSize(int) + ?setPixelSize@QGraphicsPixelizeEffect@@QAEXH@Z @ 2945 NONAME ABSENT ; void QGraphicsPixelizeEffect::setPixelSize(int) ?tr@QImageIOPlugin@@SA?AVQString@@PBD0@Z @ 2946 NONAME ; class QString QImageIOPlugin::tr(char const *, char const *) ?setStyle@QApplication@@SAPAVQStyle@@ABVQString@@@Z @ 2947 NONAME ; class QStyle * QApplication::setStyle(class QString const &) ??0QDrag@@QAE@PAVQWidget@@@Z @ 2948 NONAME ; QDrag::QDrag(class QWidget *) @@ -2978,7 +2978,7 @@ EXPORTS ?onTransition@QKeyEventTransition@@MAEXPAVQEvent@@@Z @ 2977 NONAME ; void QKeyEventTransition::onTransition(class QEvent *) ?size@QImageReader@@QBE?AVQSize@@XZ @ 2978 NONAME ; class QSize QImageReader::size(void) const ?unite@QRegion@@QBE?AV1@ABVQRect@@@Z @ 2979 NONAME ; class QRegion QRegion::unite(class QRect const &) const - ?strength@QGraphicsBloomEffect@@QBEMXZ @ 2980 NONAME ; float QGraphicsBloomEffect::strength(void) const + ?strength@QGraphicsBloomEffect@@QBEMXZ @ 2980 NONAME ABSENT ; float QGraphicsBloomEffect::strength(void) const ?registerEditor@QItemEditorFactory@@QAEXW4Type@QVariant@@PAVQItemEditorCreatorBase@@@Z @ 2981 NONAME ; void QItemEditorFactory::registerEditor(enum QVariant::Type, class QItemEditorCreatorBase *) ?count@QListWidget@@QBEHXZ @ 2982 NONAME ; int QListWidget::count(void) const ?loadFromData@QPixmap@@QAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 2983 NONAME ; bool QPixmap::loadFromData(unsigned char const *, unsigned int, char const *, class QFlags) @@ -3099,7 +3099,7 @@ EXPORTS ?nextCheckState@QToolButton@@MAEXXZ @ 3098 NONAME ; void QToolButton::nextCheckState(void) ?polish@QCommonStyle@@UAEXPAVQApplication@@@Z @ 3099 NONAME ; void QCommonStyle::polish(class QApplication *) ?lengthVectorProperty@QTextFormat@@QBE?AV?$QVector@VQTextLength@@@@H@Z @ 3100 NONAME ; class QVector QTextFormat::lengthVectorProperty(int) const - ?getStaticMetaObject@QGraphicsBloomEffect@@SAABUQMetaObject@@XZ @ 3101 NONAME ; struct QMetaObject const & QGraphicsBloomEffect::getStaticMetaObject(void) + ?getStaticMetaObject@QGraphicsBloomEffect@@SAABUQMetaObject@@XZ @ 3101 NONAME ABSENT ; struct QMetaObject const & QGraphicsBloomEffect::getStaticMetaObject(void) ?setMinimumDateTime@QDateTimeEdit@@QAEXABVQDateTime@@@Z @ 3102 NONAME ; void QDateTimeEdit::setMinimumDateTime(class QDateTime const &) ??1QResizeEvent@@UAE@XZ @ 3103 NONAME ; QResizeEvent::~QResizeEvent(void) ?boundingRectFor@QPixmapConvolutionFilter@@UBE?AVQRectF@@ABV2@@Z @ 3104 NONAME ; class QRectF QPixmapConvolutionFilter::boundingRectFor(class QRectF const &) const @@ -3115,7 +3115,7 @@ EXPORTS ?activateSymbianWindow@QWidgetPrivate@@QAEXPAVCCoeControl@@@Z @ 3114 NONAME ; void QWidgetPrivate::activateSymbianWindow(class CCoeControl *) ?loadFromData@QImage@@QAE_NPBEHPBD@Z @ 3115 NONAME ; bool QImage::loadFromData(unsigned char const *, int, char const *) ?addItem@QGridLayout@@QAEXPAVQLayoutItem@@HHHHV?$QFlags@W4AlignmentFlag@Qt@@@@@Z @ 3116 NONAME ; void QGridLayout::addItem(class QLayoutItem *, int, int, int, int, class QFlags) - ?d_func@QGraphicsPixelizeEffect@@ABEPBVQGraphicsPixelizeEffectPrivate@@XZ @ 3117 NONAME ; class QGraphicsPixelizeEffectPrivate const * QGraphicsPixelizeEffect::d_func(void) const + ?d_func@QGraphicsPixelizeEffect@@ABEPBVQGraphicsPixelizeEffectPrivate@@XZ @ 3117 NONAME ABSENT ; class QGraphicsPixelizeEffectPrivate const * QGraphicsPixelizeEffect::d_func(void) const ??D@YA?AVQLine@@ABV0@ABVQTransform@@@Z @ 3118 NONAME ; class QLine operator*(class QLine const &, class QTransform const &) ?boundingRectFor@QPixmapDropShadowFilter@@UBE?AVQRectF@@ABV2@@Z @ 3119 NONAME ; class QRectF QPixmapDropShadowFilter::boundingRectFor(class QRectF const &) const ?del@QLineEdit@@QAEXXZ @ 3120 NONAME ; void QLineEdit::del(void) @@ -3151,7 +3151,7 @@ EXPORTS ?device@QImageIOHandler@@QBEPAVQIODevice@@XZ @ 3150 NONAME ; class QIODevice * QImageIOHandler::device(void) const ?setCurrentIndex@QStackedLayout@@QAEXH@Z @ 3151 NONAME ; void QStackedLayout::setCurrentIndex(int) ?d_func@QWindowsStyle@@AAEPAVQWindowsStylePrivate@@XZ @ 3152 NONAME ; class QWindowsStylePrivate * QWindowsStyle::d_func(void) - ?tr@QGraphicsGrayscaleEffect@@SA?AVQString@@PBD0H@Z @ 3153 NONAME ; class QString QGraphicsGrayscaleEffect::tr(char const *, char const *, int) + ?tr@QGraphicsGrayscaleEffect@@SA?AVQString@@PBD0H@Z @ 3153 NONAME ABSENT ; class QString QGraphicsGrayscaleEffect::tr(char const *, char const *, int) ?sidebarUrls@QFileDialog@@QBE?AV?$QList@VQUrl@@@@XZ @ 3154 NONAME ; class QList QFileDialog::sidebarUrls(void) const ??1QPictureFormatInterface@@UAE@XZ @ 3155 NONAME ; QPictureFormatInterface::~QPictureFormatInterface(void) ?setLineCount@QTextBlock@@QAEXH@Z @ 3156 NONAME ; void QTextBlock::setLineCount(int) @@ -3365,7 +3365,7 @@ EXPORTS ?setObjectFormat@QTextFormatCollection@@QAEXHABVQTextFormat@@@Z @ 3364 NONAME ; void QTextFormatCollection::setObjectFormat(int, class QTextFormat const &) ?setExtension@QGraphicsSimpleTextItem@@MAEXW4Extension@QGraphicsItem@@ABVQVariant@@@Z @ 3365 NONAME ; void QGraphicsSimpleTextItem::setExtension(enum QGraphicsItem::Extension, class QVariant const &) ?palette@QGraphicsWidget@@QBE?AVQPalette@@XZ @ 3366 NONAME ; class QPalette QGraphicsWidget::palette(void) const - ?pixmap@QGraphicsEffectSource@@QBE?AVQPixmap@@W4CoordinateSystem@Qt@@PAVQPoint@@@Z @ 3367 NONAME ; class QPixmap QGraphicsEffectSource::pixmap(enum Qt::CoordinateSystem, class QPoint *) const + ?pixmap@QGraphicsEffectSource@@QBE?AVQPixmap@@W4CoordinateSystem@Qt@@PAVQPoint@@@Z @ 3367 NONAME ABSENT ; class QPixmap QGraphicsEffectSource::pixmap(enum Qt::CoordinateSystem, class QPoint *) const ?setColor@QPen@@QAEXABVQColor@@@Z @ 3368 NONAME ; void QPen::setColor(class QColor const &) ?pen@QPaintEngineState@@QBE?AVQPen@@XZ @ 3369 NONAME ; class QPen QPaintEngineState::pen(void) const ?fileName@QSound@@QBE?AVQString@@XZ @ 3370 NONAME ; class QString QSound::fileName(void) const @@ -3385,7 +3385,7 @@ EXPORTS ?qt_metacall@QStyle@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 3384 NONAME ; int QStyle::qt_metacall(enum QMetaObject::Call, int, void * *) ??1QApplication@@UAE@XZ @ 3385 NONAME ; QApplication::~QApplication(void) ?setBaseSize@QWidget@@QAEXABVQSize@@@Z @ 3386 NONAME ; void QWidget::setBaseSize(class QSize const &) - ?trUtf8@QGraphicsBloomEffect@@SA?AVQString@@PBD0@Z @ 3387 NONAME ; class QString QGraphicsBloomEffect::trUtf8(char const *, char const *) + ?trUtf8@QGraphicsBloomEffect@@SA?AVQString@@PBD0@Z @ 3387 NONAME ABSENT ; class QString QGraphicsBloomEffect::trUtf8(char const *, char const *) ?setWindowFilePath_helper@QWidgetPrivate@@QAEXABVQString@@@Z @ 3388 NONAME ; void QWidgetPrivate::setWindowFilePath_helper(class QString const &) ?setSourceModel@QSortFilterProxyModel@@UAEXPAVQAbstractItemModel@@@Z @ 3389 NONAME ; void QSortFilterProxyModel::setSourceModel(class QAbstractItemModel *) ?removeStack@QUndoGroup@@QAEXPAVQUndoStack@@@Z @ 3390 NONAME ; void QUndoGroup::removeStack(class QUndoStack *) @@ -3438,7 +3438,7 @@ EXPORTS ?MopSupplyObject@QCoeFepInputContext@@UAE?AVPtr@TTypeUid@@V3@@Z @ 3437 NONAME ; class TTypeUid::Ptr QCoeFepInputContext::MopSupplyObject(class TTypeUid) ?styleName@QGuiPlatformPlugin@@UAE?AVQString@@XZ @ 3438 NONAME ; class QString QGuiPlatformPlugin::styleName(void) ?rowsInserted@QAbstractItemView@@MAEXABVQModelIndex@@HH@Z @ 3439 NONAME ; void QAbstractItemView::rowsInserted(class QModelIndex const &, int, int) - ?setBlurHint@QGraphicsBloomEffect@@QAEXW4RenderHint@Qt@@@Z @ 3440 NONAME ; void QGraphicsBloomEffect::setBlurHint(enum Qt::RenderHint) + ?setBlurHint@QGraphicsBloomEffect@@QAEXW4RenderHint@Qt@@@Z @ 3440 NONAME ABSENT ; void QGraphicsBloomEffect::setBlurHint(enum Qt::RenderHint) ?gradient@QBrush@@QBEPBVQGradient@@XZ @ 3441 NONAME ; class QGradient const * QBrush::gradient(void) const ?hasFocus@QWidget@@QBE_NXZ @ 3442 NONAME ; bool QWidget::hasFocus(void) const ??0Symbol@QCss@@QAE@XZ @ 3443 NONAME ; QCss::Symbol::Symbol(void) @@ -3464,7 +3464,7 @@ EXPORTS ?header@QTreeView@@QBEPAVQHeaderView@@XZ @ 3463 NONAME ; class QHeaderView * QTreeView::header(void) const ?scrollToAnchor@QTextEdit@@QAEXABVQString@@@Z @ 3464 NONAME ; void QTextEdit::scrollToAnchor(class QString const &) ??_EQGraphicsSystem@@UAE@I@Z @ 3465 NONAME ; QGraphicsSystem::~QGraphicsSystem(unsigned int) - ?metaObject@QGraphicsPixelizeEffect@@UBEPBUQMetaObject@@XZ @ 3466 NONAME ; struct QMetaObject const * QGraphicsPixelizeEffect::metaObject(void) const + ?metaObject@QGraphicsPixelizeEffect@@UBEPBUQMetaObject@@XZ @ 3466 NONAME ABSENT ; struct QMetaObject const * QGraphicsPixelizeEffect::metaObject(void) const ?setWrapping@QDial@@QAEX_N@Z @ 3467 NONAME ; void QDial::setWrapping(bool) ?setActive@QGraphicsItem@@QAEX_N@Z @ 3468 NONAME ; void QGraphicsItem::setActive(bool) ?wordWrap@QLabel@@QBE_NXZ @ 3469 NONAME ; bool QLabel::wordWrap(void) const @@ -3915,7 +3915,7 @@ EXPORTS ?setConvolutionKernel@QPixmapConvolutionFilter@@QAEXPBMHH@Z @ 3914 NONAME ; void QPixmapConvolutionFilter::setConvolutionKernel(float const *, int, int) ?animate_menu@QApplicationPrivate@@2_NA @ 3915 NONAME ; bool QApplicationPrivate::animate_menu ?eventTest@QMouseEventTransition@@MAE_NPAVQEvent@@@Z @ 3916 NONAME ; bool QMouseEventTransition::eventTest(class QEvent *) - ??1QGraphicsPixelizeEffect@@UAE@XZ @ 3917 NONAME ; QGraphicsPixelizeEffect::~QGraphicsPixelizeEffect(void) + ??1QGraphicsPixelizeEffect@@UAE@XZ @ 3917 NONAME ABSENT ; QGraphicsPixelizeEffect::~QGraphicsPixelizeEffect(void) ?staticMetaObject@QTabWidget@@2UQMetaObject@@B @ 3918 NONAME ; struct QMetaObject const QTabWidget::staticMetaObject ?id@QUndoCommand@@UBEHXZ @ 3919 NONAME ; int QUndoCommand::id(void) const ?contextMenuEvent@QLabel@@MAEXPAVQContextMenuEvent@@@Z @ 3920 NONAME ; void QLabel::contextMenuEvent(class QContextMenuEvent *) @@ -3989,7 +3989,7 @@ EXPORTS ?cursorRect@QTextControl@@QBE?AVQRectF@@ABVQTextCursor@@@Z @ 3988 NONAME ; class QRectF QTextControl::cursorRect(class QTextCursor const &) const ?drawItems@QGraphicsView@@MAEXPAVQPainter@@HQAPAVQGraphicsItem@@QBVQStyleOptionGraphicsItem@@@Z @ 3989 NONAME ; void QGraphicsView::drawItems(class QPainter *, int, class QGraphicsItem * * const, class QStyleOptionGraphicsItem const * const) ?activateChildLayoutsRecursively@QWidgetPrivate@@QAEXXZ @ 3990 NONAME ; void QWidgetPrivate::activateChildLayoutsRecursively(void) - ?tr@QGraphicsBloomEffect@@SA?AVQString@@PBD0@Z @ 3991 NONAME ; class QString QGraphicsBloomEffect::tr(char const *, char const *) + ?tr@QGraphicsBloomEffect@@SA?AVQString@@PBD0@Z @ 3991 NONAME ABSENT ; class QString QGraphicsBloomEffect::tr(char const *, char const *) ?mimeData@QClipboard@@QBEPBVQMimeData@@W4Mode@1@@Z @ 3992 NONAME ; class QMimeData const * QClipboard::mimeData(enum QClipboard::Mode) const ?createWinId@QWidget@@QAEXXZ @ 3993 NONAME ; void QWidget::createWinId(void) ?closeActiveSubWindow@QMdiArea@@QAEXXZ @ 3994 NONAME ; void QMdiArea::closeActiveSubWindow(void) @@ -4098,7 +4098,7 @@ EXPORTS ?columnWidths@QColumnView@@QBE?AV?$QList@H@@XZ @ 4097 NONAME ; class QList QColumnView::columnWidths(void) const ?scale@QPainter@@QAEXMM@Z @ 4098 NONAME ; void QPainter::scale(float, float) ?setShortcut@QAction@@QAEXABVQKeySequence@@@Z @ 4099 NONAME ; void QAction::setShortcut(class QKeySequence const &) - ?draw@QGraphicsBloomEffect@@MAEXPAVQPainter@@PAVQGraphicsEffectSource@@@Z @ 4100 NONAME ; void QGraphicsBloomEffect::draw(class QPainter *, class QGraphicsEffectSource *) + ?draw@QGraphicsBloomEffect@@MAEXPAVQPainter@@PAVQGraphicsEffectSource@@@Z @ 4100 NONAME ABSENT ; void QGraphicsBloomEffect::draw(class QPainter *, class QGraphicsEffectSource *) ?setGeometry@QWidget@@QAEXABVQRect@@@Z @ 4101 NONAME ; void QWidget::setGeometry(class QRect const &) ?clear@QMenu@@QAEXXZ @ 4102 NONAME ; void QMenu::clear(void) ?mouseDoubleClickEvent@QAbstractScrollArea@@MAEXPAVQMouseEvent@@@Z @ 4103 NONAME ; void QAbstractScrollArea::mouseDoubleClickEvent(class QMouseEvent *) @@ -4109,7 +4109,7 @@ EXPORTS ?dragEnterEvent@QGraphicsScene@@MAEXPAVQGraphicsSceneDragDropEvent@@@Z @ 4108 NONAME ; void QGraphicsScene::dragEnterEvent(class QGraphicsSceneDragDropEvent *) ?draw@QTextLine@@QBEXPAVQPainter@@ABVQPointF@@PBUFormatRange@QTextLayout@@@Z @ 4109 NONAME ; void QTextLine::draw(class QPainter *, class QPointF const &, struct QTextLayout::FormatRange const *) const ?type@QSymbianEvent@@QBE?AW4Type@1@XZ @ 4110 NONAME ; enum QSymbianEvent::Type QSymbianEvent::type(void) const - ?boundingRectFor@QGraphicsBloomEffect@@UBE?AVQRectF@@ABV2@@Z @ 4111 NONAME ; class QRectF QGraphicsBloomEffect::boundingRectFor(class QRectF const &) const + ?boundingRectFor@QGraphicsBloomEffect@@UBE?AVQRectF@@ABV2@@Z @ 4111 NONAME ABSENT ; class QRectF QGraphicsBloomEffect::boundingRectFor(class QRectF const &) const ?setDockOptions@QMainWindow@@QAEXV?$QFlags@W4DockOption@QMainWindow@@@@@Z @ 4112 NONAME ; void QMainWindow::setDockOptions(class QFlags) ?canUndoChanged@QUndoGroup@@IAEX_N@Z @ 4113 NONAME ; void QUndoGroup::canUndoChanged(bool) ?d_func@QMdiArea@@AAEPAVQMdiAreaPrivate@@XZ @ 4114 NONAME ; class QMdiAreaPrivate * QMdiArea::d_func(void) @@ -4159,7 +4159,7 @@ EXPORTS ?isUndoRedoEnabled@QPlainTextEdit@@QBE_NXZ @ 4158 NONAME ; bool QPlainTextEdit::isUndoRedoEnabled(void) const ?clicked@QGroupBox@@IAEX_N@Z @ 4159 NONAME ; void QGroupBox::clicked(bool) ?setKeyboardSingleStep@QMdiSubWindow@@QAEXH@Z @ 4160 NONAME ; void QMdiSubWindow::setKeyboardSingleStep(int) - ?brightness@QGraphicsBloomEffect@@QBEHXZ @ 4161 NONAME ; int QGraphicsBloomEffect::brightness(void) const + ?brightness@QGraphicsBloomEffect@@QBEHXZ @ 4161 NONAME ABSENT ; int QGraphicsBloomEffect::brightness(void) const ??_EQDragMoveEvent@@UAE@I@Z @ 4162 NONAME ; QDragMoveEvent::~QDragMoveEvent(unsigned int) ?isItemSelected@QListWidget@@QBE_NPBVQListWidgetItem@@@Z @ 4163 NONAME ; bool QListWidget::isItemSelected(class QListWidgetItem const *) const ?d_func@QGraphicsBlurEffect@@ABEPBVQGraphicsBlurEffectPrivate@@XZ @ 4164 NONAME ; class QGraphicsBlurEffectPrivate const * QGraphicsBlurEffect::d_func(void) const @@ -4297,7 +4297,7 @@ EXPORTS ?isAreaAllowed@QToolBar@@QBE_NW4ToolBarArea@Qt@@@Z @ 4296 NONAME ; bool QToolBar::isAreaAllowed(enum Qt::ToolBarArea) const ?fontWeight@QTextCharFormat@@QBEHXZ @ 4297 NONAME ; int QTextCharFormat::fontWeight(void) const ?staticMetaObject@QTextList@@2UQMetaObject@@B @ 4298 NONAME ; struct QMetaObject const QTextList::staticMetaObject - ?setBlurRadius@QPixmapDropShadowFilter@@QAEXH@Z @ 4299 NONAME ; void QPixmapDropShadowFilter::setBlurRadius(int) + ?setBlurRadius@QPixmapDropShadowFilter@@QAEXH@Z @ 4299 NONAME ABSENT ; void QPixmapDropShadowFilter::setBlurRadius(int) ?GetEditorContentForFep@QCoeFepInputContext@@UBEXAAVTDes16@@HH@Z @ 4300 NONAME ; void QCoeFepInputContext::GetEditorContentForFep(class TDes16 &, int, int) const ?trUtf8@QGraphicsWidget@@SA?AVQString@@PBD0H@Z @ 4301 NONAME ; class QString QGraphicsWidget::trUtf8(char const *, char const *, int) ?extraItemCache@QGraphicsItemPrivate@@QBEPAVQGraphicsItemCache@@XZ @ 4302 NONAME ; class QGraphicsItemCache * QGraphicsItemPrivate::extraItemCache(void) const @@ -4663,7 +4663,7 @@ EXPORTS ?event@QAbstractSlider@@MAE_NPAVQEvent@@@Z @ 4662 NONAME ; bool QAbstractSlider::event(class QEvent *) ??_EQS60Style@@UAE@I@Z @ 4663 NONAME ; QS60Style::~QS60Style(unsigned int) ?setModal@QDialog@@QAEX_N@Z @ 4664 NONAME ; void QDialog::setModal(bool) - ??_EQGraphicsBloomEffect@@UAE@I@Z @ 4665 NONAME ; QGraphicsBloomEffect::~QGraphicsBloomEffect(unsigned int) + ??_EQGraphicsBloomEffect@@UAE@I@Z @ 4665 NONAME ABSENT ; QGraphicsBloomEffect::~QGraphicsBloomEffect(unsigned int) ?tr@QDoubleSpinBox@@SA?AVQString@@PBD0@Z @ 4666 NONAME ; class QString QDoubleSpinBox::tr(char const *, char const *) ?isNavigationBarVisible@QCalendarWidget@@QBE_NXZ @ 4667 NONAME ; bool QCalendarWidget::isNavigationBarVisible(void) const ??0QStatusBar@@QAE@PAVQWidget@@@Z @ 4668 NONAME ; QStatusBar::QStatusBar(class QWidget *) @@ -4674,7 +4674,7 @@ EXPORTS ?heightForWidth@QBoxLayout@@UBEHH@Z @ 4673 NONAME ; int QBoxLayout::heightForWidth(int) const ?specialValueText@QAbstractSpinBox@@QBE?AVQString@@XZ @ 4674 NONAME ; class QString QAbstractSpinBox::specialValueText(void) const ?showEvent@QGraphicsView@@MAEXPAVQShowEvent@@@Z @ 4675 NONAME ; void QGraphicsView::showEvent(class QShowEvent *) - ?blurRadiusChanged@QGraphicsBloomEffect@@IAEXH@Z @ 4676 NONAME ; void QGraphicsBloomEffect::blurRadiusChanged(int) + ?blurRadiusChanged@QGraphicsBloomEffect@@IAEXH@Z @ 4676 NONAME ABSENT ; void QGraphicsBloomEffect::blurRadiusChanged(int) ?setAutoCompletionCaseSensitivity@QComboBox@@QAEXW4CaseSensitivity@Qt@@@Z @ 4677 NONAME ; void QComboBox::setAutoCompletionCaseSensitivity(enum Qt::CaseSensitivity) ?itemDoubleClicked@QTreeWidget@@IAEXPAVQTreeWidgetItem@@H@Z @ 4678 NONAME ; void QTreeWidget::itemDoubleClicked(class QTreeWidgetItem *, int) ?setFontItalic@QTextEdit@@QAEX_N@Z @ 4679 NONAME ; void QTextEdit::setFontItalic(bool) @@ -4741,7 +4741,7 @@ EXPORTS ?type@QGraphicsItem@@UBEHXZ @ 4740 NONAME ; int QGraphicsItem::type(void) const ?modifiers@QInputEvent@@QBE?AV?$QFlags@W4KeyboardModifier@Qt@@@@XZ @ 4741 NONAME ; class QFlags QInputEvent::modifiers(void) const ?transformed@QBitmap@@QBE?AV1@ABVQTransform@@@Z @ 4742 NONAME ; class QBitmap QBitmap::transformed(class QTransform const &) const - ?tr@QGraphicsGrayscaleEffect@@SA?AVQString@@PBD0@Z @ 4743 NONAME ; class QString QGraphicsGrayscaleEffect::tr(char const *, char const *) + ?tr@QGraphicsGrayscaleEffect@@SA?AVQString@@PBD0@Z @ 4743 NONAME ABSENT ; class QString QGraphicsGrayscaleEffect::tr(char const *, char const *) ?setBlurHint@QGraphicsBlurEffect@@QAEXW4RenderHint@Qt@@@Z @ 4744 NONAME ; void QGraphicsBlurEffect::setBlurHint(enum Qt::RenderHint) ?event@QDockWidget@@MAE_NPAVQEvent@@@Z @ 4745 NONAME ; bool QDockWidget::event(class QEvent *) ??_EQStyle@@UAE@I@Z @ 4746 NONAME ; QStyle::~QStyle(unsigned int) @@ -4835,7 +4835,7 @@ EXPORTS ?setStandardButtons@QMessageBox@@QAEXV?$QFlags@W4StandardButton@QMessageBox@@@@@Z @ 4834 NONAME ; void QMessageBox::setStandardButtons(class QFlags) ??0QTextTableCell@@QAE@ABV0@@Z @ 4835 NONAME ; QTextTableCell::QTextTableCell(class QTextTableCell const &) ?createStandardContextMenu@QTextControl@@QAEPAVQMenu@@ABVQPointF@@PAVQWidget@@@Z @ 4836 NONAME ; class QMenu * QTextControl::createStandardContextMenu(class QPointF const &, class QWidget *) - ?metaObject@QGraphicsGrayscaleEffect@@UBEPBUQMetaObject@@XZ @ 4837 NONAME ; struct QMetaObject const * QGraphicsGrayscaleEffect::metaObject(void) const + ?metaObject@QGraphicsGrayscaleEffect@@UBEPBUQMetaObject@@XZ @ 4837 NONAME ABSENT ; struct QMetaObject const * QGraphicsGrayscaleEffect::metaObject(void) const ??9QFont@@QBE_NABV0@@Z @ 4838 NONAME ; bool QFont::operator!=(class QFont const &) const ?yearShown@QCalendarWidget@@QBEHXZ @ 4839 NONAME ; int QCalendarWidget::yearShown(void) const ?setRowSpacing@QGraphicsGridLayout@@QAEXHM@Z @ 4840 NONAME ; void QGraphicsGridLayout::setRowSpacing(int, float) @@ -5072,7 +5072,7 @@ EXPORTS ?removeToolBar@QMainWindow@@QAEXPAVQToolBar@@@Z @ 5071 NONAME ; void QMainWindow::removeToolBar(class QToolBar *) ??0QGraphicsItemAnimation@@QAE@PAVQObject@@@Z @ 5072 NONAME ; QGraphicsItemAnimation::QGraphicsItemAnimation(class QObject *) ?addStrut@QBoxLayout@@QAEXH@Z @ 5073 NONAME ; void QBoxLayout::addStrut(int) - ??1QGraphicsGrayscaleEffect@@UAE@XZ @ 5074 NONAME ; QGraphicsGrayscaleEffect::~QGraphicsGrayscaleEffect(void) + ??1QGraphicsGrayscaleEffect@@UAE@XZ @ 5074 NONAME ABSENT ; QGraphicsGrayscaleEffect::~QGraphicsGrayscaleEffect(void) ?setSelection@QListView@@MAEXABVQRect@@V?$QFlags@W4SelectionFlag@QItemSelectionModel@@@@@Z @ 5075 NONAME ; void QListView::setSelection(class QRect const &, class QFlags) ?staticMetaObject@QAbstractSpinBox@@2UQMetaObject@@B @ 5076 NONAME ; struct QMetaObject const QAbstractSpinBox::staticMetaObject ?trUtf8@QAbstractItemDelegate@@SA?AVQString@@PBD0@Z @ 5077 NONAME ; class QString QAbstractItemDelegate::trUtf8(char const *, char const *) @@ -5189,7 +5189,7 @@ EXPORTS ?toCmyk@QColor@@QBE?AV1@XZ @ 5188 NONAME ; class QColor QColor::toCmyk(void) const ?maximum@QProgressBar@@QBEHXZ @ 5189 NONAME ; int QProgressBar::maximum(void) const ?geometry@QGraphicsLayoutItem@@QBE?AVQRectF@@XZ @ 5190 NONAME ; class QRectF QGraphicsLayoutItem::geometry(void) const - ?blurRadiusChanged@QGraphicsBlurEffect@@IAEXH@Z @ 5191 NONAME ; void QGraphicsBlurEffect::blurRadiusChanged(int) + ?blurRadiusChanged@QGraphicsBlurEffect@@IAEXH@Z @ 5191 NONAME ABSENT ; void QGraphicsBlurEffect::blurRadiusChanged(int) ?qt_metacall@QFontDialog@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 5192 NONAME ; int QFontDialog::qt_metacall(enum QMetaObject::Call, int, void * *) ?layoutSpacing@QStyle@@QBEHW4ControlType@QSizePolicy@@0W4Orientation@Qt@@PBVQStyleOption@@PBVQWidget@@@Z @ 5193 NONAME ; int QStyle::layoutSpacing(enum QSizePolicy::ControlType, enum QSizePolicy::ControlType, enum Qt::Orientation, class QStyleOption const *, class QWidget const *) const ?invalidate@QFormLayout@@UAEXXZ @ 5194 NONAME ; void QFormLayout::invalidate(void) @@ -5286,7 +5286,7 @@ EXPORTS ?setFontOverline@QTextCharFormat@@QAEX_N@Z @ 5285 NONAME ; void QTextCharFormat::setFontOverline(bool) ?selectedIndexes@QAbstractItemView@@MBE?AV?$QList@VQModelIndex@@@@XZ @ 5286 NONAME ; class QList QAbstractItemView::selectedIndexes(void) const ?addPixmap@QIcon@@QAEXABVQPixmap@@W4Mode@1@W4State@1@@Z @ 5287 NONAME ; void QIcon::addPixmap(class QPixmap const &, enum QIcon::Mode, enum QIcon::State) - ?blurRadius@QGraphicsBloomEffect@@QBEHXZ @ 5288 NONAME ; int QGraphicsBloomEffect::blurRadius(void) const + ?blurRadius@QGraphicsBloomEffect@@QBEHXZ @ 5288 NONAME ABSENT ; int QGraphicsBloomEffect::blurRadius(void) const ?setSortLocaleAware@QSortFilterProxyModel@@QAEX_N@Z @ 5289 NONAME ; void QSortFilterProxyModel::setSortLocaleAware(bool) ?blockCountChanged@QTextControl@@IAEXH@Z @ 5290 NONAME ; void QTextControl::blockCountChanged(int) ?mousePressEvent@QSplashScreen@@MAEXPAVQMouseEvent@@@Z @ 5291 NONAME ; void QSplashScreen::mousePressEvent(class QMouseEvent *) @@ -5482,7 +5482,7 @@ EXPORTS ?itemData@QComboBox@@QBE?AVQVariant@@HH@Z @ 5481 NONAME ; class QVariant QComboBox::itemData(int, int) const ?RestoreMenuL@QS60MainAppUi@@UAEXPAVCCoeControl@@HW4TMenuType@MEikMenuObserver@@@Z @ 5482 NONAME ; void QS60MainAppUi::RestoreMenuL(class CCoeControl *, int, enum MEikMenuObserver::TMenuType) ?depth@QImage@@QBEHXZ @ 5483 NONAME ; int QImage::depth(void) const - ?setStrength@QGraphicsGrayscaleEffect@@QAEXM@Z @ 5484 NONAME ; void QGraphicsGrayscaleEffect::setStrength(float) + ?setStrength@QGraphicsGrayscaleEffect@@QAEXM@Z @ 5484 NONAME ABSENT ; void QGraphicsGrayscaleEffect::setStrength(float) ?setPasswordCharacter@QLineControl@@QAEXABVQChar@@@Z @ 5485 NONAME ; void QLineControl::setPasswordCharacter(class QChar const &) ?tr@QMdiSubWindow@@SA?AVQString@@PBD0H@Z @ 5486 NONAME ; class QString QMdiSubWindow::tr(char const *, char const *, int) ?currentIndex@QDataWidgetMapper@@QBEHXZ @ 5487 NONAME ; int QDataWidgetMapper::currentIndex(void) const @@ -5591,7 +5591,7 @@ EXPORTS ??0QDockWidgetLayout@@QAE@PAVQWidget@@@Z @ 5590 NONAME ; QDockWidgetLayout::QDockWidgetLayout(class QWidget *) ?glyphMargin@QTextureGlyphCache@@UBEHXZ @ 5591 NONAME ; int QTextureGlyphCache::glyphMargin(void) const ?isInvisible@QGraphicsItemPrivate@@QBE_NXZ @ 5592 NONAME ; bool QGraphicsItemPrivate::isInvisible(void) const - ?unregisterGestureRecognizer@QApplication@@QAEXW4GestureType@Qt@@@Z @ 5593 NONAME ; void QApplication::unregisterGestureRecognizer(enum Qt::GestureType) + ?unregisterGestureRecognizer@QApplication@@QAEXW4GestureType@Qt@@@Z @ 5593 NONAME ABSENT ; void QApplication::unregisterGestureRecognizer(enum Qt::GestureType) ?removeChild@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 5594 NONAME ; void QGraphicsItemPrivate::removeChild(class QGraphicsItem *) ?appendRow@QStandardItemModel@@QAEXABV?$QList@PAVQStandardItem@@@@@Z @ 5595 NONAME ; void QStandardItemModel::appendRow(class QList const &) ?event@QTableWidget@@MAE_NPAVQEvent@@@Z @ 5596 NONAME ; bool QTableWidget::event(class QEvent *) @@ -6170,7 +6170,7 @@ EXPORTS ?setCurrentSection@QDateTimeEdit@@QAEXW4Section@1@@Z @ 6169 NONAME ; void QDateTimeEdit::setCurrentSection(enum QDateTimeEdit::Section) ?tr@QMenuBar@@SA?AVQString@@PBD0@Z @ 6170 NONAME ; class QString QMenuBar::tr(char const *, char const *) ?setRootIsDecorated@QTreeView@@QAEX_N@Z @ 6171 NONAME ; void QTreeView::setRootIsDecorated(bool) - ?qt_metacall@QGraphicsGrayscaleEffect@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 6172 NONAME ; int QGraphicsGrayscaleEffect::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacall@QGraphicsGrayscaleEffect@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 6172 NONAME ABSENT ; int QGraphicsGrayscaleEffect::qt_metacall(enum QMetaObject::Call, int, void * *) ?worldMatrixEnabled@QPainter@@QBE_NXZ @ 6173 NONAME ; bool QPainter::worldMatrixEnabled(void) const ??0iterator@QTextBlock@@AAE@PBVQTextDocumentPrivate@@HHH@Z @ 6174 NONAME ; QTextBlock::iterator::iterator(class QTextDocumentPrivate const *, int, int, int) ?isValid@QTextTableCell@@QBE_NXZ @ 6175 NONAME ; bool QTextTableCell::isValid(void) const @@ -6406,7 +6406,7 @@ EXPORTS ?widgetForAction@QToolBar@@QBEPAVQWidget@@PAVQAction@@@Z @ 6405 NONAME ; class QWidget * QToolBar::widgetForAction(class QAction *) const ?setPos@QGraphicsSceneMouseEvent@@QAEXABVQPointF@@@Z @ 6406 NONAME ; void QGraphicsSceneMouseEvent::setPos(class QPointF const &) ?setSelection@QLineEdit@@QAEXHH@Z @ 6407 NONAME ; void QLineEdit::setSelection(int, int) - ?d_func@QGraphicsBloomEffect@@ABEPBVQGraphicsBloomEffectPrivate@@XZ @ 6408 NONAME ; class QGraphicsBloomEffectPrivate const * QGraphicsBloomEffect::d_func(void) const + ?d_func@QGraphicsBloomEffect@@ABEPBVQGraphicsBloomEffectPrivate@@XZ @ 6408 NONAME ABSENT ; class QGraphicsBloomEffectPrivate const * QGraphicsBloomEffect::d_func(void) const ??1QSortFilterProxyModel@@UAE@XZ @ 6409 NONAME ; QSortFilterProxyModel::~QSortFilterProxyModel(void) ??1QTextBrowser@@UAE@XZ @ 6410 NONAME ; QTextBrowser::~QTextBrowser(void) ?maximumViewportSize@QAbstractScrollArea@@QBE?AVQSize@@XZ @ 6411 NONAME ; class QSize QAbstractScrollArea::maximumViewportSize(void) const @@ -6576,7 +6576,7 @@ EXPORTS ?activateNextSubWindow@QMdiArea@@QAEXXZ @ 6575 NONAME ; void QMdiArea::activateNextSubWindow(void) ?controlType@QSizePolicy@@QBE?AW4ControlType@1@XZ @ 6576 NONAME ; enum QSizePolicy::ControlType QSizePolicy::controlType(void) const ?rect@QTextLine@@QBE?AVQRectF@@XZ @ 6577 NONAME ; class QRectF QTextLine::rect(void) const - ?qt_metacall@QGraphicsPixelizeEffect@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 6578 NONAME ; int QGraphicsPixelizeEffect::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacall@QGraphicsPixelizeEffect@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 6578 NONAME ABSENT ; int QGraphicsPixelizeEffect::qt_metacall(enum QMetaObject::Call, int, void * *) ?question@QMessageBox@@SA?AW4StandardButton@1@PAVQWidget@@ABVQString@@1V?$QFlags@W4StandardButton@QMessageBox@@@@W421@@Z @ 6579 NONAME ; enum QMessageBox::StandardButton QMessageBox::question(class QWidget *, class QString const &, class QString const &, class QFlags, enum QMessageBox::StandardButton) ?symbianResourceChange@QApplicationPrivate@@QAEHH@Z @ 6580 NONAME ; int QApplicationPrivate::symbianResourceChange(int) ??6@YA?AVQDebug@@V0@ABVQPainterPath@@@Z @ 6581 NONAME ; class QDebug operator<<(class QDebug, class QPainterPath const &) @@ -6687,7 +6687,7 @@ EXPORTS ?sizeHint@QStyledItemDelegate@@UBE?AVQSize@@ABVQStyleOptionViewItem@@ABVQModelIndex@@@Z @ 6686 NONAME ; class QSize QStyledItemDelegate::sizeHint(class QStyleOptionViewItem const &, class QModelIndex const &) const ?setNameFilters@QFileSystemModel@@QAEXABVQStringList@@@Z @ 6687 NONAME ; void QFileSystemModel::setNameFilters(class QStringList const &) ?installSceneEventFilter@QGraphicsItem@@QAEXPAV1@@Z @ 6688 NONAME ; void QGraphicsItem::installSceneEventFilter(class QGraphicsItem *) - ?blurRadius@QGraphicsBlurEffect@@QBEHXZ @ 6689 NONAME ; int QGraphicsBlurEffect::blurRadius(void) const + ?blurRadius@QGraphicsBlurEffect@@QBEHXZ @ 6689 NONAME ABSENT ; int QGraphicsBlurEffect::blurRadius(void) const ?opaqueArea@QAbstractGraphicsShapeItem@@UBE?AVQPainterPath@@XZ @ 6690 NONAME ; class QPainterPath QAbstractGraphicsShapeItem::opaqueArea(void) const ?eventFilter@QSizeGrip@@MAE_NPAVQObject@@PAVQEvent@@@Z @ 6691 NONAME ; bool QSizeGrip::eventFilter(class QObject *, class QEvent *) ?resizeEvent@QComboBox@@MAEXPAVQResizeEvent@@@Z @ 6692 NONAME ; void QComboBox::resizeEvent(class QResizeEvent *) @@ -6787,7 +6787,7 @@ EXPORTS ?metaObject@QWidgetAction@@UBEPBUQMetaObject@@XZ @ 6786 NONAME ; struct QMetaObject const * QWidgetAction::metaObject(void) const ??1QInputEvent@@UAE@XZ @ 6787 NONAME ; QInputEvent::~QInputEvent(void) ?freeMemory@QTextEngine@@QAEXXZ @ 6788 NONAME ; void QTextEngine::freeMemory(void) - ?setRadius@QPixmapBlurFilter@@QAEXH@Z @ 6789 NONAME ; void QPixmapBlurFilter::setRadius(int) + ?setRadius@QPixmapBlurFilter@@QAEXH@Z @ 6789 NONAME ABSENT ; void QPixmapBlurFilter::setRadius(int) ?metaObject@QDialogButtonBox@@UBEPBUQMetaObject@@XZ @ 6790 NONAME ; struct QMetaObject const * QDialogButtonBox::metaObject(void) const ?qt_metacall@QWidgetAction@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 6791 NONAME ; int QWidgetAction::qt_metacall(enum QMetaObject::Call, int, void * *) ?addSubWindow@QMdiArea@@QAEPAVQMdiSubWindow@@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z @ 6792 NONAME ; class QMdiSubWindow * QMdiArea::addSubWindow(class QWidget *, class QFlags) @@ -7081,7 +7081,7 @@ EXPORTS ?setAcceptRichText@QTextControl@@QAEX_N@Z @ 7080 NONAME ; void QTextControl::setAcceptRichText(bool) ??0QGraphicsPixmapItem@@QAE@PAVQGraphicsItem@@PAVQGraphicsScene@@@Z @ 7081 NONAME ; QGraphicsPixmapItem::QGraphicsPixmapItem(class QGraphicsItem *, class QGraphicsScene *) ??1TouchPoint@QTouchEvent@@QAE@XZ @ 7082 NONAME ; QTouchEvent::TouchPoint::~TouchPoint(void) - ??_EQGraphicsPixelizeEffect@@UAE@I@Z @ 7083 NONAME ; QGraphicsPixelizeEffect::~QGraphicsPixelizeEffect(unsigned int) + ??_EQGraphicsPixelizeEffect@@UAE@I@Z @ 7083 NONAME ABSENT ; QGraphicsPixelizeEffect::~QGraphicsPixelizeEffect(unsigned int) ?createTLSysExtra@QWidgetPrivate@@QAEXXZ @ 7084 NONAME ; void QWidgetPrivate::createTLSysExtra(void) ?dropEvent@QGraphicsTextItem@@MAEXPAVQGraphicsSceneDragDropEvent@@@Z @ 7085 NONAME ; void QGraphicsTextItem::dropEvent(class QGraphicsSceneDragDropEvent *) ?insertChildren@QTreeWidgetItem@@QAEXHABV?$QList@PAVQTreeWidgetItem@@@@@Z @ 7086 NONAME ; void QTreeWidgetItem::insertChildren(int, class QList const &) @@ -7107,7 +7107,7 @@ EXPORTS ?qt_metacast@QIntValidator@@UAEPAXPBD@Z @ 7106 NONAME ; void * QIntValidator::qt_metacast(char const *) ??K@YA?AVQTransform@@ABV0@M@Z @ 7107 NONAME ; class QTransform operator/(class QTransform const &, float) ?invalidateChildrenSceneTransform@QGraphicsItemPrivate@@QAEXXZ @ 7108 NONAME ; void QGraphicsItemPrivate::invalidateChildrenSceneTransform(void) - ?trUtf8@QGraphicsBloomEffect@@SA?AVQString@@PBD0H@Z @ 7109 NONAME ; class QString QGraphicsBloomEffect::trUtf8(char const *, char const *, int) + ?trUtf8@QGraphicsBloomEffect@@SA?AVQString@@PBD0H@Z @ 7109 NONAME ABSENT ; class QString QGraphicsBloomEffect::trUtf8(char const *, char const *, int) ?metaObject@QTextFrame@@UBEPBUQMetaObject@@XZ @ 7110 NONAME ; struct QMetaObject const * QTextFrame::metaObject(void) const ?hasFormatCached@QTextFormatCollection@@QBE_NABVQTextFormat@@@Z @ 7111 NONAME ; bool QTextFormatCollection::hasFormatCached(class QTextFormat const &) const ?eventFilter@QMenuBar@@MAE_NPAVQObject@@PAVQEvent@@@Z @ 7112 NONAME ; bool QMenuBar::eventFilter(class QObject *, class QEvent *) @@ -7319,7 +7319,7 @@ EXPORTS ?rowStretch@QGridLayout@@QBEHH@Z @ 7318 NONAME ; int QGridLayout::rowStretch(int) const ?metaObject@QGraphicsTransform@@UBEPBUQMetaObject@@XZ @ 7319 NONAME ; struct QMetaObject const * QGraphicsTransform::metaObject(void) const ?tr@QTableView@@SA?AVQString@@PBD0H@Z @ 7320 NONAME ; class QString QTableView::tr(char const *, char const *, int) - ?getStaticMetaObject@QGraphicsPixelizeEffect@@SAABUQMetaObject@@XZ @ 7321 NONAME ; struct QMetaObject const & QGraphicsPixelizeEffect::getStaticMetaObject(void) + ?getStaticMetaObject@QGraphicsPixelizeEffect@@SAABUQMetaObject@@XZ @ 7321 NONAME ABSENT ; struct QMetaObject const & QGraphicsPixelizeEffect::getStaticMetaObject(void) ?isSelected@QTreeWidgetItem@@QBE_NXZ @ 7322 NONAME ; bool QTreeWidgetItem::isSelected(void) const ?setUrlHandler@QDesktopServices@@SAXABVQString@@PAVQObject@@PBD@Z @ 7323 NONAME ; void QDesktopServices::setUrlHandler(class QString const &, class QObject *, char const *) ?tr@QMdiArea@@SA?AVQString@@PBD0H@Z @ 7324 NONAME ; class QString QMdiArea::tr(char const *, char const *, int) @@ -7557,7 +7557,7 @@ EXPORTS ?setOrientation@QSplitterHandle@@QAEXW4Orientation@Qt@@@Z @ 7556 NONAME ; void QSplitterHandle::setOrientation(enum Qt::Orientation) ?setTabText@QTabBar@@QAEXHABVQString@@@Z @ 7557 NONAME ; void QTabBar::setTabText(int, class QString const &) ?storageLocation@QDesktopServices@@SA?AVQString@@W4StandardLocation@1@@Z @ 7558 NONAME ; class QString QDesktopServices::storageLocation(enum QDesktopServices::StandardLocation) - ?staticMetaObject@QGraphicsGrayscaleEffect@@2UQMetaObject@@B @ 7559 NONAME ; struct QMetaObject const QGraphicsGrayscaleEffect::staticMetaObject + ?staticMetaObject@QGraphicsGrayscaleEffect@@2UQMetaObject@@B @ 7559 NONAME ABSENT ; struct QMetaObject const QGraphicsGrayscaleEffect::staticMetaObject ?setFontWordSpacing@QTextCharFormat@@QAEXM@Z @ 7560 NONAME ; void QTextCharFormat::setFontWordSpacing(float) ??_EQShowEvent@@UAE@I@Z @ 7561 NONAME ; QShowEvent::~QShowEvent(unsigned int) ?tr@QFileSystemModel@@SA?AVQString@@PBD0@Z @ 7562 NONAME ; class QString QFileSystemModel::tr(char const *, char const *) @@ -7569,7 +7569,7 @@ EXPORTS ?trUtf8@QStandardItemModel@@SA?AVQString@@PBD0H@Z @ 7568 NONAME ; class QString QStandardItemModel::trUtf8(char const *, char const *, int) ?setResizeMode@QListView@@QAEXW4ResizeMode@1@@Z @ 7569 NONAME ; void QListView::setResizeMode(enum QListView::ResizeMode) ??_EQTableWidgetItem@@UAE@I@Z @ 7570 NONAME ; QTableWidgetItem::~QTableWidgetItem(unsigned int) - ?qt_metacast@QGraphicsBloomEffect@@UAEPAXPBD@Z @ 7571 NONAME ; void * QGraphicsBloomEffect::qt_metacast(char const *) + ?qt_metacast@QGraphicsBloomEffect@@UAEPAXPBD@Z @ 7571 NONAME ABSENT ; void * QGraphicsBloomEffect::qt_metacast(char const *) ?mapFromParent@QGraphicsItem@@QBE?AVQPolygonF@@MMMM@Z @ 7572 NONAME ; class QPolygonF QGraphicsItem::mapFromParent(float, float, float, float) const ?tabRect@QTabBar@@QBE?AVQRect@@H@Z @ 7573 NONAME ; class QRect QTabBar::tabRect(int) const ?sizeHint@QAbstractSpinBox@@UBE?AVQSize@@XZ @ 7574 NONAME ; class QSize QAbstractSpinBox::sizeHint(void) const @@ -8052,7 +8052,7 @@ EXPORTS ?setFlat@QPushButton@@QAEX_N@Z @ 8051 NONAME ; void QPushButton::setFlat(bool) ?columnAlignment@QGraphicsGridLayout@@QBE?AV?$QFlags@W4AlignmentFlag@Qt@@@@H@Z @ 8052 NONAME ; class QFlags QGraphicsGridLayout::columnAlignment(int) const ?d_func@QSound@@AAEPAVQSoundPrivate@@XZ @ 8053 NONAME ; class QSoundPrivate * QSound::d_func(void) - ?strengthChanged@QGraphicsBloomEffect@@IAEXM@Z @ 8054 NONAME ; void QGraphicsBloomEffect::strengthChanged(float) + ?strengthChanged@QGraphicsBloomEffect@@IAEXM@Z @ 8054 NONAME ABSENT ; void QGraphicsBloomEffect::strengthChanged(float) ??_0QVector3D@@QAEAAV0@M@Z @ 8055 NONAME ; class QVector3D & QVector3D::operator/=(float) ?currentFrame@iterator@QTextFrame@@QBEPAV2@XZ @ 8056 NONAME ; class QTextFrame * QTextFrame::iterator::currentFrame(void) const ??_EQSplitterHandle@@UAE@I@Z @ 8057 NONAME ; QSplitterHandle::~QSplitterHandle(unsigned int) @@ -8104,7 +8104,7 @@ EXPORTS ?drawPixmap@QPainter@@QAEXHHABVQPixmap@@HHHH@Z @ 8103 NONAME ; void QPainter::drawPixmap(int, int, class QPixmap const &, int, int, int, int) ?toolTipBase@QPalette@@QBEABVQBrush@@XZ @ 8104 NONAME ; class QBrush const & QPalette::toolTipBase(void) const ?fileInfo@QDirModel@@QBE?AVQFileInfo@@ABVQModelIndex@@@Z @ 8105 NONAME ; class QFileInfo QDirModel::fileInfo(class QModelIndex const &) const - ?blurHintChanged@QGraphicsBloomEffect@@IAEXW4RenderHint@Qt@@@Z @ 8106 NONAME ; void QGraphicsBloomEffect::blurHintChanged(enum Qt::RenderHint) + ?blurHintChanged@QGraphicsBloomEffect@@IAEXW4RenderHint@Qt@@@Z @ 8106 NONAME ABSENT ; void QGraphicsBloomEffect::blurHintChanged(enum Qt::RenderHint) ?putPoints@QPolygon@@QAEXHHABV1@H@Z @ 8107 NONAME ; void QPolygon::putPoints(int, int, class QPolygon const &, int) ??1QDragMoveEvent@@UAE@XZ @ 8108 NONAME ; QDragMoveEvent::~QDragMoveEvent(void) ?intProperty@QTextFormat@@QBEHH@Z @ 8109 NONAME ; int QTextFormat::intProperty(int) const @@ -8299,7 +8299,7 @@ EXPORTS ?setPixelSize@QFont@@QAEXH@Z @ 8298 NONAME ; void QFont::setPixelSize(int) ?setBottomMargin@QTextFrameFormat@@QAEXM@Z @ 8299 NONAME ; void QTextFrameFormat::setBottomMargin(float) ?minimumDate@QCalendarWidget@@QBE?AVQDate@@XZ @ 8300 NONAME ; class QDate QCalendarWidget::minimumDate(void) const - ?setBlurRadius@QGraphicsDropShadowEffect@@QAEXH@Z @ 8301 NONAME ; void QGraphicsDropShadowEffect::setBlurRadius(int) + ?setBlurRadius@QGraphicsDropShadowEffect@@QAEXH@Z @ 8301 NONAME ABSENT ; void QGraphicsDropShadowEffect::setBlurRadius(int) ?setMask@QPixmapData@@UAEXABVQBitmap@@@Z @ 8302 NONAME ; void QPixmapData::setMask(class QBitmap const &) ?drawPie@QPainter@@QAEXABVQRectF@@HH@Z @ 8303 NONAME ; void QPainter::drawPie(class QRectF const &, int, int) ?supportsExtension@QGraphicsPolygonItem@@MBE_NW4Extension@QGraphicsItem@@@Z @ 8304 NONAME ; bool QGraphicsPolygonItem::supportsExtension(enum QGraphicsItem::Extension) const @@ -8539,7 +8539,7 @@ EXPORTS ?resolveSymlinks@QFileDialog@@QBE_NXZ @ 8538 NONAME ; bool QFileDialog::resolveSymlinks(void) const ?d_func@QGraphicsTransform@@ABEPBVQGraphicsTransformPrivate@@XZ @ 8539 NONAME ; class QGraphicsTransformPrivate const * QGraphicsTransform::d_func(void) const ?verticalStretch@QSizePolicy@@QBEHXZ @ 8540 NONAME ; int QSizePolicy::verticalStretch(void) const - ?pixelSize@QGraphicsPixelizeEffect@@QBEHXZ @ 8541 NONAME ; int QGraphicsPixelizeEffect::pixelSize(void) const + ?pixelSize@QGraphicsPixelizeEffect@@QBEHXZ @ 8541 NONAME ABSENT ; int QGraphicsPixelizeEffect::pixelSize(void) const ?time@QDateTimeEdit@@QBE?AVQTime@@XZ @ 8542 NONAME ; class QTime QDateTimeEdit::time(void) const ?buttonDownScenePos@QGraphicsSceneMouseEvent@@QBE?AVQPointF@@W4MouseButton@Qt@@@Z @ 8543 NONAME ; class QPointF QGraphicsSceneMouseEvent::buttonDownScenePos(enum Qt::MouseButton) const ?map@QMatrix@@QBEXMMPAM0@Z @ 8544 NONAME ; void QMatrix::map(float, float, float *, float *) const @@ -8753,7 +8753,7 @@ EXPORTS ?standardFormat@QInputContext@@QBE?AVQTextFormat@@W4StandardFormat@1@@Z @ 8752 NONAME ; class QTextFormat QInputContext::standardFormat(enum QInputContext::StandardFormat) const ??_EQStandardItemModel@@UAE@I@Z @ 8753 NONAME ; QStandardItemModel::~QStandardItemModel(unsigned int) ?d_func@QPainterPathStroker@@AAEPAVQPainterPathStrokerPrivate@@XZ @ 8754 NONAME ; class QPainterPathStrokerPrivate * QPainterPathStroker::d_func(void) - ?trUtf8@QGraphicsPixelizeEffect@@SA?AVQString@@PBD0H@Z @ 8755 NONAME ; class QString QGraphicsPixelizeEffect::trUtf8(char const *, char const *, int) + ?trUtf8@QGraphicsPixelizeEffect@@SA?AVQString@@PBD0H@Z @ 8755 NONAME ABSENT ; class QString QGraphicsPixelizeEffect::trUtf8(char const *, char const *, int) ?takeLayout@QWidget@@AAEPAVQLayout@@XZ @ 8756 NONAME ; class QLayout * QWidget::takeLayout(void) ?offset@QPanGesture@@QBE?AVQPointF@@XZ @ 8757 NONAME ; class QPointF QPanGesture::offset(void) const ?tightBoundingRect@QFontMetrics@@QBE?AVQRect@@ABVQString@@@Z @ 8758 NONAME ; class QRect QFontMetrics::tightBoundingRect(class QString const &) const @@ -8917,7 +8917,7 @@ EXPORTS ?offset@QWindowSurface@@UBE?AVQPoint@@PBVQWidget@@@Z @ 8916 NONAME ; class QPoint QWindowSurface::offset(class QWidget const *) const ?d_func@QFileIconProvider@@ABEPBVQFileIconProviderPrivate@@XZ @ 8917 NONAME ; class QFileIconProviderPrivate const * QFileIconProvider::d_func(void) const ??0QDateTimeEdit@@QAE@ABVQDateTime@@PAVQWidget@@@Z @ 8918 NONAME ; QDateTimeEdit::QDateTimeEdit(class QDateTime const &, class QWidget *) - ?d_func@QGraphicsGrayscaleEffect@@ABEPBVQGraphicsGrayscaleEffectPrivate@@XZ @ 8919 NONAME ; class QGraphicsGrayscaleEffectPrivate const * QGraphicsGrayscaleEffect::d_func(void) const + ?d_func@QGraphicsGrayscaleEffect@@ABEPBVQGraphicsGrayscaleEffectPrivate@@XZ @ 8919 NONAME ABSENT ; class QGraphicsGrayscaleEffectPrivate const * QGraphicsGrayscaleEffect::d_func(void) const ?testOption@QColorDialog@@QBE_NW4ColorDialogOption@1@@Z @ 8920 NONAME ; bool QColorDialog::testOption(enum QColorDialog::ColorDialogOption) const ?setWSGeometry@QWidgetPrivate@@QAEX_NABVQRect@@@Z @ 8921 NONAME ; void QWidgetPrivate::setWSGeometry(bool, class QRect const &) ?inputMethodEvent@QPlainTextEdit@@MAEXPAVQInputMethodEvent@@@Z @ 8922 NONAME ; void QPlainTextEdit::inputMethodEvent(class QInputMethodEvent *) @@ -8963,7 +8963,7 @@ EXPORTS ?event@QStatusBar@@MAE_NPAVQEvent@@@Z @ 8962 NONAME ; bool QStatusBar::event(class QEvent *) ?anchorAt@QTextControl@@QBE?AVQString@@ABVQPointF@@@Z @ 8963 NONAME ; class QString QTextControl::anchorAt(class QPointF const &) const ?restart@QWizard@@QAEXXZ @ 8964 NONAME ; void QWizard::restart(void) - ?hasCacheHint@QVectorPath@@QBE_NXZ @ 8965 NONAME ; bool QVectorPath::hasCacheHint(void) const + ?hasCacheHint@QVectorPath@@QBE_NXZ @ 8965 NONAME ABSENT ; bool QVectorPath::hasCacheHint(void) const ?setUnifiedTitleAndToolBarOnMac@QMainWindow@@QAEX_N@Z @ 8966 NONAME ; void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool) ?setGeometry@QGridLayout@@UAEXABVQRect@@@Z @ 8967 NONAME ; void QGridLayout::setGeometry(class QRect const &) ?qDrawPixmaps@@YAXPAVQPainter@@PBUData@QDrawPixmaps@@HABVQPixmap@@V?$QFlags@W4DrawingHint@QDrawPixmaps@@@@@Z @ 8968 NONAME ; void qDrawPixmaps(class QPainter *, struct QDrawPixmaps::Data const *, int, class QPixmap const &, class QFlags) @@ -8987,7 +8987,7 @@ EXPORTS ?d_func@QGraphicsLinearLayout@@AAEPAVQGraphicsLinearLayoutPrivate@@XZ @ 8986 NONAME ; class QGraphicsLinearLayoutPrivate * QGraphicsLinearLayout::d_func(void) ?staticMetaObject@QTextControl@@2UQMetaObject@@B @ 8987 NONAME ; struct QMetaObject const QTextControl::staticMetaObject ??_EQClipboardEvent@@UAE@I@Z @ 8988 NONAME ; QClipboardEvent::~QClipboardEvent(unsigned int) - ?draw@QGraphicsGrayscaleEffect@@MAEXPAVQPainter@@PAVQGraphicsEffectSource@@@Z @ 8989 NONAME ; void QGraphicsGrayscaleEffect::draw(class QPainter *, class QGraphicsEffectSource *) + ?draw@QGraphicsGrayscaleEffect@@MAEXPAVQPainter@@PAVQGraphicsEffectSource@@@Z @ 8989 NONAME ABSENT ; void QGraphicsGrayscaleEffect::draw(class QPainter *, class QGraphicsEffectSource *) ?tr@QGraphicsScene@@SA?AVQString@@PBD0H@Z @ 8990 NONAME ; class QString QGraphicsScene::tr(char const *, char const *, int) ?handle@QCursor@@QBEKXZ @ 8991 NONAME ; unsigned long QCursor::handle(void) const ?qt_metacast@QRadioButton@@UAEPAXPBD@Z @ 8992 NONAME ; void * QRadioButton::qt_metacast(char const *) @@ -9068,7 +9068,7 @@ EXPORTS ?indexFromItem@QStandardItemModel@@QBE?AVQModelIndex@@PBVQStandardItem@@@Z @ 9067 NONAME ; class QModelIndex QStandardItemModel::indexFromItem(class QStandardItem const *) const ?scene@QGraphicsItem@@QBEPAVQGraphicsScene@@XZ @ 9068 NONAME ; class QGraphicsScene * QGraphicsItem::scene(void) const ??0QListWidget@@QAE@PAVQWidget@@@Z @ 9069 NONAME ; QListWidget::QListWidget(class QWidget *) - ?qt_metacall@QGraphicsBloomEffect@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9070 NONAME ; int QGraphicsBloomEffect::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacall@QGraphicsBloomEffect@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9070 NONAME ABSENT ; int QGraphicsBloomEffect::qt_metacall(enum QMetaObject::Call, int, void * *) ?qt_metacast@QShortcut@@UAEPAXPBD@Z @ 9071 NONAME ; void * QShortcut::qt_metacast(char const *) ??0QTextLayout@@AAE@PAVQTextEngine@@@Z @ 9072 NONAME ; QTextLayout::QTextLayout(class QTextEngine *) ?hasProperty@QTextFormat@@QBE_NH@Z @ 9073 NONAME ; bool QTextFormat::hasProperty(int) const @@ -9495,7 +9495,7 @@ EXPORTS ?visualIndex@QTreeView@@ABEHABVQModelIndex@@@Z @ 9494 NONAME ; int QTreeView::visualIndex(class QModelIndex const &) const ?tr@QVBoxLayout@@SA?AVQString@@PBD0@Z @ 9495 NONAME ; class QString QVBoxLayout::tr(char const *, char const *) ??0QCheckBox@@QAE@ABVQString@@PAVQWidget@@@Z @ 9496 NONAME ; QCheckBox::QCheckBox(class QString const &, class QWidget *) - ?d_func@QGraphicsGrayscaleEffect@@AAEPAVQGraphicsGrayscaleEffectPrivate@@XZ @ 9497 NONAME ; class QGraphicsGrayscaleEffectPrivate * QGraphicsGrayscaleEffect::d_func(void) + ?d_func@QGraphicsGrayscaleEffect@@AAEPAVQGraphicsGrayscaleEffectPrivate@@XZ @ 9497 NONAME ABSENT ; class QGraphicsGrayscaleEffectPrivate * QGraphicsGrayscaleEffect::d_func(void) ?trUtf8@QAction@@SA?AVQString@@PBD0H@Z @ 9498 NONAME ; class QString QAction::trUtf8(char const *, char const *, int) ?staticMetaObject@QGraphicsOpacityEffect@@2UQMetaObject@@B @ 9499 NONAME ; struct QMetaObject const QGraphicsOpacityEffect::staticMetaObject ?items@QGraphicsScene@@QBE?AV?$QList@PAVQGraphicsItem@@@@MMMMW4ItemSelectionMode@Qt@@W4SortOrder@4@ABVQTransform@@@Z @ 9500 NONAME ; class QList QGraphicsScene::items(float, float, float, float, enum Qt::ItemSelectionMode, enum Qt::SortOrder, class QTransform const &) const @@ -9549,7 +9549,7 @@ EXPORTS ?done@QDialog@@UAEXH@Z @ 9548 NONAME ; void QDialog::done(int) ?widgetAt@QApplication@@SAPAVQWidget@@HH@Z @ 9549 NONAME ; class QWidget * QApplication::widgetAt(int, int) ??_EQTextFrameLayoutData@@UAE@I@Z @ 9550 NONAME ; QTextFrameLayoutData::~QTextFrameLayoutData(unsigned int) - ??0QGraphicsPixelizeEffect@@QAE@PAVQObject@@@Z @ 9551 NONAME ; QGraphicsPixelizeEffect::QGraphicsPixelizeEffect(class QObject *) + ??0QGraphicsPixelizeEffect@@QAE@PAVQObject@@@Z @ 9551 NONAME ABSENT ; QGraphicsPixelizeEffect::QGraphicsPixelizeEffect(class QObject *) ?frameChanged@QMovie@@IAEXH@Z @ 9552 NONAME ; void QMovie::frameChanged(int) ?geometry@QWidgetItem@@UBE?AVQRect@@XZ @ 9553 NONAME ; class QRect QWidgetItem::geometry(void) const ??0QTextFrame@@IAE@AAVQTextFramePrivate@@PAVQTextDocument@@@Z @ 9554 NONAME ; QTextFrame::QTextFrame(class QTextFramePrivate &, class QTextDocument *) @@ -9732,7 +9732,7 @@ EXPORTS ?setItemDelegate@QDataWidgetMapper@@QAEXPAVQAbstractItemDelegate@@@Z @ 9731 NONAME ; void QDataWidgetMapper::setItemDelegate(class QAbstractItemDelegate *) ?timerEvent@QAbstractSlider@@MAEXPAVQTimerEvent@@@Z @ 9732 NONAME ; void QAbstractSlider::timerEvent(class QTimerEvent *) ?helpRequested@QWizard@@IAEXXZ @ 9733 NONAME ; void QWizard::helpRequested(void) - ?registerGestureRecognizer@QApplication@@QAE?AW4GestureType@Qt@@PAVQGestureRecognizer@@@Z @ 9734 NONAME ; enum Qt::GestureType QApplication::registerGestureRecognizer(class QGestureRecognizer *) + ?registerGestureRecognizer@QApplication@@QAE?AW4GestureType@Qt@@PAVQGestureRecognizer@@@Z @ 9734 NONAME ABSENT ; enum Qt::GestureType QApplication::registerGestureRecognizer(class QGestureRecognizer *) ??0QTableWidgetItem@@QAE@ABVQIcon@@ABVQString@@H@Z @ 9735 NONAME ; QTableWidgetItem::QTableWidgetItem(class QIcon const &, class QString const &, int) ?validatePage@QWizardPage@@UAE_NXZ @ 9736 NONAME ; bool QWizardPage::validatePage(void) ?itemCollapsed@QTreeWidget@@IAEXPAVQTreeWidgetItem@@@Z @ 9737 NONAME ; void QTreeWidget::itemCollapsed(class QTreeWidgetItem *) @@ -9740,7 +9740,7 @@ EXPORTS ?contains@QGraphicsPixmapItem@@UBE_NABVQPointF@@@Z @ 9739 NONAME ; bool QGraphicsPixmapItem::contains(class QPointF const &) const ??1QTextTableFormat@@QAE@XZ @ 9740 NONAME ; QTextTableFormat::~QTextTableFormat(void) ?qt_metacall@QGraphicsScene@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9741 NONAME ; int QGraphicsScene::qt_metacall(enum QMetaObject::Call, int, void * *) - ?strength@QGraphicsGrayscaleEffect@@QBEMXZ @ 9742 NONAME ; float QGraphicsGrayscaleEffect::strength(void) const + ?strength@QGraphicsGrayscaleEffect@@QBEMXZ @ 9742 NONAME ABSENT ; float QGraphicsGrayscaleEffect::strength(void) const ??1QStyleOptionDockWidget@@QAE@XZ @ 9743 NONAME ; QStyleOptionDockWidget::~QStyleOptionDockWidget(void) ?horizontalScrollBarPolicy@QAbstractScrollArea@@QBE?AW4ScrollBarPolicy@Qt@@XZ @ 9744 NONAME ; enum Qt::ScrollBarPolicy QAbstractScrollArea::horizontalScrollBarPolicy(void) const ?contextMenuEvent@QScrollBar@@MAEXPAVQContextMenuEvent@@@Z @ 9745 NONAME ; void QScrollBar::contextMenuEvent(class QContextMenuEvent *) @@ -9771,7 +9771,7 @@ EXPORTS ?setPrefix@QDoubleSpinBox@@QAEXABVQString@@@Z @ 9770 NONAME ; void QDoubleSpinBox::setPrefix(class QString const &) ?metaObject@QRadioButton@@UBEPBUQMetaObject@@XZ @ 9771 NONAME ; struct QMetaObject const * QRadioButton::metaObject(void) const ??1QTabWidget@@UAE@XZ @ 9772 NONAME ; QTabWidget::~QTabWidget(void) - ?setBrightness@QGraphicsBloomEffect@@QAEXH@Z @ 9773 NONAME ; void QGraphicsBloomEffect::setBrightness(int) + ?setBrightness@QGraphicsBloomEffect@@QAEXH@Z @ 9773 NONAME ABSENT ; void QGraphicsBloomEffect::setBrightness(int) ?detach@QRegion@@AAEXXZ @ 9774 NONAME ; void QRegion::detach(void) ?d_func@QPixmapColorizeFilter@@ABEPBVQPixmapColorizeFilterPrivate@@XZ @ 9775 NONAME ; class QPixmapColorizeFilterPrivate const * QPixmapColorizeFilter::d_func(void) const ?currentIndex@QTabWidget@@QBEHXZ @ 9776 NONAME ; int QTabWidget::currentIndex(void) const @@ -9800,7 +9800,7 @@ EXPORTS ?staticMetaObject@QLCDNumber@@2UQMetaObject@@B @ 9799 NONAME ; struct QMetaObject const QLCDNumber::staticMetaObject ?items@QListWidget@@IBE?AV?$QList@PAVQListWidgetItem@@@@PBVQMimeData@@@Z @ 9800 NONAME ; class QList QListWidget::items(class QMimeData const *) const ?qt_metacast@QAbstractItemDelegate@@UAEPAXPBD@Z @ 9801 NONAME ; void * QAbstractItemDelegate::qt_metacast(char const *) - ?radius@QPixmapBlurFilter@@QBEHXZ @ 9802 NONAME ; int QPixmapBlurFilter::radius(void) const + ?radius@QPixmapBlurFilter@@QBEHXZ @ 9802 NONAME ABSENT ; int QPixmapBlurFilter::radius(void) const ?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 9803 NONAME ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *) ??_EQPlainTextDocumentLayout@@UAE@I@Z @ 9804 NONAME ; QPlainTextDocumentLayout::~QPlainTextDocumentLayout(unsigned int) ?nodeNameEquals@StyleSelector@QCss@@UBE_NTNodePtr@12@ABVQString@@@Z @ 9805 NONAME ; bool QCss::StyleSelector::nodeNameEquals(union QCss::StyleSelector::NodePtr, class QString const &) const @@ -9869,7 +9869,7 @@ EXPORTS ?clear@QAbstractSpinBox@@UAEXXZ @ 9868 NONAME ; void QAbstractSpinBox::clear(void) ?flags@QSortFilterProxyModel@@UBE?AV?$QFlags@W4ItemFlag@Qt@@@@ABVQModelIndex@@@Z @ 9869 NONAME ; class QFlags QSortFilterProxyModel::flags(class QModelIndex const &) const ?setAcceptedMouseButtons@QGraphicsItem@@QAEXV?$QFlags@W4MouseButton@Qt@@@@@Z @ 9870 NONAME ; void QGraphicsItem::setAcceptedMouseButtons(class QFlags) - ?qt_metacast@QGraphicsPixelizeEffect@@UAEPAXPBD@Z @ 9871 NONAME ; void * QGraphicsPixelizeEffect::qt_metacast(char const *) + ?qt_metacast@QGraphicsPixelizeEffect@@UAEPAXPBD@Z @ 9871 NONAME ABSENT ; void * QGraphicsPixelizeEffect::qt_metacast(char const *) ?loopCount@QImageIOHandler@@UBEHXZ @ 9872 NONAME ; int QImageIOHandler::loopCount(void) const ?items@QGraphicsScene@@QBE?AV?$QList@PAVQGraphicsItem@@@@ABVQPointF@@@Z @ 9873 NONAME ; class QList QGraphicsScene::items(class QPointF const &) const ?rowCount@QGraphicsGridLayout@@QBEHXZ @ 9874 NONAME ; int QGraphicsGridLayout::rowCount(void) const @@ -9877,7 +9877,7 @@ EXPORTS ?radius@QRadialGradient@@QBEMXZ @ 9876 NONAME ; float QRadialGradient::radius(void) const ?itemFromIndex@QListWidget@@IBEPAVQListWidgetItem@@ABVQModelIndex@@@Z @ 9877 NONAME ; class QListWidgetItem * QListWidget::itemFromIndex(class QModelIndex const &) const ?tr@QPlainTextEdit@@SA?AVQString@@PBD0@Z @ 9878 NONAME ; class QString QPlainTextEdit::tr(char const *, char const *) - ?blurRadius@QGraphicsDropShadowEffect@@QBEHXZ @ 9879 NONAME ; int QGraphicsDropShadowEffect::blurRadius(void) const + ?blurRadius@QGraphicsDropShadowEffect@@QBEHXZ @ 9879 NONAME ABSENT ; int QGraphicsDropShadowEffect::blurRadius(void) const ?focusPolicy@QWidget@@QBE?AW4FocusPolicy@Qt@@XZ @ 9880 NONAME ; enum Qt::FocusPolicy QWidget::focusPolicy(void) const ?write@QIconEngineV2@@UBE_NAAVQDataStream@@@Z @ 9881 NONAME ; bool QIconEngineV2::write(class QDataStream &) const ?mouseHandler@QInputContext@@UAEXHPAVQMouseEvent@@@Z @ 9882 NONAME ; void QInputContext::mouseHandler(int, class QMouseEvent *) @@ -10434,7 +10434,7 @@ EXPORTS ??0QPainterPath@@QAE@ABVQPointF@@@Z @ 10433 NONAME ; QPainterPath::QPainterPath(class QPointF const &) ?wizardStyle@QWizard@@QBE?AW4WizardStyle@1@XZ @ 10434 NONAME ; enum QWizard::WizardStyle QWizard::wizardStyle(void) const ?setStyle@QGraphicsScene@@QAEXPAVQStyle@@@Z @ 10435 NONAME ; void QGraphicsScene::setStyle(class QStyle *) - ?getOpaqueRegion@QWidgetPrivate@@QBE?AVQRegion@@XZ @ 10436 NONAME ; class QRegion QWidgetPrivate::getOpaqueRegion(void) const + ?getOpaqueRegion@QWidgetPrivate@@QBE?AVQRegion@@XZ @ 10436 NONAME ABSENT ; class QRegion QWidgetPrivate::getOpaqueRegion(void) const ?triggered@QMenuBar@@IAEXPAVQAction@@@Z @ 10437 NONAME ; void QMenuBar::triggered(class QAction *) ??0QStyleOptionButton@@QAE@XZ @ 10438 NONAME ; QStyleOptionButton::QStyleOptionButton(void) ?height@QImage@@QBEHXZ @ 10439 NONAME ; int QImage::height(void) const @@ -10464,7 +10464,7 @@ EXPORTS ??1QGraphicsPolygonItem@@UAE@XZ @ 10463 NONAME ; QGraphicsPolygonItem::~QGraphicsPolygonItem(void) ?showEvent@QMdiArea@@MAEXPAVQShowEvent@@@Z @ 10464 NONAME ; void QMdiArea::showEvent(class QShowEvent *) ?startPos@TouchPoint@QTouchEvent@@QBE?AVQPointF@@XZ @ 10465 NONAME ; class QPointF QTouchEvent::TouchPoint::startPos(void) const - ?metaObject@QGraphicsBloomEffect@@UBEPBUQMetaObject@@XZ @ 10466 NONAME ; struct QMetaObject const * QGraphicsBloomEffect::metaObject(void) const + ?metaObject@QGraphicsBloomEffect@@UBEPBUQMetaObject@@XZ @ 10466 NONAME ABSENT ; struct QMetaObject const * QGraphicsBloomEffect::metaObject(void) const ?clicked@QDialogButtonBox@@IAEXPAVQAbstractButton@@@Z @ 10467 NONAME ; void QDialogButtonBox::clicked(class QAbstractButton *) ?tr@QSplitterHandle@@SA?AVQString@@PBD0@Z @ 10468 NONAME ; class QString QSplitterHandle::tr(char const *, char const *) ?setWindowIcon_sys@QWidgetPrivate@@QAEX_N@Z @ 10469 NONAME ; void QWidgetPrivate::setWindowIcon_sys(bool) @@ -10521,7 +10521,7 @@ EXPORTS ?itemAt@QGraphicsScene@@QBEPAVQGraphicsItem@@ABVQPointF@@ABVQTransform@@@Z @ 10520 NONAME ; class QGraphicsItem * QGraphicsScene::itemAt(class QPointF const &, class QTransform const &) const ?paintEvent@QCheckBox@@MAEXPAVQPaintEvent@@@Z @ 10521 NONAME ; void QCheckBox::paintEvent(class QPaintEvent *) ?timerEvent@QTextEdit@@MAEXPAVQTimerEvent@@@Z @ 10522 NONAME ; void QTextEdit::timerEvent(class QTimerEvent *) - ?blurHint@QGraphicsBloomEffect@@QBE?AW4RenderHint@Qt@@XZ @ 10523 NONAME ; enum Qt::RenderHint QGraphicsBloomEffect::blurHint(void) const + ?blurHint@QGraphicsBloomEffect@@QBE?AW4RenderHint@Qt@@XZ @ 10523 NONAME ABSENT ; enum Qt::RenderHint QGraphicsBloomEffect::blurHint(void) const ?setInterpolationMode@QGradient@@QAEXW4InterpolationMode@1@@Z @ 10524 NONAME ; void QGradient::setInterpolationMode(enum QGradient::InterpolationMode) ?eraseRect@QPainter@@QAEXABVQRect@@@Z @ 10525 NONAME ; void QPainter::eraseRect(class QRect const &) ?tr@QDesktopWidget@@SA?AVQString@@PBD0H@Z @ 10526 NONAME ; class QString QDesktopWidget::tr(char const *, char const *, int) @@ -10538,7 +10538,7 @@ EXPORTS ?setOffset@QGraphicsDropShadowEffect@@QAEXABVQPointF@@@Z @ 10537 NONAME ; void QGraphicsDropShadowEffect::setOffset(class QPointF const &) ?hideEvent@QAbstractSpinBox@@MAEXPAVQHideEvent@@@Z @ 10538 NONAME ; void QAbstractSpinBox::hideEvent(class QHideEvent *) ?setData@QTableWidgetItem@@UAEXHABVQVariant@@@Z @ 10539 NONAME ; void QTableWidgetItem::setData(int, class QVariant const &) - ?setBlurRadius@QGraphicsBloomEffect@@QAEXH@Z @ 10540 NONAME ; void QGraphicsBloomEffect::setBlurRadius(int) + ?setBlurRadius@QGraphicsBloomEffect@@QAEXH@Z @ 10540 NONAME ABSENT ; void QGraphicsBloomEffect::setBlurRadius(int) ?qt_metacast@QAbstractProxyModel@@UAEPAXPBD@Z @ 10541 NONAME ; void * QAbstractProxyModel::qt_metacast(char const *) ?setModelColumn@QListView@@QAEXH@Z @ 10542 NONAME ; void QListView::setModelColumn(int) ?addDockWidget@QMainWindow@@QAEXW4DockWidgetArea@Qt@@PAVQDockWidget@@W4Orientation@3@@Z @ 10543 NONAME ; void QMainWindow::addDockWidget(enum Qt::DockWidgetArea, class QDockWidget *, enum Qt::Orientation) @@ -10707,7 +10707,7 @@ EXPORTS ?dragMoveEvent@QWidget@@MAEXPAVQDragMoveEvent@@@Z @ 10706 NONAME ; void QWidget::dragMoveEvent(class QDragMoveEvent *) ?started@QMovie@@IAEXXZ @ 10707 NONAME ; void QMovie::started(void) ??_EQImageIOPlugin@@UAE@I@Z @ 10708 NONAME ; QImageIOPlugin::~QImageIOPlugin(unsigned int) - ?blurRadiusChanged@QGraphicsDropShadowEffect@@IAEXH@Z @ 10709 NONAME ; void QGraphicsDropShadowEffect::blurRadiusChanged(int) + ?blurRadiusChanged@QGraphicsDropShadowEffect@@IAEXH@Z @ 10709 NONAME ABSENT ; void QGraphicsDropShadowEffect::blurRadiusChanged(int) ?contains@QPainterPath@@QBE_NABVQPointF@@@Z @ 10710 NONAME ; bool QPainterPath::contains(class QPointF const &) const ?historyUrl@QTextBrowser@@QBE?AVQUrl@@H@Z @ 10711 NONAME ; class QUrl QTextBrowser::historyUrl(int) const ?setLastCenterPoint@QPinchGesture@@QAEXABVQPointF@@@Z @ 10712 NONAME ; void QPinchGesture::setLastCenterPoint(class QPointF const &) @@ -11401,7 +11401,7 @@ EXPORTS ?staticMetaObject@QToolBar@@2UQMetaObject@@B @ 11400 NONAME ; struct QMetaObject const QToolBar::staticMetaObject ?setPosition@QTextLine@@QAEXABVQPointF@@@Z @ 11401 NONAME ; void QTextLine::setPosition(class QPointF const &) ?topLevelWidget@QGraphicsItem@@QBEPAVQGraphicsWidget@@XZ @ 11402 NONAME ; class QGraphicsWidget * QGraphicsItem::topLevelWidget(void) const - ?setBlurRadius@QGraphicsBlurEffect@@QAEXH@Z @ 11403 NONAME ; void QGraphicsBlurEffect::setBlurRadius(int) + ?setBlurRadius@QGraphicsBlurEffect@@QAEXH@Z @ 11403 NONAME ABSENT ; void QGraphicsBlurEffect::setBlurRadius(int) ?fromRgba@QColor@@SA?AV1@I@Z @ 11404 NONAME ; class QColor QColor::fromRgba(unsigned int) ?isValid@QTextFormat@@QBE_NXZ @ 11405 NONAME ; bool QTextFormat::isValid(void) const ??0QMatrix4x4@@AAE@H@Z @ 11406 NONAME ; QMatrix4x4::QMatrix4x4(int) @@ -11455,7 +11455,7 @@ EXPORTS ?tr@QTabWidget@@SA?AVQString@@PBD0@Z @ 11454 NONAME ; class QString QTabWidget::tr(char const *, char const *) ?addToPolygonMixed@QBezier@@QBEXPAVQPolygonF@@@Z @ 11455 NONAME ; void QBezier::addToPolygonMixed(class QPolygonF *) const ?command@QUndoStack@@QBEPBVQUndoCommand@@H@Z @ 11456 NONAME ; class QUndoCommand const * QUndoStack::command(int) const - ?tr@QGraphicsPixelizeEffect@@SA?AVQString@@PBD0H@Z @ 11457 NONAME ; class QString QGraphicsPixelizeEffect::tr(char const *, char const *, int) + ?tr@QGraphicsPixelizeEffect@@SA?AVQString@@PBD0H@Z @ 11457 NONAME ABSENT ; class QString QGraphicsPixelizeEffect::tr(char const *, char const *, int) ?data@QStandardItem@@UBE?AVQVariant@@H@Z @ 11458 NONAME ; class QVariant QStandardItem::data(int) const ?focusItem@QGraphicsScene@@QBEPAVQGraphicsItem@@XZ @ 11459 NONAME ; class QGraphicsItem * QGraphicsScene::focusItem(void) const ?delta@QWheelEvent@@QBEHXZ @ 11460 NONAME ; int QWheelEvent::delta(void) const @@ -11851,7 +11851,7 @@ EXPORTS ?insertToolBarBreak@QMainWindow@@QAEXPAVQToolBar@@@Z @ 11850 NONAME ; void QMainWindow::insertToolBarBreak(class QToolBar *) ?d_func@QTextDocument@@ABEPBVQTextDocumentPrivate@@XZ @ 11851 NONAME ; class QTextDocumentPrivate const * QTextDocument::d_func(void) const ?setBlurHint@QPixmapBlurFilter@@QAEXW4RenderHint@Qt@@@Z @ 11852 NONAME ; void QPixmapBlurFilter::setBlurHint(enum Qt::RenderHint) - ?trUtf8@QGraphicsPixelizeEffect@@SA?AVQString@@PBD0@Z @ 11853 NONAME ; class QString QGraphicsPixelizeEffect::trUtf8(char const *, char const *) + ?trUtf8@QGraphicsPixelizeEffect@@SA?AVQString@@PBD0@Z @ 11853 NONAME ABSENT ; class QString QGraphicsPixelizeEffect::trUtf8(char const *, char const *) ?adjustSize@QGraphicsTextItem@@QAEXXZ @ 11854 NONAME ; void QGraphicsTextItem::adjustSize(void) ??0QTextDocumentFragment@@QAE@PBVQTextDocument@@@Z @ 11855 NONAME ; QTextDocumentFragment::QTextDocumentFragment(class QTextDocument const *) ?lastResortFamily@QFont@@QBE?AVQString@@XZ @ 11856 NONAME ; class QString QFont::lastResortFamily(void) const @@ -11876,7 +11876,7 @@ EXPORTS ?resolveSymlinks@QFileSystemModel@@QBE_NXZ @ 11875 NONAME ; bool QFileSystemModel::resolveSymlinks(void) const ?itemFromIndex@QTableWidget@@IBEPAVQTableWidgetItem@@ABVQModelIndex@@@Z @ 11876 NONAME ; class QTableWidgetItem * QTableWidget::itemFromIndex(class QModelIndex const &) const ?commitData@QApplication@@UAEXAAVQSessionManager@@@Z @ 11877 NONAME ; void QApplication::commitData(class QSessionManager &) - ?draw@QGraphicsPixelizeEffect@@MAEXPAVQPainter@@PAVQGraphicsEffectSource@@@Z @ 11878 NONAME ; void QGraphicsPixelizeEffect::draw(class QPainter *, class QGraphicsEffectSource *) + ?draw@QGraphicsPixelizeEffect@@MAEXPAVQPainter@@PAVQGraphicsEffectSource@@@Z @ 11878 NONAME ABSENT ; void QGraphicsPixelizeEffect::draw(class QPainter *, class QGraphicsEffectSource *) ?updateState@QPaintEngineEx@@UAEXABVQPaintEngineState@@@Z @ 11879 NONAME ; void QPaintEngineEx::updateState(class QPaintEngineState const &) ?qt_metacall@QTextFrame@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 11880 NONAME ; int QTextFrame::qt_metacall(enum QMetaObject::Call, int, void * *) ?getStaticMetaObject@QImageIOPlugin@@SAABUQMetaObject@@XZ @ 11881 NONAME ; struct QMetaObject const & QImageIOPlugin::getStaticMetaObject(void) @@ -11885,7 +11885,7 @@ EXPORTS ??1QGraphicsEffectSource@@UAE@XZ @ 11884 NONAME ; QGraphicsEffectSource::~QGraphicsEffectSource(void) ?mapRectToScene@QGraphicsItem@@QBE?AVQRectF@@MMMM@Z @ 11885 NONAME ; class QRectF QGraphicsItem::mapRectToScene(float, float, float, float) const ??1QToolBarChangeEvent@@UAE@XZ @ 11886 NONAME ; QToolBarChangeEvent::~QToolBarChangeEvent(void) - ?strengthChanged@QGraphicsGrayscaleEffect@@IAEXM@Z @ 11887 NONAME ; void QGraphicsGrayscaleEffect::strengthChanged(float) + ?strengthChanged@QGraphicsGrayscaleEffect@@IAEXM@Z @ 11887 NONAME ABSENT ; void QGraphicsGrayscaleEffect::strengthChanged(float) ?sizeHintChanged@QAbstractItemDelegate@@IAEXABVQModelIndex@@@Z @ 11888 NONAME ; void QAbstractItemDelegate::sizeHintChanged(class QModelIndex const &) ?setModel@QColumnView@@UAEXPAVQAbstractItemModel@@@Z @ 11889 NONAME ; void QColumnView::setModel(class QAbstractItemModel *) ?dy@QMatrix@@QBEMXZ @ 11890 NONAME ; float QMatrix::dy(void) const @@ -12548,4 +12548,38 @@ EXPORTS ?projectedRotate@QMatrix4x4@@AAEAAV1@MMMM@Z @ 12547 NONAME ; class QMatrix4x4 & QMatrix4x4::projectedRotate(float, float, float, float) ?setLeadingIncluded@QTextLine@@QAEX_N@Z @ 12548 NONAME ; void QTextLine::setLeadingIncluded(bool) ?toTransform@QMatrix4x4@@QBE?AVQTransform@@XZ @ 12549 NONAME ; class QTransform QMatrix4x4::toTransform(void) const + ??0QStyleOptionTabWidgetFrameV2@@IAE@H@Z @ 12550 NONAME ; QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(int) + ??0QStyleOptionTabWidgetFrameV2@@QAE@ABV0@@Z @ 12551 NONAME ; QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(class QStyleOptionTabWidgetFrameV2 const &) + ??0QStyleOptionTabWidgetFrameV2@@QAE@ABVQStyleOptionTabWidgetFrame@@@Z @ 12552 NONAME ; QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(class QStyleOptionTabWidgetFrame const &) + ??0QStyleOptionTabWidgetFrameV2@@QAE@XZ @ 12553 NONAME ; QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(void) + ??1QStyleOptionTabWidgetFrameV2@@QAE@XZ @ 12554 NONAME ; QStyleOptionTabWidgetFrameV2::~QStyleOptionTabWidgetFrameV2(void) + ??4QStyleOptionTabWidgetFrameV2@@QAEAAV0@ABVQStyleOptionTabWidgetFrame@@@Z @ 12555 NONAME ; class QStyleOptionTabWidgetFrameV2 & QStyleOptionTabWidgetFrameV2::operator=(class QStyleOptionTabWidgetFrame const &) + ?accept@QGestureEvent@@QAEXW4GestureType@Qt@@@Z @ 12556 NONAME ; void QGestureEvent::accept(enum Qt::GestureType) + ?addCacheData@QVectorPath@@QAEPAUCacheEntry@1@PAVQPaintEngineEx@@PAXP6AX1@Z@Z @ 12557 NONAME ; struct QVectorPath::CacheEntry * QVectorPath::addCacheData(class QPaintEngineEx *, void *, void (*)(void *)) + ?availableRedoSteps@QTextDocument@@QBEHXZ @ 12558 NONAME ; int QTextDocument::availableRedoSteps(void) const + ?availableUndoSteps@QTextDocument@@QBEHXZ @ 12559 NONAME ; int QTextDocument::availableUndoSteps(void) const + ?blurRadius@QGraphicsBlurEffect@@QBEMXZ @ 12560 NONAME ; float QGraphicsBlurEffect::blurRadius(void) const + ?blurRadius@QGraphicsDropShadowEffect@@QBEMXZ @ 12561 NONAME ; float QGraphicsDropShadowEffect::blurRadius(void) const + ?blurRadius@QPixmapDropShadowFilter@@QBEMXZ @ 12562 NONAME ; float QPixmapDropShadowFilter::blurRadius(void) const + ?blurRadiusChanged@QGraphicsBlurEffect@@IAEXM@Z @ 12563 NONAME ; void QGraphicsBlurEffect::blurRadiusChanged(float) + ?blurRadiusChanged@QGraphicsDropShadowEffect@@IAEXM@Z @ 12564 NONAME ; void QGraphicsDropShadowEffect::blurRadiusChanged(float) + ?gestureCancelPolicy@QGesture@@QBE?AW4GestureCancelPolicy@1@XZ @ 12565 NONAME ; enum QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy(void) const + ?ignore@QGestureEvent@@QAEXW4GestureType@Qt@@@Z @ 12566 NONAME ; void QGestureEvent::ignore(enum Qt::GestureType) + ?isAccepted@QGestureEvent@@QBE_NW4GestureType@Qt@@@Z @ 12567 NONAME ; bool QGestureEvent::isAccepted(enum Qt::GestureType) const + ?isCacheable@QVectorPath@@QBE_NXZ @ 12568 NONAME ; bool QVectorPath::isCacheable(void) const + ?isConvex@QVectorPath@@QBE_NXZ @ 12569 NONAME ; bool QVectorPath::isConvex(void) const + ?isCurved@QVectorPath@@QBE_NXZ @ 12570 NONAME ; bool QVectorPath::isCurved(void) const + ?lookupCacheData@QVectorPath@@QBEPAUCacheEntry@1@PAVQPaintEngineEx@@@Z @ 12571 NONAME ; struct QVectorPath::CacheEntry * QVectorPath::lookupCacheData(class QPaintEngineEx *) const + ?pixmap@QGraphicsEffectSource@@QBE?AVQPixmap@@W4CoordinateSystem@Qt@@PAVQPoint@@W4PixmapPadMode@1@@Z @ 12572 NONAME ; class QPixmap QGraphicsEffectSource::pixmap(enum Qt::CoordinateSystem, class QPoint *, enum QGraphicsEffectSource::PixmapPadMode) const + ?radius@QPixmapBlurFilter@@QBEMXZ @ 12573 NONAME ; float QPixmapBlurFilter::radius(void) const + ?registerGestureRecognizer@QApplication@@SA?AW4GestureType@Qt@@PAVQGestureRecognizer@@@Z @ 12574 NONAME ; enum Qt::GestureType QApplication::registerGestureRecognizer(class QGestureRecognizer *) + ?setAccepted@QGestureEvent@@QAEXW4GestureType@Qt@@_N@Z @ 12575 NONAME ; void QGestureEvent::setAccepted(enum Qt::GestureType, bool) + ?setBlurRadius@QGraphicsBlurEffect@@QAEXM@Z @ 12576 NONAME ; void QGraphicsBlurEffect::setBlurRadius(float) + ?setBlurRadius@QGraphicsDropShadowEffect@@QAEXM@Z @ 12577 NONAME ; void QGraphicsDropShadowEffect::setBlurRadius(float) + ?setBlurRadius@QPixmapDropShadowFilter@@QAEXM@Z @ 12578 NONAME ; void QPixmapDropShadowFilter::setBlurRadius(float) + ?setGestureCancelPolicy@QGesture@@QAEXW4GestureCancelPolicy@1@@Z @ 12579 NONAME ; void QGesture::setGestureCancelPolicy(enum QGesture::GestureCancelPolicy) + ?setRadius@QPixmapBlurFilter@@QAEXM@Z @ 12580 NONAME ; void QPixmapBlurFilter::setRadius(float) + ?topLevelChanged@QToolBar@@IAEX_N@Z @ 12581 NONAME ; void QToolBar::topLevelChanged(bool) + ?ungrabGesture@QWidget@@QAEXW4GestureType@Qt@@@Z @ 12582 NONAME ; void QWidget::ungrabGesture(enum Qt::GestureType) + ?unregisterGestureRecognizer@QApplication@@SAXW4GestureType@Qt@@@Z @ 12583 NONAME ; void QApplication::unregisterGestureRecognizer(enum Qt::GestureType) diff --git a/src/s60installs/bwins/QtScriptu.def b/src/s60installs/bwins/QtScriptu.def index 95b047e..b3efd69 100644 --- a/src/s60installs/bwins/QtScriptu.def +++ b/src/s60installs/bwins/QtScriptu.def @@ -328,4 +328,19 @@ EXPORTS ?functionMetaIndex@QScriptContextInfo@@QBEHXZ @ 327 NONAME ; int QScriptContextInfo::functionMetaIndex(void) const ?columnNumber@QScriptContextInfo@@QBEHXZ @ 328 NONAME ; int QScriptContextInfo::columnNumber(void) const ??0QScriptValue@@QAE@_N@Z @ 329 NONAME ; QScriptValue::QScriptValue(bool) + ??0QScriptProgram@@QAE@ABV0@@Z @ 330 NONAME ; QScriptProgram::QScriptProgram(class QScriptProgram const &) + ??0QScriptProgram@@QAE@ABVQString@@V1@H@Z @ 331 NONAME ; QScriptProgram::QScriptProgram(class QString const &, class QString, int) + ??0QScriptProgram@@QAE@XZ @ 332 NONAME ; QScriptProgram::QScriptProgram(void) + ??1QScriptProgram@@QAE@XZ @ 333 NONAME ; QScriptProgram::~QScriptProgram(void) + ??4QScriptProgram@@QAEAAV0@ABV0@@Z @ 334 NONAME ; class QScriptProgram & QScriptProgram::operator=(class QScriptProgram const &) + ??8QScriptProgram@@QBE_NABV0@@Z @ 335 NONAME ; bool QScriptProgram::operator==(class QScriptProgram const &) const + ??9QScriptProgram@@QBE_NABV0@@Z @ 336 NONAME ; bool QScriptProgram::operator!=(class QScriptProgram const &) const + ?d_func@QScriptProgram@@AAEPAVQScriptProgramPrivate@@XZ @ 337 NONAME ; class QScriptProgramPrivate * QScriptProgram::d_func(void) + ?d_func@QScriptProgram@@ABEPBVQScriptProgramPrivate@@XZ @ 338 NONAME ; class QScriptProgramPrivate const * QScriptProgram::d_func(void) const + ?evaluate@QScriptEngine@@QAE?AVQScriptValue@@ABVQScriptProgram@@@Z @ 339 NONAME ; class QScriptValue QScriptEngine::evaluate(class QScriptProgram const &) + ?fileName@QScriptProgram@@QBE?AVQString@@XZ @ 340 NONAME ; class QString QScriptProgram::fileName(void) const + ?firstLineNumber@QScriptProgram@@QBEHXZ @ 341 NONAME ; int QScriptProgram::firstLineNumber(void) const + ?isNull@QScriptProgram@@QBE_NXZ @ 342 NONAME ; bool QScriptProgram::isNull(void) const + ?sourceCode@QScriptProgram@@QBE?AVQString@@XZ @ 343 NONAME ; class QString QScriptProgram::sourceCode(void) const + ?toArrayIndex@QScriptString@@QBEIPA_N@Z @ 344 NONAME ; unsigned int QScriptString::toArrayIndex(bool *) const diff --git a/src/s60installs/bwins/QtXmlPatternsu.def b/src/s60installs/bwins/QtXmlPatternsu.def new file mode 100644 index 0000000..57a75d4 --- /dev/null +++ b/src/s60installs/bwins/QtXmlPatternsu.def @@ -0,0 +1,280 @@ +EXPORTS + ??0QAbstractMessageHandler@@QAE@PAVQObject@@@Z @ 1 NONAME ; QAbstractMessageHandler::QAbstractMessageHandler(class QObject *) + ??0QAbstractUriResolver@@QAE@PAVQObject@@@Z @ 2 NONAME ; QAbstractUriResolver::QAbstractUriResolver(class QObject *) + ??0QAbstractXmlNodeModel@@IAE@PAVQAbstractXmlNodeModelPrivate@@@Z @ 3 NONAME ; QAbstractXmlNodeModel::QAbstractXmlNodeModel(class QAbstractXmlNodeModelPrivate *) + ??0QAbstractXmlNodeModel@@QAE@XZ @ 4 NONAME ; QAbstractXmlNodeModel::QAbstractXmlNodeModel(void) + ??0QAbstractXmlReceiver@@IAE@PAVQAbstractXmlReceiverPrivate@@@Z @ 5 NONAME ; QAbstractXmlReceiver::QAbstractXmlReceiver(class QAbstractXmlReceiverPrivate *) + ??0QAbstractXmlReceiver@@QAE@XZ @ 6 NONAME ; QAbstractXmlReceiver::QAbstractXmlReceiver(void) + ??0QSimpleXmlNodeModel@@QAE@ABVQXmlNamePool@@@Z @ 7 NONAME ; QSimpleXmlNodeModel::QSimpleXmlNodeModel(class QXmlNamePool const &) + ??0QSourceLocation@@QAE@ABV0@@Z @ 8 NONAME ; QSourceLocation::QSourceLocation(class QSourceLocation const &) + ??0QSourceLocation@@QAE@ABVQUrl@@HH@Z @ 9 NONAME ; QSourceLocation::QSourceLocation(class QUrl const &, int, int) + ??0QSourceLocation@@QAE@XZ @ 10 NONAME ; QSourceLocation::QSourceLocation(void) + ??0QXmlFormatter@@QAE@ABVQXmlQuery@@PAVQIODevice@@@Z @ 11 NONAME ; QXmlFormatter::QXmlFormatter(class QXmlQuery const &, class QIODevice *) + ??0QXmlItem@@AAE@ABVItem@QPatternist@@@Z @ 12 NONAME ; QXmlItem::QXmlItem(class QPatternist::Item const &) + ??0QXmlItem@@QAE@ABV0@@Z @ 13 NONAME ; QXmlItem::QXmlItem(class QXmlItem const &) + ??0QXmlItem@@QAE@ABVQVariant@@@Z @ 14 NONAME ; QXmlItem::QXmlItem(class QVariant const &) + ??0QXmlItem@@QAE@ABVQXmlNodeModelIndex@@@Z @ 15 NONAME ; QXmlItem::QXmlItem(class QXmlNodeModelIndex const &) + ??0QXmlItem@@QAE@XZ @ 16 NONAME ; QXmlItem::QXmlItem(void) + ??0QXmlName@@AAE@H@Z @ 17 NONAME ; QXmlName::QXmlName(int) + ??0QXmlName@@QAE@AAVQXmlNamePool@@ABVQString@@11@Z @ 18 NONAME ; QXmlName::QXmlName(class QXmlNamePool &, class QString const &, class QString const &, class QString const &) + ??0QXmlName@@QAE@ABV0@@Z @ 19 NONAME ; QXmlName::QXmlName(class QXmlName const &) + ??0QXmlName@@QAE@FFF@Z @ 20 NONAME ; QXmlName::QXmlName(short, short, short) + ??0QXmlName@@QAE@XZ @ 21 NONAME ; QXmlName::QXmlName(void) + ??0QXmlNamePool@@AAE@PAVNamePool@QPatternist@@@Z @ 22 NONAME ; QXmlNamePool::QXmlNamePool(class QPatternist::NamePool *) + ??0QXmlNamePool@@QAE@ABV0@@Z @ 23 NONAME ; QXmlNamePool::QXmlNamePool(class QXmlNamePool const &) + ??0QXmlNamePool@@QAE@XZ @ 24 NONAME ; QXmlNamePool::QXmlNamePool(void) + ??0QXmlNodeModelIndex@@AAE@ABVNodeIndexStorage@QPatternist@@@Z @ 25 NONAME ; QXmlNodeModelIndex::QXmlNodeModelIndex(class QPatternist::NodeIndexStorage const &) + ??0QXmlNodeModelIndex@@QAE@ABV0@@Z @ 26 NONAME ; QXmlNodeModelIndex::QXmlNodeModelIndex(class QXmlNodeModelIndex const &) + ??0QXmlNodeModelIndex@@QAE@XZ @ 27 NONAME ; QXmlNodeModelIndex::QXmlNodeModelIndex(void) + ??0QXmlQuery@@QAE@ABV0@@Z @ 28 NONAME ; QXmlQuery::QXmlQuery(class QXmlQuery const &) + ??0QXmlQuery@@QAE@ABVQXmlNamePool@@@Z @ 29 NONAME ; QXmlQuery::QXmlQuery(class QXmlNamePool const &) + ??0QXmlQuery@@QAE@W4QueryLanguage@0@ABVQXmlNamePool@@@Z @ 30 NONAME ; QXmlQuery::QXmlQuery(enum QXmlQuery::QueryLanguage, class QXmlNamePool const &) + ??0QXmlQuery@@QAE@XZ @ 31 NONAME ; QXmlQuery::QXmlQuery(void) + ??0QXmlResultItems@@QAE@XZ @ 32 NONAME ; QXmlResultItems::QXmlResultItems(void) + ??0QXmlSchema@@QAE@ABV0@@Z @ 33 NONAME ; QXmlSchema::QXmlSchema(class QXmlSchema const &) + ??0QXmlSchema@@QAE@XZ @ 34 NONAME ; QXmlSchema::QXmlSchema(void) + ??0QXmlSchemaValidator@@QAE@ABVQXmlSchema@@@Z @ 35 NONAME ; QXmlSchemaValidator::QXmlSchemaValidator(class QXmlSchema const &) + ??0QXmlSchemaValidator@@QAE@XZ @ 36 NONAME ; QXmlSchemaValidator::QXmlSchemaValidator(void) + ??0QXmlSerializer@@IAE@PAVQAbstractXmlReceiverPrivate@@@Z @ 37 NONAME ; QXmlSerializer::QXmlSerializer(class QAbstractXmlReceiverPrivate *) + ??0QXmlSerializer@@QAE@ABVQXmlQuery@@PAVQIODevice@@@Z @ 38 NONAME ; QXmlSerializer::QXmlSerializer(class QXmlQuery const &, class QIODevice *) + ??1QAbstractMessageHandler@@UAE@XZ @ 39 NONAME ; QAbstractMessageHandler::~QAbstractMessageHandler(void) + ??1QAbstractUriResolver@@UAE@XZ @ 40 NONAME ; QAbstractUriResolver::~QAbstractUriResolver(void) + ??1QAbstractXmlNodeModel@@UAE@XZ @ 41 NONAME ; QAbstractXmlNodeModel::~QAbstractXmlNodeModel(void) + ??1QAbstractXmlReceiver@@UAE@XZ @ 42 NONAME ; QAbstractXmlReceiver::~QAbstractXmlReceiver(void) + ??1QSimpleXmlNodeModel@@UAE@XZ @ 43 NONAME ; QSimpleXmlNodeModel::~QSimpleXmlNodeModel(void) + ??1QSourceLocation@@QAE@XZ @ 44 NONAME ; QSourceLocation::~QSourceLocation(void) + ??1QXmlFormatter@@UAE@XZ @ 45 NONAME ; QXmlFormatter::~QXmlFormatter(void) + ??1QXmlItem@@QAE@XZ @ 46 NONAME ; QXmlItem::~QXmlItem(void) + ??1QXmlNamePool@@QAE@XZ @ 47 NONAME ; QXmlNamePool::~QXmlNamePool(void) + ??1QXmlQuery@@QAE@XZ @ 48 NONAME ; QXmlQuery::~QXmlQuery(void) + ??1QXmlResultItems@@UAE@XZ @ 49 NONAME ; QXmlResultItems::~QXmlResultItems(void) + ??1QXmlSchema@@QAE@XZ @ 50 NONAME ; QXmlSchema::~QXmlSchema(void) + ??1QXmlSchemaValidator@@QAE@XZ @ 51 NONAME ; QXmlSchemaValidator::~QXmlSchemaValidator(void) + ??1QXmlSerializer@@UAE@XZ @ 52 NONAME ; QXmlSerializer::~QXmlSerializer(void) + ??4QSourceLocation@@QAEAAV0@ABV0@@Z @ 53 NONAME ; class QSourceLocation & QSourceLocation::operator=(class QSourceLocation const &) + ??4QXmlItem@@QAEAAV0@ABV0@@Z @ 54 NONAME ; class QXmlItem & QXmlItem::operator=(class QXmlItem const &) + ??4QXmlName@@QAEAAV0@ABV0@@Z @ 55 NONAME ; class QXmlName & QXmlName::operator=(class QXmlName const &) + ??4QXmlNamePool@@QAEAAV0@ABV0@@Z @ 56 NONAME ; class QXmlNamePool & QXmlNamePool::operator=(class QXmlNamePool const &) + ??4QXmlQuery@@QAEAAV0@ABV0@@Z @ 57 NONAME ; class QXmlQuery & QXmlQuery::operator=(class QXmlQuery const &) + ??4QXmlSchema@@QAEAAV0@ABV0@@Z @ 58 NONAME ; class QXmlSchema & QXmlSchema::operator=(class QXmlSchema const &) + ??6@YA?AVQDebug@@V0@ABVQSourceLocation@@@Z @ 59 NONAME ; class QDebug operator<<(class QDebug, class QSourceLocation const &) + ??8QSourceLocation@@QBE_NABV0@@Z @ 60 NONAME ; bool QSourceLocation::operator==(class QSourceLocation const &) const + ??8QXmlName@@QBE_NABV0@@Z @ 61 NONAME ; bool QXmlName::operator==(class QXmlName const &) const + ??8QXmlNodeModelIndex@@QBE_NABV0@@Z @ 62 NONAME ; bool QXmlNodeModelIndex::operator==(class QXmlNodeModelIndex const &) const + ??9QSourceLocation@@QBE_NABV0@@Z @ 63 NONAME ; bool QSourceLocation::operator!=(class QSourceLocation const &) const + ??9QXmlName@@QBE_NABV0@@Z @ 64 NONAME ; bool QXmlName::operator!=(class QXmlName const &) const + ??9QXmlNodeModelIndex@@QBE_NABV0@@Z @ 65 NONAME ; bool QXmlNodeModelIndex::operator!=(class QXmlNodeModelIndex const &) const + ??_EQAbstractMessageHandler@@UAE@I@Z @ 66 NONAME ; QAbstractMessageHandler::~QAbstractMessageHandler(unsigned int) + ??_EQAbstractUriResolver@@UAE@I@Z @ 67 NONAME ; QAbstractUriResolver::~QAbstractUriResolver(unsigned int) + ??_EQAbstractXmlNodeModel@@UAE@I@Z @ 68 NONAME ; QAbstractXmlNodeModel::~QAbstractXmlNodeModel(unsigned int) + ??_EQAbstractXmlReceiver@@UAE@I@Z @ 69 NONAME ; QAbstractXmlReceiver::~QAbstractXmlReceiver(unsigned int) + ??_EQSimpleXmlNodeModel@@UAE@I@Z @ 70 NONAME ; QSimpleXmlNodeModel::~QSimpleXmlNodeModel(unsigned int) + ??_EQXmlFormatter@@UAE@I@Z @ 71 NONAME ; QXmlFormatter::~QXmlFormatter(unsigned int) + ??_EQXmlResultItems@@UAE@I@Z @ 72 NONAME ; QXmlResultItems::~QXmlResultItems(unsigned int) + ??_EQXmlSerializer@@UAE@I@Z @ 73 NONAME ; QXmlSerializer::~QXmlSerializer(unsigned int) + ?additionalData@QXmlNodeModelIndex@@QBE_JXZ @ 74 NONAME ; long long QXmlNodeModelIndex::additionalData(void) const + ?atDocumentRoot@QXmlSerializer@@ABE_NXZ @ 75 NONAME ; bool QXmlSerializer::atDocumentRoot(void) const + ?atomicValue@QXmlFormatter@@UAEXABVQVariant@@@Z @ 76 NONAME ; void QXmlFormatter::atomicValue(class QVariant const &) + ?atomicValue@QXmlSerializer@@UAEXABVQVariant@@@Z @ 77 NONAME ; void QXmlSerializer::atomicValue(class QVariant const &) + ?attribute@QXmlFormatter@@UAEXABVQXmlName@@ABVQStringRef@@@Z @ 78 NONAME ; void QXmlFormatter::attribute(class QXmlName const &, class QStringRef const &) + ?attribute@QXmlSerializer@@UAEXABVQXmlName@@ABVQStringRef@@@Z @ 79 NONAME ; void QXmlSerializer::attribute(class QXmlName const &, class QStringRef const &) + ?baseUri@QSimpleXmlNodeModel@@UBE?AVQUrl@@ABVQXmlNodeModelIndex@@@Z @ 80 NONAME ; class QUrl QSimpleXmlNodeModel::baseUri(class QXmlNodeModelIndex const &) const + ?baseUri@QXmlNodeModelIndex@@QBE?AVQUrl@@XZ @ 81 NONAME ; class QUrl QXmlNodeModelIndex::baseUri(void) const + ?bindVariable@QXmlQuery@@QAEXABVQString@@ABV1@@Z @ 82 NONAME ; void QXmlQuery::bindVariable(class QString const &, class QXmlQuery const &) + ?bindVariable@QXmlQuery@@QAEXABVQString@@ABVQXmlItem@@@Z @ 83 NONAME ; void QXmlQuery::bindVariable(class QString const &, class QXmlItem const &) + ?bindVariable@QXmlQuery@@QAEXABVQString@@PAVQIODevice@@@Z @ 84 NONAME ; void QXmlQuery::bindVariable(class QString const &, class QIODevice *) + ?bindVariable@QXmlQuery@@QAEXABVQXmlName@@ABV1@@Z @ 85 NONAME ; void QXmlQuery::bindVariable(class QXmlName const &, class QXmlQuery const &) + ?bindVariable@QXmlQuery@@QAEXABVQXmlName@@ABVQXmlItem@@@Z @ 86 NONAME ; void QXmlQuery::bindVariable(class QXmlName const &, class QXmlItem const &) + ?bindVariable@QXmlQuery@@QAEXABVQXmlName@@PAVQIODevice@@@Z @ 87 NONAME ; void QXmlQuery::bindVariable(class QXmlName const &, class QIODevice *) + ?characters@QXmlFormatter@@UAEXABVQStringRef@@@Z @ 88 NONAME ; void QXmlFormatter::characters(class QStringRef const &) + ?characters@QXmlSerializer@@UAEXABVQStringRef@@@Z @ 89 NONAME ; void QXmlSerializer::characters(class QStringRef const &) + ?code@QXmlName@@QBE_JXZ @ 90 NONAME ; long long QXmlName::code(void) const + ?codec@QXmlSerializer@@QBEPBVQTextCodec@@XZ @ 91 NONAME ; class QTextCodec const * QXmlSerializer::codec(void) const + ?column@QSourceLocation@@QBE_JXZ @ 92 NONAME ; long long QSourceLocation::column(void) const + ?comment@QXmlFormatter@@UAEXABVQString@@@Z @ 93 NONAME ; void QXmlFormatter::comment(class QString const &) + ?comment@QXmlSerializer@@UAEXABVQString@@@Z @ 94 NONAME ; void QXmlSerializer::comment(class QString const &) + ?compareOrder@QXmlNodeModelIndex@@QBE?AW4DocumentOrder@1@ABV1@@Z @ 95 NONAME ; enum QXmlNodeModelIndex::DocumentOrder QXmlNodeModelIndex::compareOrder(class QXmlNodeModelIndex const &) const + ?copyNodeTo@QAbstractXmlNodeModel@@UBEXABVQXmlNodeModelIndex@@PAVQAbstractXmlReceiver@@ABV?$QFlags@W4NodeCopySetting@QAbstractXmlNodeModel@@@@@Z @ 96 NONAME ; void QAbstractXmlNodeModel::copyNodeTo(class QXmlNodeModelIndex const &, class QAbstractXmlReceiver *, class QFlags const &) const + ?create@QXmlNodeModelIndex@@CA?AV1@_JPBVQAbstractXmlNodeModel@@0@Z @ 97 NONAME ; class QXmlNodeModelIndex QXmlNodeModelIndex::create(long long, class QAbstractXmlNodeModel const *, long long) + ?create@QXmlNodeModelIndex@@CA?AV1@_JPBVQAbstractXmlNodeModel@@@Z @ 98 NONAME ; class QXmlNodeModelIndex QXmlNodeModelIndex::create(long long, class QAbstractXmlNodeModel const *) + ?createIndex@QAbstractXmlNodeModel@@IBE?AVQXmlNodeModelIndex@@PAX_J@Z @ 99 NONAME ; class QXmlNodeModelIndex QAbstractXmlNodeModel::createIndex(void *, long long) const + ?createIndex@QAbstractXmlNodeModel@@IBE?AVQXmlNodeModelIndex@@_J0@Z @ 100 NONAME ; class QXmlNodeModelIndex QAbstractXmlNodeModel::createIndex(long long, long long) const + ?createIndex@QAbstractXmlNodeModel@@IBE?AVQXmlNodeModelIndex@@_J@Z @ 101 NONAME ; class QXmlNodeModelIndex QAbstractXmlNodeModel::createIndex(long long) const + ?current@QXmlResultItems@@QBE?AVQXmlItem@@XZ @ 102 NONAME ; class QXmlItem QXmlResultItems::current(void) const + ?d_func@QAbstractMessageHandler@@AAEPAVQAbstractMessageHandlerPrivate@@XZ @ 103 NONAME ; class QAbstractMessageHandlerPrivate * QAbstractMessageHandler::d_func(void) + ?d_func@QAbstractMessageHandler@@ABEPBVQAbstractMessageHandlerPrivate@@XZ @ 104 NONAME ; class QAbstractMessageHandlerPrivate const * QAbstractMessageHandler::d_func(void) const + ?d_func@QAbstractUriResolver@@AAEPAVQAbstractUriResolverPrivate@@XZ @ 105 NONAME ; class QAbstractUriResolverPrivate * QAbstractUriResolver::d_func(void) + ?d_func@QAbstractUriResolver@@ABEPBVQAbstractUriResolverPrivate@@XZ @ 106 NONAME ; class QAbstractUriResolverPrivate const * QAbstractUriResolver::d_func(void) const + ?d_func@QSimpleXmlNodeModel@@AAEPAVQSimpleXmlNodeModelPrivate@@XZ @ 107 NONAME ; class QSimpleXmlNodeModelPrivate * QSimpleXmlNodeModel::d_func(void) + ?d_func@QSimpleXmlNodeModel@@ABEPBVQSimpleXmlNodeModelPrivate@@XZ @ 108 NONAME ; class QSimpleXmlNodeModelPrivate const * QSimpleXmlNodeModel::d_func(void) const + ?d_func@QXmlFormatter@@AAEPAVQXmlFormatterPrivate@@XZ @ 109 NONAME ; class QXmlFormatterPrivate * QXmlFormatter::d_func(void) + ?d_func@QXmlFormatter@@ABEPBVQXmlFormatterPrivate@@XZ @ 110 NONAME ; class QXmlFormatterPrivate const * QXmlFormatter::d_func(void) const + ?d_func@QXmlResultItems@@AAEPAVQXmlResultItemsPrivate@@XZ @ 111 NONAME ; class QXmlResultItemsPrivate * QXmlResultItems::d_func(void) + ?d_func@QXmlResultItems@@ABEPBVQXmlResultItemsPrivate@@XZ @ 112 NONAME ; class QXmlResultItemsPrivate const * QXmlResultItems::d_func(void) const + ?d_func@QXmlSerializer@@AAEPAVQXmlSerializerPrivate@@XZ @ 113 NONAME ; class QXmlSerializerPrivate * QXmlSerializer::d_func(void) + ?d_func@QXmlSerializer@@ABEPBVQXmlSerializerPrivate@@XZ @ 114 NONAME ; class QXmlSerializerPrivate const * QXmlSerializer::d_func(void) const + ?data@QXmlNodeModelIndex@@QBE_JXZ @ 115 NONAME ; long long QXmlNodeModelIndex::data(void) const + ?documentUri@QXmlNodeModelIndex@@QBE?AVQUrl@@XZ @ 116 NONAME ; class QUrl QXmlNodeModelIndex::documentUri(void) const + ?documentUri@QXmlSchema@@QBE?AVQUrl@@XZ @ 117 NONAME ; class QUrl QXmlSchema::documentUri(void) const + ?elementById@QSimpleXmlNodeModel@@UBE?AVQXmlNodeModelIndex@@ABVQXmlName@@@Z @ 118 NONAME ; class QXmlNodeModelIndex QSimpleXmlNodeModel::elementById(class QXmlName const &) const + ?endDocument@QXmlFormatter@@UAEXXZ @ 119 NONAME ; void QXmlFormatter::endDocument(void) + ?endDocument@QXmlSerializer@@UAEXXZ @ 120 NONAME ; void QXmlSerializer::endDocument(void) + ?endElement@QXmlFormatter@@UAEXXZ @ 121 NONAME ; void QXmlFormatter::endElement(void) + ?endElement@QXmlSerializer@@UAEXXZ @ 122 NONAME ; void QXmlSerializer::endElement(void) + ?endOfSequence@QXmlFormatter@@UAEXXZ @ 123 NONAME ; void QXmlFormatter::endOfSequence(void) + ?endOfSequence@QXmlSerializer@@UAEXXZ @ 124 NONAME ; void QXmlSerializer::endOfSequence(void) + ?evaluateTo@QXmlQuery@@QBEXPAVQXmlResultItems@@@Z @ 125 NONAME ; void QXmlQuery::evaluateTo(class QXmlResultItems *) const + ?evaluateTo@QXmlQuery@@QBE_NPAVQAbstractXmlReceiver@@@Z @ 126 NONAME ; bool QXmlQuery::evaluateTo(class QAbstractXmlReceiver *) const + ?evaluateTo@QXmlQuery@@QBE_NPAVQIODevice@@@Z @ 127 NONAME ; bool QXmlQuery::evaluateTo(class QIODevice *) const + ?evaluateTo@QXmlQuery@@QBE_NPAVQString@@@Z @ 128 NONAME ; bool QXmlQuery::evaluateTo(class QString *) const + ?evaluateTo@QXmlQuery@@QBE_NPAVQStringList@@@Z @ 129 NONAME ; bool QXmlQuery::evaluateTo(class QStringList *) const + ?fromClarkName@QXmlName@@SA?AV1@ABVQString@@ABVQXmlNamePool@@@Z @ 130 NONAME ; class QXmlName QXmlName::fromClarkName(class QString const &, class QXmlNamePool const &) + ?getStaticMetaObject@QAbstractMessageHandler@@SAABUQMetaObject@@XZ @ 131 NONAME ; struct QMetaObject const & QAbstractMessageHandler::getStaticMetaObject(void) + ?getStaticMetaObject@QAbstractUriResolver@@SAABUQMetaObject@@XZ @ 132 NONAME ; struct QMetaObject const & QAbstractUriResolver::getStaticMetaObject(void) + ?hasError@QXmlResultItems@@QBE_NXZ @ 133 NONAME ; bool QXmlResultItems::hasError(void) const + ?hasNamespace@QXmlName@@QBE_NXZ @ 134 NONAME ; bool QXmlName::hasNamespace(void) const + ?hasPrefix@QXmlName@@QBE_NXZ @ 135 NONAME ; bool QXmlName::hasPrefix(void) const + ?indentationDepth@QXmlFormatter@@QBEHXZ @ 136 NONAME ; int QXmlFormatter::indentationDepth(void) const + ?initialTemplateName@QXmlQuery@@QBE?AVQXmlName@@XZ @ 137 NONAME ; class QXmlName QXmlQuery::initialTemplateName(void) const + ?internalIsAtomicValue@QXmlItem@@ABE_NXZ @ 138 NONAME ; bool QXmlItem::internalIsAtomicValue(void) const + ?internalPointer@QXmlNodeModelIndex@@QBEPAXXZ @ 139 NONAME ; void * QXmlNodeModelIndex::internalPointer(void) const + ?is@QXmlNodeModelIndex@@QBE_NABV1@@Z @ 140 NONAME ; bool QXmlNodeModelIndex::is(class QXmlNodeModelIndex const &) const + ?isAtomicValue@QXmlItem@@QBE_NXZ @ 141 NONAME ; bool QXmlItem::isAtomicValue(void) const + ?isBindingInScope@QXmlSerializer@@ABE_NVQXmlName@@@Z @ 142 NONAME ; bool QXmlSerializer::isBindingInScope(class QXmlName) const + ?isDeepEqual@QAbstractXmlNodeModel@@UBE_NABVQXmlNodeModelIndex@@0@Z @ 143 NONAME ; bool QAbstractXmlNodeModel::isDeepEqual(class QXmlNodeModelIndex const &, class QXmlNodeModelIndex const &) const + ?isDeepEqual@QXmlNodeModelIndex@@QBE_NABV1@@Z @ 144 NONAME ; bool QXmlNodeModelIndex::isDeepEqual(class QXmlNodeModelIndex const &) const + ?isIgnorableInDeepEqual@QAbstractXmlNodeModel@@CA_NABVQXmlNodeModelIndex@@@Z @ 145 NONAME ; bool QAbstractXmlNodeModel::isIgnorableInDeepEqual(class QXmlNodeModelIndex const &) + ?isLexicallyEqual@QXmlName@@QBE_NABV1@@Z @ 146 NONAME ; bool QXmlName::isLexicallyEqual(class QXmlName const &) const + ?isNCName@QXmlName@@SA_NABVQString@@@Z @ 147 NONAME ; bool QXmlName::isNCName(class QString const &) + ?isNode@QXmlItem@@QBE_NXZ @ 148 NONAME ; bool QXmlItem::isNode(void) const + ?isNull@QSourceLocation@@QBE_NXZ @ 149 NONAME ; bool QSourceLocation::isNull(void) const + ?isNull@QXmlItem@@QBE_NXZ @ 150 NONAME ; bool QXmlItem::isNull(void) const + ?isNull@QXmlName@@QBE_NXZ @ 151 NONAME ; bool QXmlName::isNull(void) const + ?isNull@QXmlNodeModelIndex@@QBE_NXZ @ 152 NONAME ; bool QXmlNodeModelIndex::isNull(void) const + ?isValid@QXmlQuery@@QBE_NXZ @ 153 NONAME ; bool QXmlQuery::isValid(void) const + ?isValid@QXmlSchema@@QBE_NXZ @ 154 NONAME ; bool QXmlSchema::isValid(void) const + ?item@QAbstractXmlReceiver@@UAEXABVItem@QPatternist@@@Z @ 155 NONAME ; void QAbstractXmlReceiver::item(class QPatternist::Item const &) + ?item@QXmlFormatter@@UAEXABVItem@QPatternist@@@Z @ 156 NONAME ; void QXmlFormatter::item(class QPatternist::Item const &) + ?item@QXmlSerializer@@UAEXABVItem@QPatternist@@@Z @ 157 NONAME ; void QXmlSerializer::item(class QPatternist::Item const &) + ?iterate@QAbstractXmlNodeModel@@UBE?AV?$QExplicitlySharedDataPointer@V?$QAbstractXmlForwardIterator@VQXmlNodeModelIndex@@@@@@ABVQXmlNodeModelIndex@@W4Axis@3@@Z @ 158 NONAME ; class QExplicitlySharedDataPointer > QAbstractXmlNodeModel::iterate(class QXmlNodeModelIndex const &, enum QXmlNodeModelIndex::Axis) const + ?iterate@QXmlNodeModelIndex@@QBE?AV?$QExplicitlySharedDataPointer@V?$QAbstractXmlForwardIterator@VQXmlNodeModelIndex@@@@@@W4Axis@1@@Z @ 159 NONAME ; class QExplicitlySharedDataPointer > QXmlNodeModelIndex::iterate(enum QXmlNodeModelIndex::Axis) const + ?kind@QXmlNodeModelIndex@@QBE?AW4NodeKind@1@XZ @ 160 NONAME ; enum QXmlNodeModelIndex::NodeKind QXmlNodeModelIndex::kind(void) const + ?line@QSourceLocation@@QBE_JXZ @ 161 NONAME ; long long QSourceLocation::line(void) const + ?load@QXmlSchema@@QAE_NABVQByteArray@@ABVQUrl@@@Z @ 162 NONAME ; bool QXmlSchema::load(class QByteArray const &, class QUrl const &) + ?load@QXmlSchema@@QAE_NABVQUrl@@@Z @ 163 NONAME ; bool QXmlSchema::load(class QUrl const &) + ?load@QXmlSchema@@QAE_NPAVQIODevice@@ABVQUrl@@@Z @ 164 NONAME ; bool QXmlSchema::load(class QIODevice *, class QUrl const &) + ?localName@QXmlName@@QBE?AVQString@@ABVQXmlNamePool@@@Z @ 165 NONAME ; class QString QXmlName::localName(class QXmlNamePool const &) const + ?localName@QXmlName@@QBEFXZ @ 166 NONAME ; short QXmlName::localName(void) const + ?mapToSequence@QAbstractXmlNodeModel@@ABE?AV?$QExplicitlySharedDataPointer@V?$QAbstractXmlForwardIterator@VQXmlNodeModelIndex@@@@@@ABVQXmlNodeModelIndex@@ABV?$QExplicitlySharedDataPointer@VDynamicContext@QPatternist@@@@@Z @ 167 NONAME ; class QExplicitlySharedDataPointer > QAbstractXmlNodeModel::mapToSequence(class QXmlNodeModelIndex const &, class QExplicitlySharedDataPointer const &) const + ?message@QAbstractMessageHandler@@QAEXW4QtMsgType@@ABVQString@@ABVQUrl@@ABVQSourceLocation@@@Z @ 168 NONAME ; void QAbstractMessageHandler::message(enum QtMsgType, class QString const &, class QUrl const &, class QSourceLocation const &) + ?messageHandler@QXmlQuery@@QBEPAVQAbstractMessageHandler@@XZ @ 169 NONAME ; class QAbstractMessageHandler * QXmlQuery::messageHandler(void) const + ?messageHandler@QXmlSchema@@QBEPAVQAbstractMessageHandler@@XZ @ 170 NONAME ; class QAbstractMessageHandler * QXmlSchema::messageHandler(void) const + ?messageHandler@QXmlSchemaValidator@@QBEPAVQAbstractMessageHandler@@XZ @ 171 NONAME ; class QAbstractMessageHandler * QXmlSchemaValidator::messageHandler(void) const + ?metaObject@QAbstractMessageHandler@@UBEPBUQMetaObject@@XZ @ 172 NONAME ; struct QMetaObject const * QAbstractMessageHandler::metaObject(void) const + ?metaObject@QAbstractUriResolver@@UBEPBUQMetaObject@@XZ @ 173 NONAME ; struct QMetaObject const * QAbstractUriResolver::metaObject(void) const + ?model@QXmlNodeModelIndex@@QBEPBVQAbstractXmlNodeModel@@XZ @ 174 NONAME ; class QAbstractXmlNodeModel const * QXmlNodeModelIndex::model(void) const + ?name@QXmlNodeModelIndex@@QBE?AVQXmlName@@XZ @ 175 NONAME ; class QXmlName QXmlNodeModelIndex::name(void) const + ?namePool@QSimpleXmlNodeModel@@QBEAAVQXmlNamePool@@XZ @ 176 NONAME ; class QXmlNamePool & QSimpleXmlNodeModel::namePool(void) const + ?namePool@QXmlQuery@@QBE?AVQXmlNamePool@@XZ @ 177 NONAME ; class QXmlNamePool QXmlQuery::namePool(void) const + ?namePool@QXmlSchema@@QBE?AVQXmlNamePool@@XZ @ 178 NONAME ; class QXmlNamePool QXmlSchema::namePool(void) const + ?namePool@QXmlSchemaValidator@@QBE?AVQXmlNamePool@@XZ @ 179 NONAME ; class QXmlNamePool QXmlSchemaValidator::namePool(void) const + ?namespaceBinding@QXmlSerializer@@UAEXABVQXmlName@@@Z @ 180 NONAME ; void QXmlSerializer::namespaceBinding(class QXmlName const &) + ?namespaceBindings@QSimpleXmlNodeModel@@UBE?AV?$QVector@VQXmlName@@@@ABVQXmlNodeModelIndex@@@Z @ 181 NONAME ; class QVector QSimpleXmlNodeModel::namespaceBindings(class QXmlNodeModelIndex const &) const + ?namespaceBindings@QXmlNodeModelIndex@@QBE?AV?$QVector@VQXmlName@@@@XZ @ 182 NONAME ; class QVector QXmlNodeModelIndex::namespaceBindings(void) const + ?namespaceForPrefix@QAbstractXmlNodeModel@@UBEFABVQXmlNodeModelIndex@@F@Z @ 183 NONAME ; short QAbstractXmlNodeModel::namespaceForPrefix(class QXmlNodeModelIndex const &, short) const + ?namespaceForPrefix@QXmlNodeModelIndex@@QBEFF@Z @ 184 NONAME ; short QXmlNodeModelIndex::namespaceForPrefix(short) const + ?namespaceURI@QXmlName@@QBEFXZ @ 185 NONAME ; short QXmlName::namespaceURI(void) const + ?namespaceUri@QXmlName@@QBE?AVQString@@ABVQXmlNamePool@@@Z @ 186 NONAME ; class QString QXmlName::namespaceUri(class QXmlNamePool const &) const + ?networkAccessManager@QXmlQuery@@QBEPAVQNetworkAccessManager@@XZ @ 187 NONAME ; class QNetworkAccessManager * QXmlQuery::networkAccessManager(void) const + ?networkAccessManager@QXmlSchema@@QBEPAVQNetworkAccessManager@@XZ @ 188 NONAME ; class QNetworkAccessManager * QXmlSchema::networkAccessManager(void) const + ?networkAccessManager@QXmlSchemaValidator@@QBEPAVQNetworkAccessManager@@XZ @ 189 NONAME ; class QNetworkAccessManager * QXmlSchemaValidator::networkAccessManager(void) const + ?next@QXmlResultItems@@QAE?AVQXmlItem@@XZ @ 190 NONAME ; class QXmlItem QXmlResultItems::next(void) + ?nodesByIdref@QSimpleXmlNodeModel@@UBE?AV?$QVector@VQXmlNodeModelIndex@@@@ABVQXmlName@@@Z @ 191 NONAME ; class QVector QSimpleXmlNodeModel::nodesByIdref(class QXmlName const &) const + ?outputDevice@QXmlSerializer@@QBEPAVQIODevice@@XZ @ 192 NONAME ; class QIODevice * QXmlSerializer::outputDevice(void) const + ?prefix@QXmlName@@QBE?AVQString@@ABVQXmlNamePool@@@Z @ 193 NONAME ; class QString QXmlName::prefix(class QXmlNamePool const &) const + ?prefix@QXmlName@@QBEFXZ @ 194 NONAME ; short QXmlName::prefix(void) const + ?processingInstruction@QXmlFormatter@@UAEXABVQXmlName@@ABVQString@@@Z @ 195 NONAME ; void QXmlFormatter::processingInstruction(class QXmlName const &, class QString const &) + ?processingInstruction@QXmlSerializer@@UAEXABVQXmlName@@ABVQString@@@Z @ 196 NONAME ; void QXmlSerializer::processingInstruction(class QXmlName const &, class QString const &) + ?qHash@@YAIABVQSourceLocation@@@Z @ 197 NONAME ; unsigned int qHash(class QSourceLocation const &) + ?qHash@@YAIABVQXmlName@@@Z @ 198 NONAME ; unsigned int qHash(class QXmlName const &) + ?qHash@@YAIABVQXmlNodeModelIndex@@@Z @ 199 NONAME ; unsigned int qHash(class QXmlNodeModelIndex const &) + ?qt_metacall@QAbstractMessageHandler@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 200 NONAME ; int QAbstractMessageHandler::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacall@QAbstractUriResolver@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 201 NONAME ; int QAbstractUriResolver::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacast@QAbstractMessageHandler@@UAEPAXPBD@Z @ 202 NONAME ; void * QAbstractMessageHandler::qt_metacast(char const *) + ?qt_metacast@QAbstractUriResolver@@UAEPAXPBD@Z @ 203 NONAME ; void * QAbstractUriResolver::qt_metacast(char const *) + ?queryLanguage@QXmlQuery@@QBE?AW4QueryLanguage@1@XZ @ 204 NONAME ; enum QXmlQuery::QueryLanguage QXmlQuery::queryLanguage(void) const + ?reset@QXmlNodeModelIndex@@QAEXXZ @ 205 NONAME ; void QXmlNodeModelIndex::reset(void) + ?root@QXmlNodeModelIndex@@QBE?AV1@XZ @ 206 NONAME ; class QXmlNodeModelIndex QXmlNodeModelIndex::root(void) const + ?schema@QXmlSchemaValidator@@QBE?AVQXmlSchema@@XZ @ 207 NONAME ; class QXmlSchema QXmlSchemaValidator::schema(void) const + ?sendAsNode@QAbstractXmlReceiver@@IAEXABVItem@QPatternist@@@Z @ 208 NONAME ; void QAbstractXmlReceiver::sendAsNode(class QPatternist::Item const &) + ?sendNamespaces@QAbstractXmlNodeModel@@UBEXABVQXmlNodeModelIndex@@PAVQAbstractXmlReceiver@@@Z @ 209 NONAME ; void QAbstractXmlNodeModel::sendNamespaces(class QXmlNodeModelIndex const &, class QAbstractXmlReceiver *) const + ?sendNamespaces@QXmlNodeModelIndex@@QBEXPAVQAbstractXmlReceiver@@@Z @ 210 NONAME ; void QXmlNodeModelIndex::sendNamespaces(class QAbstractXmlReceiver *) const + ?sequencedTypedValue@QAbstractXmlNodeModel@@UBE?AV?$QExplicitlySharedDataPointer@V?$QAbstractXmlForwardIterator@VItem@QPatternist@@@@@@ABVQXmlNodeModelIndex@@@Z @ 211 NONAME ; class QExplicitlySharedDataPointer > QAbstractXmlNodeModel::sequencedTypedValue(class QXmlNodeModelIndex const &) const + ?sequencedTypedValue@QXmlNodeModelIndex@@QBE?AV?$QExplicitlySharedDataPointer@V?$QAbstractXmlForwardIterator@VItem@QPatternist@@@@@@XZ @ 212 NONAME ; class QExplicitlySharedDataPointer > QXmlNodeModelIndex::sequencedTypedValue(void) const + ?setCodec@QXmlSerializer@@QAEXPBVQTextCodec@@@Z @ 213 NONAME ; void QXmlSerializer::setCodec(class QTextCodec const *) + ?setColumn@QSourceLocation@@QAEX_J@Z @ 214 NONAME ; void QSourceLocation::setColumn(long long) + ?setFocus@QXmlQuery@@QAEXABVQXmlItem@@@Z @ 215 NONAME ; void QXmlQuery::setFocus(class QXmlItem const &) + ?setFocus@QXmlQuery@@QAE_NABVQString@@@Z @ 216 NONAME ; bool QXmlQuery::setFocus(class QString const &) + ?setFocus@QXmlQuery@@QAE_NABVQUrl@@@Z @ 217 NONAME ; bool QXmlQuery::setFocus(class QUrl const &) + ?setFocus@QXmlQuery@@QAE_NPAVQIODevice@@@Z @ 218 NONAME ; bool QXmlQuery::setFocus(class QIODevice *) + ?setIndentationDepth@QXmlFormatter@@QAEXH@Z @ 219 NONAME ; void QXmlFormatter::setIndentationDepth(int) + ?setInitialTemplateName@QXmlQuery@@QAEXABVQString@@@Z @ 220 NONAME ; void QXmlQuery::setInitialTemplateName(class QString const &) + ?setInitialTemplateName@QXmlQuery@@QAEXABVQXmlName@@@Z @ 221 NONAME ; void QXmlQuery::setInitialTemplateName(class QXmlName const &) + ?setLine@QSourceLocation@@QAEX_J@Z @ 222 NONAME ; void QSourceLocation::setLine(long long) + ?setLocalName@QXmlName@@QAEXF@Z @ 223 NONAME ; void QXmlName::setLocalName(short) + ?setMessageHandler@QXmlQuery@@QAEXPAVQAbstractMessageHandler@@@Z @ 224 NONAME ; void QXmlQuery::setMessageHandler(class QAbstractMessageHandler *) + ?setMessageHandler@QXmlSchema@@QAEXPAVQAbstractMessageHandler@@@Z @ 225 NONAME ; void QXmlSchema::setMessageHandler(class QAbstractMessageHandler *) + ?setMessageHandler@QXmlSchemaValidator@@QAEXPAVQAbstractMessageHandler@@@Z @ 226 NONAME ; void QXmlSchemaValidator::setMessageHandler(class QAbstractMessageHandler *) + ?setNamespaceURI@QXmlName@@QAEXF@Z @ 227 NONAME ; void QXmlName::setNamespaceURI(short) + ?setNetworkAccessManager@QXmlQuery@@QAEXPAVQNetworkAccessManager@@@Z @ 228 NONAME ; void QXmlQuery::setNetworkAccessManager(class QNetworkAccessManager *) + ?setNetworkAccessManager@QXmlSchema@@QAEXPAVQNetworkAccessManager@@@Z @ 229 NONAME ; void QXmlSchema::setNetworkAccessManager(class QNetworkAccessManager *) + ?setNetworkAccessManager@QXmlSchemaValidator@@QAEXPAVQNetworkAccessManager@@@Z @ 230 NONAME ; void QXmlSchemaValidator::setNetworkAccessManager(class QNetworkAccessManager *) + ?setPrefix@QXmlName@@QAEXF@Z @ 231 NONAME ; void QXmlName::setPrefix(short) + ?setQuery@QXmlQuery@@QAEXABVQString@@ABVQUrl@@@Z @ 232 NONAME ; void QXmlQuery::setQuery(class QString const &, class QUrl const &) + ?setQuery@QXmlQuery@@QAEXABVQUrl@@0@Z @ 233 NONAME ; void QXmlQuery::setQuery(class QUrl const &, class QUrl const &) + ?setQuery@QXmlQuery@@QAEXPAVQIODevice@@ABVQUrl@@@Z @ 234 NONAME ; void QXmlQuery::setQuery(class QIODevice *, class QUrl const &) + ?setSchema@QXmlSchemaValidator@@QAEXABVQXmlSchema@@@Z @ 235 NONAME ; void QXmlSchemaValidator::setSchema(class QXmlSchema const &) + ?setUri@QSourceLocation@@QAEXABVQUrl@@@Z @ 236 NONAME ; void QSourceLocation::setUri(class QUrl const &) + ?setUriResolver@QXmlQuery@@QAEXPBVQAbstractUriResolver@@@Z @ 237 NONAME ; void QXmlQuery::setUriResolver(class QAbstractUriResolver const *) + ?setUriResolver@QXmlSchema@@QAEXPBVQAbstractUriResolver@@@Z @ 238 NONAME ; void QXmlSchema::setUriResolver(class QAbstractUriResolver const *) + ?setUriResolver@QXmlSchemaValidator@@QAEXPBVQAbstractUriResolver@@@Z @ 239 NONAME ; void QXmlSchemaValidator::setUriResolver(class QAbstractUriResolver const *) + ?sourceLocation@QAbstractXmlNodeModel@@QBE?AVQSourceLocation@@ABVQXmlNodeModelIndex@@@Z @ 240 NONAME ; class QSourceLocation QAbstractXmlNodeModel::sourceLocation(class QXmlNodeModelIndex const &) const + ?startContent@QXmlSerializer@@AAEXXZ @ 241 NONAME ; void QXmlSerializer::startContent(void) + ?startDocument@QXmlFormatter@@UAEXXZ @ 242 NONAME ; void QXmlFormatter::startDocument(void) + ?startDocument@QXmlSerializer@@UAEXXZ @ 243 NONAME ; void QXmlSerializer::startDocument(void) + ?startElement@QXmlFormatter@@UAEXABVQXmlName@@@Z @ 244 NONAME ; void QXmlFormatter::startElement(class QXmlName const &) + ?startElement@QXmlSerializer@@UAEXABVQXmlName@@@Z @ 245 NONAME ; void QXmlSerializer::startElement(class QXmlName const &) + ?startFormattingContent@QXmlFormatter@@AAEXXZ @ 246 NONAME ; void QXmlFormatter::startFormattingContent(void) + ?startOfSequence@QXmlFormatter@@UAEXXZ @ 247 NONAME ; void QXmlFormatter::startOfSequence(void) + ?startOfSequence@QXmlSerializer@@UAEXXZ @ 248 NONAME ; void QXmlSerializer::startOfSequence(void) + ?stringValue@QSimpleXmlNodeModel@@UBE?AVQString@@ABVQXmlNodeModelIndex@@@Z @ 249 NONAME ; class QString QSimpleXmlNodeModel::stringValue(class QXmlNodeModelIndex const &) const + ?stringValue@QXmlNodeModelIndex@@QBE?AVQString@@XZ @ 250 NONAME ; class QString QXmlNodeModelIndex::stringValue(void) const + ?toAtomicValue@QXmlItem@@QBE?AVQVariant@@XZ @ 251 NONAME ; class QVariant QXmlItem::toAtomicValue(void) const + ?toClarkName@QXmlName@@QBE?AVQString@@ABVQXmlNamePool@@@Z @ 252 NONAME ; class QString QXmlName::toClarkName(class QXmlNamePool const &) const + ?toNodeModelIndex@QXmlItem@@QBE?AVQXmlNodeModelIndex@@XZ @ 253 NONAME ; class QXmlNodeModelIndex QXmlItem::toNodeModelIndex(void) const + ?tr@QAbstractMessageHandler@@SA?AVQString@@PBD0@Z @ 254 NONAME ; class QString QAbstractMessageHandler::tr(char const *, char const *) + ?tr@QAbstractMessageHandler@@SA?AVQString@@PBD0H@Z @ 255 NONAME ; class QString QAbstractMessageHandler::tr(char const *, char const *, int) + ?tr@QAbstractUriResolver@@SA?AVQString@@PBD0@Z @ 256 NONAME ; class QString QAbstractUriResolver::tr(char const *, char const *) + ?tr@QAbstractUriResolver@@SA?AVQString@@PBD0H@Z @ 257 NONAME ; class QString QAbstractUriResolver::tr(char const *, char const *, int) + ?trUtf8@QAbstractMessageHandler@@SA?AVQString@@PBD0@Z @ 258 NONAME ; class QString QAbstractMessageHandler::trUtf8(char const *, char const *) + ?trUtf8@QAbstractMessageHandler@@SA?AVQString@@PBD0H@Z @ 259 NONAME ; class QString QAbstractMessageHandler::trUtf8(char const *, char const *, int) + ?trUtf8@QAbstractUriResolver@@SA?AVQString@@PBD0@Z @ 260 NONAME ; class QString QAbstractUriResolver::trUtf8(char const *, char const *) + ?trUtf8@QAbstractUriResolver@@SA?AVQString@@PBD0H@Z @ 261 NONAME ; class QString QAbstractUriResolver::trUtf8(char const *, char const *, int) + ?type@QAbstractXmlNodeModel@@UBE?AV?$QExplicitlySharedDataPointer@VItemType@QPatternist@@@@ABVQXmlNodeModelIndex@@@Z @ 262 NONAME ; class QExplicitlySharedDataPointer QAbstractXmlNodeModel::type(class QXmlNodeModelIndex const &) const + ?type@QXmlNodeModelIndex@@QBE?AV?$QExplicitlySharedDataPointer@VItemType@QPatternist@@@@XZ @ 263 NONAME ; class QExplicitlySharedDataPointer QXmlNodeModelIndex::type(void) const + ?uri@QSourceLocation@@QBE?AVQUrl@@XZ @ 264 NONAME ; class QUrl QSourceLocation::uri(void) const + ?uriResolver@QXmlQuery@@QBEPBVQAbstractUriResolver@@XZ @ 265 NONAME ; class QAbstractUriResolver const * QXmlQuery::uriResolver(void) const + ?uriResolver@QXmlSchema@@QBEPBVQAbstractUriResolver@@XZ @ 266 NONAME ; class QAbstractUriResolver const * QXmlSchema::uriResolver(void) const + ?uriResolver@QXmlSchemaValidator@@QBEPBVQAbstractUriResolver@@XZ @ 267 NONAME ; class QAbstractUriResolver const * QXmlSchemaValidator::uriResolver(void) const + ?validate@QXmlSchemaValidator@@QBE_NABVQByteArray@@ABVQUrl@@@Z @ 268 NONAME ; bool QXmlSchemaValidator::validate(class QByteArray const &, class QUrl const &) const + ?validate@QXmlSchemaValidator@@QBE_NABVQUrl@@@Z @ 269 NONAME ; bool QXmlSchemaValidator::validate(class QUrl const &) const + ?validate@QXmlSchemaValidator@@QBE_NPAVQIODevice@@ABVQUrl@@@Z @ 270 NONAME ; bool QXmlSchemaValidator::validate(class QIODevice *, class QUrl const &) const + ?whitespaceOnly@QAbstractXmlReceiver@@UAEXABVQStringRef@@@Z @ 271 NONAME ; void QAbstractXmlReceiver::whitespaceOnly(class QStringRef const &) + ?write@QXmlSerializer@@AAEXABVQString@@@Z @ 272 NONAME ; void QXmlSerializer::write(class QString const &) + ?write@QXmlSerializer@@AAEXABVQXmlName@@@Z @ 273 NONAME ; void QXmlSerializer::write(class QXmlName const &) + ?write@QXmlSerializer@@AAEXPBD@Z @ 274 NONAME ; void QXmlSerializer::write(char const *) + ?writeEscaped@QXmlSerializer@@AAEXABVQString@@@Z @ 275 NONAME ; void QXmlSerializer::writeEscaped(class QString const &) + ?writeEscapedAttribute@QXmlSerializer@@AAEXABVQString@@@Z @ 276 NONAME ; void QXmlSerializer::writeEscapedAttribute(class QString const &) + ?staticMetaObject@QAbstractMessageHandler@@2UQMetaObject@@B @ 277 NONAME ; struct QMetaObject const QAbstractMessageHandler::staticMetaObject + ?staticMetaObject@QAbstractUriResolver@@2UQMetaObject@@B @ 278 NONAME ; struct QMetaObject const QAbstractUriResolver::staticMetaObject + diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 2ecc48f..487d989 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -2136,7 +2136,7 @@ EXPORTS _ZN9QHashData11shared_nullE @ 2135 NONAME DATA 32 _ZN9QHashData12allocateNodeEv @ 2136 NONAME _ZN9QHashData12previousNodeEPNS_4NodeE @ 2137 NONAME - _ZN9QHashData13detach_helperEPFvPNS_4NodeEPvEPFvS1_Ei @ 2138 NONAME + _ZN9QHashData13detach_helperEPFvPNS_4NodeEPvEPFvS1_Ei @ 2138 NONAME ABSENT _ZN9QHashData13detach_helperEPFvPNS_4NodeEPvEi @ 2139 NONAME _ZN9QHashData14destroyAndFreeEv @ 2140 NONAME _ZN9QHashData6rehashEi @ 2141 NONAME @@ -3577,4 +3577,27 @@ EXPORTS uncompress @ 3576 NONAME zError @ 3577 NONAME zlibVersion @ 3578 NONAME + _Z12qFreeAlignedPv @ 3579 NONAME + _Z14qMallocAlignedjj @ 3580 NONAME + _Z15qReallocAlignedPvjjj @ 3581 NONAME + _ZN11QVectorData10reallocateEPS_iii @ 3582 NONAME + _ZN11QVectorData4freeEPS_i @ 3583 NONAME + _ZN11QVectorData8allocateEii @ 3584 NONAME + _ZN12QLibraryInfo9buildDateEv @ 3585 NONAME + _ZN20QContiguousCacheData4freeEPS_ @ 3586 NONAME + _ZN20QContiguousCacheData8allocateEii @ 3587 NONAME + _ZN20QStateMachinePrivate12toFinalStateEP14QAbstractState @ 3588 NONAME + _ZN20QStateMachinePrivate14toHistoryStateEP14QAbstractState @ 3589 NONAME + _ZN20QStateMachinePrivate15toStandardStateEP14QAbstractState @ 3590 NONAME + _ZN20QStateMachinePrivate15toStandardStateEPK14QAbstractState @ 3591 NONAME + _ZN20QStateMachinePrivate17postExternalEventEP6QEvent @ 3592 NONAME + _ZN20QStateMachinePrivate17postInternalEventEP6QEvent @ 3593 NONAME + _ZN20QStateMachinePrivate20dequeueExternalEventEv @ 3594 NONAME + _ZN20QStateMachinePrivate20dequeueInternalEventEv @ 3595 NONAME + _ZN20QStateMachinePrivate25isExternalEventQueueEmptyEv @ 3596 NONAME + _ZN20QStateMachinePrivate25isInternalEventQueueEmptyEv @ 3597 NONAME + _ZN8QMapData10createDataEi @ 3598 NONAME + _ZN8QMapData11node_createEPPNS_4NodeEii @ 3599 NONAME + _ZN9QHashData12allocateNodeEi @ 3600 NONAME + _ZN9QHashData14detach_helper2EPFvPNS_4NodeEPvEPFvS1_Eii @ 3601 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 2d1c42f..bf1908a 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4060,7 +4060,7 @@ EXPORTS _ZN17QPixmapBlurFilter11setBlurHintEN2Qt10RenderHintE @ 4059 NONAME _ZN17QPixmapBlurFilter16staticMetaObjectE @ 4060 NONAME DATA 16 _ZN17QPixmapBlurFilter19getStaticMetaObjectEv @ 4061 NONAME - _ZN17QPixmapBlurFilter9setRadiusEi @ 4062 NONAME + _ZN17QPixmapBlurFilter9setRadiusEi @ 4062 NONAME ABSENT _ZN17QPixmapBlurFilterC1EP7QObject @ 4063 NONAME _ZN17QPixmapBlurFilterC2EP7QObject @ 4064 NONAME _ZN17QPixmapBlurFilterD0Ev @ 4065 NONAME @@ -4412,10 +4412,10 @@ EXPORTS _ZN19QGraphicsBlurEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 4411 NONAME _ZN19QGraphicsBlurEffect11qt_metacastEPKc @ 4412 NONAME _ZN19QGraphicsBlurEffect11setBlurHintEN2Qt10RenderHintE @ 4413 NONAME - _ZN19QGraphicsBlurEffect13setBlurRadiusEi @ 4414 NONAME + _ZN19QGraphicsBlurEffect13setBlurRadiusEi @ 4414 NONAME ABSENT _ZN19QGraphicsBlurEffect15blurHintChangedEN2Qt10RenderHintE @ 4415 NONAME _ZN19QGraphicsBlurEffect16staticMetaObjectE @ 4416 NONAME DATA 16 - _ZN19QGraphicsBlurEffect17blurRadiusChangedEi @ 4417 NONAME + _ZN19QGraphicsBlurEffect17blurRadiusChangedEi @ 4417 NONAME ABSENT _ZN19QGraphicsBlurEffect19getStaticMetaObjectEv @ 4418 NONAME _ZN19QGraphicsBlurEffect4drawEP8QPainterP21QGraphicsEffectSource @ 4419 NONAME _ZN19QGraphicsBlurEffectC1EP7QObject @ 4420 NONAME @@ -4625,24 +4625,24 @@ EXPORTS _ZN19QToolBarChangeEventD0Ev @ 4624 NONAME _ZN19QToolBarChangeEventD1Ev @ 4625 NONAME _ZN19QToolBarChangeEventD2Ev @ 4626 NONAME - _ZN20QGraphicsBloomEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 4627 NONAME - _ZN20QGraphicsBloomEffect11qt_metacastEPKc @ 4628 NONAME - _ZN20QGraphicsBloomEffect11setBlurHintEN2Qt10RenderHintE @ 4629 NONAME - _ZN20QGraphicsBloomEffect11setStrengthEf @ 4630 NONAME - _ZN20QGraphicsBloomEffect13setBlurRadiusEi @ 4631 NONAME - _ZN20QGraphicsBloomEffect13setBrightnessEi @ 4632 NONAME - _ZN20QGraphicsBloomEffect15blurHintChangedEN2Qt10RenderHintE @ 4633 NONAME - _ZN20QGraphicsBloomEffect15strengthChangedEf @ 4634 NONAME - _ZN20QGraphicsBloomEffect16staticMetaObjectE @ 4635 NONAME DATA 16 - _ZN20QGraphicsBloomEffect17blurRadiusChangedEi @ 4636 NONAME - _ZN20QGraphicsBloomEffect17brightnessChangedEi @ 4637 NONAME - _ZN20QGraphicsBloomEffect19getStaticMetaObjectEv @ 4638 NONAME - _ZN20QGraphicsBloomEffect4drawEP8QPainterP21QGraphicsEffectSource @ 4639 NONAME - _ZN20QGraphicsBloomEffectC1EP7QObject @ 4640 NONAME - _ZN20QGraphicsBloomEffectC2EP7QObject @ 4641 NONAME - _ZN20QGraphicsBloomEffectD0Ev @ 4642 NONAME - _ZN20QGraphicsBloomEffectD1Ev @ 4643 NONAME - _ZN20QGraphicsBloomEffectD2Ev @ 4644 NONAME + _ZN20QGraphicsBloomEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 4627 NONAME ABSENT + _ZN20QGraphicsBloomEffect11qt_metacastEPKc @ 4628 NONAME ABSENT + _ZN20QGraphicsBloomEffect11setBlurHintEN2Qt10RenderHintE @ 4629 NONAME ABSENT + _ZN20QGraphicsBloomEffect11setStrengthEf @ 4630 NONAME ABSENT + _ZN20QGraphicsBloomEffect13setBlurRadiusEi @ 4631 NONAME ABSENT + _ZN20QGraphicsBloomEffect13setBrightnessEi @ 4632 NONAME ABSENT + _ZN20QGraphicsBloomEffect15blurHintChangedEN2Qt10RenderHintE @ 4633 NONAME ABSENT + _ZN20QGraphicsBloomEffect15strengthChangedEf @ 4634 NONAME ABSENT + _ZN20QGraphicsBloomEffect16staticMetaObjectE @ 4635 NONAME DATA 16 ABSENT + _ZN20QGraphicsBloomEffect17blurRadiusChangedEi @ 4636 NONAME ABSENT + _ZN20QGraphicsBloomEffect17brightnessChangedEi @ 4637 NONAME ABSENT + _ZN20QGraphicsBloomEffect19getStaticMetaObjectEv @ 4638 NONAME ABSENT + _ZN20QGraphicsBloomEffect4drawEP8QPainterP21QGraphicsEffectSource @ 4639 NONAME ABSENT + _ZN20QGraphicsBloomEffectC1EP7QObject @ 4640 NONAME ABSENT + _ZN20QGraphicsBloomEffectC2EP7QObject @ 4641 NONAME ABSENT + _ZN20QGraphicsBloomEffectD0Ev @ 4642 NONAME ABSENT + _ZN20QGraphicsBloomEffectD1Ev @ 4643 NONAME ABSENT + _ZN20QGraphicsBloomEffectD2Ev @ 4644 NONAME ABSENT _ZN20QGraphicsEllipseItem12setExtensionEN13QGraphicsItem9ExtensionERK8QVariant @ 4645 NONAME _ZN20QGraphicsEllipseItem12setSpanAngleEi @ 4646 NONAME _ZN20QGraphicsEllipseItem13setStartAngleEi @ 4647 NONAME @@ -5082,18 +5082,18 @@ EXPORTS _ZN23QGraphicsColorizeEffectD0Ev @ 5081 NONAME _ZN23QGraphicsColorizeEffectD1Ev @ 5082 NONAME _ZN23QGraphicsColorizeEffectD2Ev @ 5083 NONAME - _ZN23QGraphicsPixelizeEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 5084 NONAME - _ZN23QGraphicsPixelizeEffect11qt_metacastEPKc @ 5085 NONAME - _ZN23QGraphicsPixelizeEffect12setPixelSizeEi @ 5086 NONAME - _ZN23QGraphicsPixelizeEffect16pixelSizeChangedEi @ 5087 NONAME - _ZN23QGraphicsPixelizeEffect16staticMetaObjectE @ 5088 NONAME DATA 16 - _ZN23QGraphicsPixelizeEffect19getStaticMetaObjectEv @ 5089 NONAME - _ZN23QGraphicsPixelizeEffect4drawEP8QPainterP21QGraphicsEffectSource @ 5090 NONAME - _ZN23QGraphicsPixelizeEffectC1EP7QObject @ 5091 NONAME - _ZN23QGraphicsPixelizeEffectC2EP7QObject @ 5092 NONAME - _ZN23QGraphicsPixelizeEffectD0Ev @ 5093 NONAME - _ZN23QGraphicsPixelizeEffectD1Ev @ 5094 NONAME - _ZN23QGraphicsPixelizeEffectD2Ev @ 5095 NONAME + _ZN23QGraphicsPixelizeEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 5084 NONAME ABSENT + _ZN23QGraphicsPixelizeEffect11qt_metacastEPKc @ 5085 NONAME ABSENT + _ZN23QGraphicsPixelizeEffect12setPixelSizeEi @ 5086 NONAME ABSENT + _ZN23QGraphicsPixelizeEffect16pixelSizeChangedEi @ 5087 NONAME ABSENT + _ZN23QGraphicsPixelizeEffect16staticMetaObjectE @ 5088 NONAME DATA 16 ABSENT + _ZN23QGraphicsPixelizeEffect19getStaticMetaObjectEv @ 5089 NONAME ABSENT + _ZN23QGraphicsPixelizeEffect4drawEP8QPainterP21QGraphicsEffectSource @ 5090 NONAME ABSENT + _ZN23QGraphicsPixelizeEffectC1EP7QObject @ 5091 NONAME ABSENT + _ZN23QGraphicsPixelizeEffectC2EP7QObject @ 5092 NONAME ABSENT + _ZN23QGraphicsPixelizeEffectD0Ev @ 5093 NONAME ABSENT + _ZN23QGraphicsPixelizeEffectD1Ev @ 5094 NONAME ABSENT + _ZN23QGraphicsPixelizeEffectD2Ev @ 5095 NONAME ABSENT _ZN23QGraphicsSceneHelpEvent11setScenePosERK7QPointF @ 5096 NONAME _ZN23QGraphicsSceneHelpEvent12setScreenPosERK6QPoint @ 5097 NONAME _ZN23QGraphicsSceneHelpEventC1EN6QEvent4TypeE @ 5098 NONAME @@ -5127,7 +5127,7 @@ EXPORTS _ZN23QPaintBufferSignalProxy8instanceEv @ 5126 NONAME _ZN23QPixmapDropShadowFilter11qt_metacallEN11QMetaObject4CallEiPPv @ 5127 NONAME _ZN23QPixmapDropShadowFilter11qt_metacastEPKc @ 5128 NONAME - _ZN23QPixmapDropShadowFilter13setBlurRadiusEi @ 5129 NONAME + _ZN23QPixmapDropShadowFilter13setBlurRadiusEi @ 5129 NONAME ABSENT _ZN23QPixmapDropShadowFilter16staticMetaObjectE @ 5130 NONAME DATA 16 _ZN23QPixmapDropShadowFilter19getStaticMetaObjectEv @ 5131 NONAME _ZN23QPixmapDropShadowFilter8setColorERK6QColor @ 5132 NONAME @@ -5161,18 +5161,18 @@ EXPORTS _ZN23QWindowStateChangeEventD0Ev @ 5160 NONAME _ZN23QWindowStateChangeEventD1Ev @ 5161 NONAME _ZN23QWindowStateChangeEventD2Ev @ 5162 NONAME - _ZN24QGraphicsGrayscaleEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 5163 NONAME - _ZN24QGraphicsGrayscaleEffect11qt_metacastEPKc @ 5164 NONAME - _ZN24QGraphicsGrayscaleEffect11setStrengthEf @ 5165 NONAME - _ZN24QGraphicsGrayscaleEffect15strengthChangedEf @ 5166 NONAME - _ZN24QGraphicsGrayscaleEffect16staticMetaObjectE @ 5167 NONAME DATA 16 - _ZN24QGraphicsGrayscaleEffect19getStaticMetaObjectEv @ 5168 NONAME - _ZN24QGraphicsGrayscaleEffect4drawEP8QPainterP21QGraphicsEffectSource @ 5169 NONAME - _ZN24QGraphicsGrayscaleEffectC1EP7QObject @ 5170 NONAME - _ZN24QGraphicsGrayscaleEffectC2EP7QObject @ 5171 NONAME - _ZN24QGraphicsGrayscaleEffectD0Ev @ 5172 NONAME - _ZN24QGraphicsGrayscaleEffectD1Ev @ 5173 NONAME - _ZN24QGraphicsGrayscaleEffectD2Ev @ 5174 NONAME + _ZN24QGraphicsGrayscaleEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 5163 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffect11qt_metacastEPKc @ 5164 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffect11setStrengthEf @ 5165 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffect15strengthChangedEf @ 5166 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffect16staticMetaObjectE @ 5167 NONAME DATA 16 ABSENT + _ZN24QGraphicsGrayscaleEffect19getStaticMetaObjectEv @ 5168 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffect4drawEP8QPainterP21QGraphicsEffectSource @ 5169 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffectC1EP7QObject @ 5170 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffectC2EP7QObject @ 5171 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffectD0Ev @ 5172 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffectD1Ev @ 5173 NONAME ABSENT + _ZN24QGraphicsGrayscaleEffectD2Ev @ 5174 NONAME ABSENT _ZN24QGraphicsSceneHoverEvent10setLastPosERK7QPointF @ 5175 NONAME _ZN24QGraphicsSceneHoverEvent11setScenePosERK7QPointF @ 5176 NONAME _ZN24QGraphicsSceneHoverEvent12setModifiersE6QFlagsIN2Qt16KeyboardModifierEE @ 5177 NONAME @@ -5276,9 +5276,9 @@ EXPORTS _ZN25QGraphicsDropShadowEffect11qt_metacastEPKc @ 5275 NONAME _ZN25QGraphicsDropShadowEffect12colorChangedERK6QColor @ 5276 NONAME _ZN25QGraphicsDropShadowEffect13offsetChangedERK7QPointF @ 5277 NONAME - _ZN25QGraphicsDropShadowEffect13setBlurRadiusEi @ 5278 NONAME + _ZN25QGraphicsDropShadowEffect13setBlurRadiusEi @ 5278 NONAME ABSENT _ZN25QGraphicsDropShadowEffect16staticMetaObjectE @ 5279 NONAME DATA 16 - _ZN25QGraphicsDropShadowEffect17blurRadiusChangedEi @ 5280 NONAME + _ZN25QGraphicsDropShadowEffect17blurRadiusChangedEi @ 5280 NONAME ABSENT _ZN25QGraphicsDropShadowEffect19getStaticMetaObjectEv @ 5281 NONAME _ZN25QGraphicsDropShadowEffect4drawEP8QPainterP21QGraphicsEffectSource @ 5282 NONAME _ZN25QGraphicsDropShadowEffect8setColorERK6QColor @ 5283 NONAME @@ -8817,7 +8817,7 @@ EXPORTS _ZNK14QWidgetPrivate13isAboutToShowEv @ 8816 NONAME _ZNK14QWidgetPrivate13paintOnScreenEv @ 8817 NONAME _ZNK14QWidgetPrivate14childAt_helperERK6QPointb @ 8818 NONAME - _ZNK14QWidgetPrivate15getOpaqueRegionEv @ 8819 NONAME + _ZNK14QWidgetPrivate15getOpaqueRegionEv @ 8819 NONAME ABSENT _ZNK14QWidgetPrivate15paintBackgroundEP8QPainterRK7QRegioni @ 8820 NONAME _ZNK14QWidgetPrivate17getOpaqueChildrenEv @ 8821 NONAME _ZNK14QWidgetPrivate17naturalWidgetFontEj @ 8822 NONAME @@ -9366,12 +9366,12 @@ EXPORTS _ZNK19QTextDocumentWriter6deviceEv @ 9365 NONAME _ZNK19QTextDocumentWriter6formatEv @ 9366 NONAME _ZNK19QTextDocumentWriter8fileNameEv @ 9367 NONAME - _ZNK20QGraphicsBloomEffect10blurRadiusEv @ 9368 NONAME - _ZNK20QGraphicsBloomEffect10brightnessEv @ 9369 NONAME - _ZNK20QGraphicsBloomEffect10metaObjectEv @ 9370 NONAME - _ZNK20QGraphicsBloomEffect15boundingRectForERK6QRectF @ 9371 NONAME - _ZNK20QGraphicsBloomEffect8blurHintEv @ 9372 NONAME - _ZNK20QGraphicsBloomEffect8strengthEv @ 9373 NONAME + _ZNK20QGraphicsBloomEffect10blurRadiusEv @ 9368 NONAME ABSENT + _ZNK20QGraphicsBloomEffect10brightnessEv @ 9369 NONAME ABSENT + _ZNK20QGraphicsBloomEffect10metaObjectEv @ 9370 NONAME ABSENT + _ZNK20QGraphicsBloomEffect15boundingRectForERK6QRectF @ 9371 NONAME ABSENT + _ZNK20QGraphicsBloomEffect8blurHintEv @ 9372 NONAME ABSENT + _ZNK20QGraphicsBloomEffect8strengthEv @ 9373 NONAME ABSENT _ZNK20QGraphicsEllipseItem10opaqueAreaEv @ 9374 NONAME _ZNK20QGraphicsEllipseItem10startAngleEv @ 9375 NONAME _ZNK20QGraphicsEllipseItem12boundingRectEv @ 9376 NONAME @@ -9429,7 +9429,7 @@ EXPORTS _ZNK21QGraphicsEffectSource11styleOptionEv @ 9428 NONAME _ZNK21QGraphicsEffectSource12boundingRectEN2Qt16CoordinateSystemE @ 9429 NONAME _ZNK21QGraphicsEffectSource12graphicsItemEv @ 9430 NONAME - _ZNK21QGraphicsEffectSource6pixmapEN2Qt16CoordinateSystemEP6QPoint @ 9431 NONAME + _ZNK21QGraphicsEffectSource6pixmapEN2Qt16CoordinateSystemEP6QPoint @ 9431 NONAME ABSENT _ZNK21QGraphicsEffectSource6widgetEv @ 9432 NONAME _ZNK21QGraphicsEffectSource8isPixmapEv @ 9433 NONAME _ZNK21QGraphicsLinearLayout11itemSpacingEi @ 9434 NONAME @@ -9514,8 +9514,8 @@ EXPORTS _ZNK23QGraphicsColorizeEffect10metaObjectEv @ 9513 NONAME _ZNK23QGraphicsColorizeEffect5colorEv @ 9514 NONAME _ZNK23QGraphicsColorizeEffect8strengthEv @ 9515 NONAME - _ZNK23QGraphicsPixelizeEffect10metaObjectEv @ 9516 NONAME - _ZNK23QGraphicsPixelizeEffect9pixelSizeEv @ 9517 NONAME + _ZNK23QGraphicsPixelizeEffect10metaObjectEv @ 9516 NONAME ABSENT + _ZNK23QGraphicsPixelizeEffect9pixelSizeEv @ 9517 NONAME ABSENT _ZNK23QGraphicsSceneHelpEvent8scenePosEv @ 9518 NONAME _ZNK23QGraphicsSceneHelpEvent9screenPosEv @ 9519 NONAME _ZNK23QGraphicsSceneMoveEvent6newPosEv @ 9520 NONAME @@ -9539,8 +9539,8 @@ EXPORTS _ZNK23QPixmapDropShadowFilter6offsetEv @ 9538 NONAME _ZNK23QTreeWidgetItemIterator12matchesFlagsEPK15QTreeWidgetItem @ 9539 NONAME _ZNK23QWindowStateChangeEvent10isOverrideEv @ 9540 NONAME - _ZNK24QGraphicsGrayscaleEffect10metaObjectEv @ 9541 NONAME - _ZNK24QGraphicsGrayscaleEffect8strengthEv @ 9542 NONAME + _ZNK24QGraphicsGrayscaleEffect10metaObjectEv @ 9541 NONAME ABSENT + _ZNK24QGraphicsGrayscaleEffect8strengthEv @ 9542 NONAME ABSENT _ZNK24QGraphicsSceneHoverEvent12lastScenePosEv @ 9543 NONAME _ZNK24QGraphicsSceneHoverEvent13lastScreenPosEv @ 9544 NONAME _ZNK24QGraphicsSceneHoverEvent3posEv @ 9545 NONAME @@ -10788,7 +10788,7 @@ EXPORTS _ZTI19QS60MainApplication @ 10787 NONAME _ZTI19QStyledItemDelegate @ 10788 NONAME _ZTI19QToolBarChangeEvent @ 10789 NONAME - _ZTI20QGraphicsBloomEffect @ 10790 NONAME + _ZTI20QGraphicsBloomEffect @ 10790 NONAME ABSENT _ZTI20QGraphicsEllipseItem @ 10791 NONAME _ZTI20QGraphicsItemPrivate @ 10792 NONAME _ZTI20QGraphicsPolygonItem @ 10793 NONAME @@ -10815,7 +10815,7 @@ EXPORTS _ZTI22QStyleFactoryInterface @ 10814 NONAME _ZTI22QWhatsThisClickedEvent @ 10815 NONAME _ZTI23QGraphicsColorizeEffect @ 10816 NONAME - _ZTI23QGraphicsPixelizeEffect @ 10817 NONAME + _ZTI23QGraphicsPixelizeEffect @ 10817 NONAME ABSENT _ZTI23QGraphicsSceneHelpEvent @ 10818 NONAME _ZTI23QGraphicsSceneMoveEvent @ 10819 NONAME _ZTI23QGraphicsSimpleTextItem @ 10820 NONAME @@ -10823,7 +10823,7 @@ EXPORTS _ZTI23QPictureFormatInterface @ 10822 NONAME _ZTI23QPixmapDropShadowFilter @ 10823 NONAME _ZTI23QWindowStateChangeEvent @ 10824 NONAME - _ZTI24QGraphicsGrayscaleEffect @ 10825 NONAME + _ZTI24QGraphicsGrayscaleEffect @ 10825 NONAME ABSENT _ZTI24QGraphicsSceneHoverEvent @ 10826 NONAME _ZTI24QGraphicsSceneMouseEvent @ 10827 NONAME _ZTI24QGraphicsSceneWheelEvent @ 10828 NONAME @@ -11070,7 +11070,7 @@ EXPORTS _ZTV19QS60MainApplication @ 11069 NONAME _ZTV19QStyledItemDelegate @ 11070 NONAME _ZTV19QToolBarChangeEvent @ 11071 NONAME - _ZTV20QGraphicsBloomEffect @ 11072 NONAME + _ZTV20QGraphicsBloomEffect @ 11072 NONAME ABSENT _ZTV20QGraphicsEllipseItem @ 11073 NONAME _ZTV20QGraphicsItemPrivate @ 11074 NONAME _ZTV20QGraphicsPolygonItem @ 11075 NONAME @@ -11095,14 +11095,14 @@ EXPORTS _ZTV22QPaintEngineExReplayer @ 11094 NONAME _ZTV22QWhatsThisClickedEvent @ 11095 NONAME _ZTV23QGraphicsColorizeEffect @ 11096 NONAME - _ZTV23QGraphicsPixelizeEffect @ 11097 NONAME + _ZTV23QGraphicsPixelizeEffect @ 11097 NONAME ABSENT _ZTV23QGraphicsSceneHelpEvent @ 11098 NONAME _ZTV23QGraphicsSceneMoveEvent @ 11099 NONAME _ZTV23QGraphicsSimpleTextItem @ 11100 NONAME _ZTV23QPaintBufferSignalProxy @ 11101 NONAME _ZTV23QPixmapDropShadowFilter @ 11102 NONAME _ZTV23QWindowStateChangeEvent @ 11103 NONAME - _ZTV24QGraphicsGrayscaleEffect @ 11104 NONAME + _ZTV24QGraphicsGrayscaleEffect @ 11104 NONAME ABSENT _ZTV24QGraphicsSceneHoverEvent @ 11105 NONAME _ZTV24QGraphicsSceneMouseEvent @ 11106 NONAME _ZTV24QGraphicsSceneWheelEvent @ 11107 NONAME @@ -11635,4 +11635,29 @@ EXPORTS _ZNK11QTextEngine10fontEngineERK11QScriptItemP6QFixedS4_S4_ @ 11634 NONAME _ZNK9QTextLine15leadingIncludedEv @ 11635 NONAME _ZNK9QTextLine7leadingEv @ 11636 NONAME + _ZN11QVectorPath12addCacheDataEP14QPaintEngineExPvPFvS2_E @ 11637 NONAME + _ZN13QGestureEvent11setAcceptedEN2Qt11GestureTypeEb @ 11638 NONAME + _ZN13QGestureEvent6acceptEN2Qt11GestureTypeE @ 11639 NONAME + _ZN13QGestureEvent6ignoreEN2Qt11GestureTypeE @ 11640 NONAME + _ZN17QPixmapBlurFilter9setRadiusEf @ 11641 NONAME + _ZN19QGraphicsBlurEffect13setBlurRadiusEf @ 11642 NONAME + _ZN19QGraphicsBlurEffect17blurRadiusChangedEf @ 11643 NONAME + _ZN23QPixmapDropShadowFilter13setBlurRadiusEf @ 11644 NONAME + _ZN25QGraphicsDropShadowEffect13setBlurRadiusEf @ 11645 NONAME + _ZN25QGraphicsDropShadowEffect17blurRadiusChangedEf @ 11646 NONAME + _ZN28QStyleOptionTabWidgetFrameV2C1ERK26QStyleOptionTabWidgetFrame @ 11647 NONAME + _ZN28QStyleOptionTabWidgetFrameV2C1Ei @ 11648 NONAME + _ZN28QStyleOptionTabWidgetFrameV2C1Ev @ 11649 NONAME + _ZN28QStyleOptionTabWidgetFrameV2C2ERK26QStyleOptionTabWidgetFrame @ 11650 NONAME + _ZN28QStyleOptionTabWidgetFrameV2C2Ei @ 11651 NONAME + _ZN28QStyleOptionTabWidgetFrameV2C2Ev @ 11652 NONAME + _ZN28QStyleOptionTabWidgetFrameV2aSERK26QStyleOptionTabWidgetFrame @ 11653 NONAME + _ZN7QWidget13ungrabGestureEN2Qt11GestureTypeE @ 11654 NONAME + _ZN8QGesture22setGestureCancelPolicyENS_19GestureCancelPolicyE @ 11655 NONAME + _ZN8QToolBar15topLevelChangedEb @ 11656 NONAME + _ZNK13QGestureEvent10isAcceptedEN2Qt11GestureTypeE @ 11657 NONAME + _ZNK13QTextDocument18availableRedoStepsEv @ 11658 NONAME + _ZNK13QTextDocument18availableUndoStepsEv @ 11659 NONAME + _ZNK21QGraphicsEffectSource6pixmapEN2Qt16CoordinateSystemEP6QPointNS_13PixmapPadModeE @ 11660 NONAME + _ZNK8QGesture19gestureCancelPolicyEv @ 11661 NONAME diff --git a/src/s60installs/eabi/QtScriptu.def b/src/s60installs/eabi/QtScriptu.def index 1592664..1e81977 100644 --- a/src/s60installs/eabi/QtScriptu.def +++ b/src/s60installs/eabi/QtScriptu.def @@ -342,4 +342,21 @@ EXPORTS _ZlsR11QDataStreamRK18QScriptContextInfo @ 341 NONAME _ZrsR11QDataStreamR18QScriptContextInfo @ 342 NONAME _Z5qHashRK13QScriptString @ 343 NONAME + _ZN13QScriptEngine8evaluateERK14QScriptProgram @ 344 NONAME + _ZN14QScriptProgramC1ERK7QStringS0_i @ 345 NONAME + _ZN14QScriptProgramC1ERKS_ @ 346 NONAME + _ZN14QScriptProgramC1Ev @ 347 NONAME + _ZN14QScriptProgramC2ERK7QStringS0_i @ 348 NONAME + _ZN14QScriptProgramC2ERKS_ @ 349 NONAME + _ZN14QScriptProgramC2Ev @ 350 NONAME + _ZN14QScriptProgramD1Ev @ 351 NONAME + _ZN14QScriptProgramD2Ev @ 352 NONAME + _ZN14QScriptProgramaSERKS_ @ 353 NONAME + _ZNK13QScriptString12toArrayIndexEPb @ 354 NONAME + _ZNK14QScriptProgram10sourceCodeEv @ 355 NONAME + _ZNK14QScriptProgram15firstLineNumberEv @ 356 NONAME + _ZNK14QScriptProgram6isNullEv @ 357 NONAME + _ZNK14QScriptProgram8fileNameEv @ 358 NONAME + _ZNK14QScriptProgrameqERKS_ @ 359 NONAME + _ZNK14QScriptProgramneERKS_ @ 360 NONAME diff --git a/src/s60installs/eabi/QtXmlPatternsu.def b/src/s60installs/eabi/QtXmlPatternsu.def new file mode 100644 index 0000000..5168c39 --- /dev/null +++ b/src/s60installs/eabi/QtXmlPatternsu.def @@ -0,0 +1,253 @@ +EXPORTS + _Z5qHashRK15QSourceLocation @ 1 NONAME + _Z5qHashRK18QXmlNodeModelIndex @ 2 NONAME + _Z5qHashRK8QXmlName @ 3 NONAME + _ZN10QXmlSchema14setUriResolverEPK20QAbstractUriResolver @ 4 NONAME + _ZN10QXmlSchema17setMessageHandlerEP23QAbstractMessageHandler @ 5 NONAME + _ZN10QXmlSchema23setNetworkAccessManagerEP21QNetworkAccessManager @ 6 NONAME + _ZN10QXmlSchema4loadEP9QIODeviceRK4QUrl @ 7 NONAME + _ZN10QXmlSchema4loadERK10QByteArrayRK4QUrl @ 8 NONAME + _ZN10QXmlSchema4loadERK4QUrl @ 9 NONAME + _ZN10QXmlSchemaC1ERKS_ @ 10 NONAME + _ZN10QXmlSchemaC1Ev @ 11 NONAME + _ZN10QXmlSchemaC2ERKS_ @ 12 NONAME + _ZN10QXmlSchemaC2Ev @ 13 NONAME + _ZN10QXmlSchemaD1Ev @ 14 NONAME + _ZN10QXmlSchemaD2Ev @ 15 NONAME + _ZN12QXmlNamePoolC1EPN11QPatternist8NamePoolE @ 16 NONAME + _ZN12QXmlNamePoolC1ERKS_ @ 17 NONAME + _ZN12QXmlNamePoolC1Ev @ 18 NONAME + _ZN12QXmlNamePoolC2EPN11QPatternist8NamePoolE @ 19 NONAME + _ZN12QXmlNamePoolC2ERKS_ @ 20 NONAME + _ZN12QXmlNamePoolC2Ev @ 21 NONAME + _ZN12QXmlNamePoolD1Ev @ 22 NONAME + _ZN12QXmlNamePoolD2Ev @ 23 NONAME + _ZN12QXmlNamePoolaSERKS_ @ 24 NONAME + _ZN13QXmlFormatter10charactersERK10QStringRef @ 25 NONAME + _ZN13QXmlFormatter10endElementEv @ 26 NONAME + _ZN13QXmlFormatter11atomicValueERK8QVariant @ 27 NONAME + _ZN13QXmlFormatter11endDocumentEv @ 28 NONAME + _ZN13QXmlFormatter12startElementERK8QXmlName @ 29 NONAME + _ZN13QXmlFormatter13endOfSequenceEv @ 30 NONAME + _ZN13QXmlFormatter13startDocumentEv @ 31 NONAME + _ZN13QXmlFormatter15startOfSequenceEv @ 32 NONAME + _ZN13QXmlFormatter19setIndentationDepthEi @ 33 NONAME + _ZN13QXmlFormatter21processingInstructionERK8QXmlNameRK7QString @ 34 NONAME + _ZN13QXmlFormatter4itemERKN11QPatternist4ItemE @ 35 NONAME + _ZN13QXmlFormatter7commentERK7QString @ 36 NONAME + _ZN13QXmlFormatter9attributeERK8QXmlNameRK10QStringRef @ 37 NONAME + _ZN13QXmlFormatterC1ERK9QXmlQueryP9QIODevice @ 38 NONAME + _ZN13QXmlFormatterC2ERK9QXmlQueryP9QIODevice @ 39 NONAME + _ZN14QXmlSerializer10charactersERK10QStringRef @ 40 NONAME + _ZN14QXmlSerializer10endElementEv @ 41 NONAME + _ZN14QXmlSerializer11atomicValueERK8QVariant @ 42 NONAME + _ZN14QXmlSerializer11endDocumentEv @ 43 NONAME + _ZN14QXmlSerializer12startElementERK8QXmlName @ 44 NONAME + _ZN14QXmlSerializer12writeEscapedERK7QString @ 45 NONAME + _ZN14QXmlSerializer13endOfSequenceEv @ 46 NONAME + _ZN14QXmlSerializer13startDocumentEv @ 47 NONAME + _ZN14QXmlSerializer15startOfSequenceEv @ 48 NONAME + _ZN14QXmlSerializer16namespaceBindingERK8QXmlName @ 49 NONAME + _ZN14QXmlSerializer21processingInstructionERK8QXmlNameRK7QString @ 50 NONAME + _ZN14QXmlSerializer4itemERKN11QPatternist4ItemE @ 51 NONAME + _ZN14QXmlSerializer7commentERK7QString @ 52 NONAME + _ZN14QXmlSerializer8setCodecEPK10QTextCodec @ 53 NONAME + _ZN14QXmlSerializer9attributeERK8QXmlNameRK10QStringRef @ 54 NONAME + _ZN14QXmlSerializerC1EP27QAbstractXmlReceiverPrivate @ 55 NONAME + _ZN14QXmlSerializerC1ERK9QXmlQueryP9QIODevice @ 56 NONAME + _ZN14QXmlSerializerC2EP27QAbstractXmlReceiverPrivate @ 57 NONAME + _ZN14QXmlSerializerC2ERK9QXmlQueryP9QIODevice @ 58 NONAME + _ZN15QSourceLocation6setUriERK4QUrl @ 59 NONAME + _ZN15QSourceLocation7setLineEx @ 60 NONAME + _ZN15QSourceLocation9setColumnEx @ 61 NONAME + _ZN15QSourceLocationC1ERK4QUrlii @ 62 NONAME + _ZN15QSourceLocationC1ERKS_ @ 63 NONAME + _ZN15QSourceLocationC1Ev @ 64 NONAME + _ZN15QSourceLocationC2ERK4QUrlii @ 65 NONAME + _ZN15QSourceLocationC2ERKS_ @ 66 NONAME + _ZN15QSourceLocationC2Ev @ 67 NONAME + _ZN15QSourceLocationD1Ev @ 68 NONAME + _ZN15QSourceLocationD2Ev @ 69 NONAME + _ZN15QSourceLocationaSERKS_ @ 70 NONAME + _ZN15QXmlResultItems4nextEv @ 71 NONAME + _ZN15QXmlResultItemsC1Ev @ 72 NONAME + _ZN15QXmlResultItemsC2Ev @ 73 NONAME + _ZN15QXmlResultItemsD0Ev @ 74 NONAME + _ZN15QXmlResultItemsD1Ev @ 75 NONAME + _ZN15QXmlResultItemsD2Ev @ 76 NONAME + _ZN19QSimpleXmlNodeModelC2ERK12QXmlNamePool @ 77 NONAME + _ZN19QSimpleXmlNodeModelD0Ev @ 78 NONAME + _ZN19QSimpleXmlNodeModelD1Ev @ 79 NONAME + _ZN19QSimpleXmlNodeModelD2Ev @ 80 NONAME + _ZN19QXmlSchemaValidator14setUriResolverEPK20QAbstractUriResolver @ 81 NONAME + _ZN19QXmlSchemaValidator17setMessageHandlerEP23QAbstractMessageHandler @ 82 NONAME + _ZN19QXmlSchemaValidator23setNetworkAccessManagerEP21QNetworkAccessManager @ 83 NONAME + _ZN19QXmlSchemaValidator9setSchemaERK10QXmlSchema @ 84 NONAME + _ZN19QXmlSchemaValidatorC1ERK10QXmlSchema @ 85 NONAME + _ZN19QXmlSchemaValidatorC1Ev @ 86 NONAME + _ZN19QXmlSchemaValidatorC2ERK10QXmlSchema @ 87 NONAME + _ZN19QXmlSchemaValidatorC2Ev @ 88 NONAME + _ZN19QXmlSchemaValidatorD1Ev @ 89 NONAME + _ZN19QXmlSchemaValidatorD2Ev @ 90 NONAME + _ZN20QAbstractUriResolver11qt_metacallEN11QMetaObject4CallEiPPv @ 91 NONAME + _ZN20QAbstractUriResolver11qt_metacastEPKc @ 92 NONAME + _ZN20QAbstractUriResolver16staticMetaObjectE @ 93 NONAME DATA 16 + _ZN20QAbstractUriResolver19getStaticMetaObjectEv @ 94 NONAME + _ZN20QAbstractUriResolverC2EP7QObject @ 95 NONAME + _ZN20QAbstractUriResolverD0Ev @ 96 NONAME + _ZN20QAbstractUriResolverD1Ev @ 97 NONAME + _ZN20QAbstractUriResolverD2Ev @ 98 NONAME + _ZN20QAbstractXmlReceiver10sendAsNodeERKN11QPatternist4ItemE @ 99 NONAME + _ZN20QAbstractXmlReceiver14whitespaceOnlyERK10QStringRef @ 100 NONAME + _ZN20QAbstractXmlReceiver4itemERKN11QPatternist4ItemE @ 101 NONAME + _ZN20QAbstractXmlReceiverC2EP27QAbstractXmlReceiverPrivate @ 102 NONAME + _ZN20QAbstractXmlReceiverC2Ev @ 103 NONAME + _ZN20QAbstractXmlReceiverD0Ev @ 104 NONAME + _ZN20QAbstractXmlReceiverD1Ev @ 105 NONAME + _ZN20QAbstractXmlReceiverD2Ev @ 106 NONAME + _ZN21QAbstractXmlNodeModelC2EP28QAbstractXmlNodeModelPrivate @ 107 NONAME + _ZN21QAbstractXmlNodeModelC2Ev @ 108 NONAME + _ZN21QAbstractXmlNodeModelD0Ev @ 109 NONAME + _ZN21QAbstractXmlNodeModelD1Ev @ 110 NONAME + _ZN21QAbstractXmlNodeModelD2Ev @ 111 NONAME + _ZN23QAbstractMessageHandler11qt_metacallEN11QMetaObject4CallEiPPv @ 112 NONAME + _ZN23QAbstractMessageHandler11qt_metacastEPKc @ 113 NONAME + _ZN23QAbstractMessageHandler16staticMetaObjectE @ 114 NONAME DATA 16 + _ZN23QAbstractMessageHandler19getStaticMetaObjectEv @ 115 NONAME + _ZN23QAbstractMessageHandler7messageE9QtMsgTypeRK7QStringRK4QUrlRK15QSourceLocation @ 116 NONAME + _ZN23QAbstractMessageHandlerC2EP7QObject @ 117 NONAME + _ZN23QAbstractMessageHandlerD0Ev @ 118 NONAME + _ZN23QAbstractMessageHandlerD1Ev @ 119 NONAME + _ZN23QAbstractMessageHandlerD2Ev @ 120 NONAME + _ZN8QXmlItemC1ERK18QXmlNodeModelIndex @ 121 NONAME + _ZN8QXmlItemC1ERK8QVariant @ 122 NONAME + _ZN8QXmlItemC1ERKS_ @ 123 NONAME + _ZN8QXmlItemC1Ev @ 124 NONAME + _ZN8QXmlItemC2ERK18QXmlNodeModelIndex @ 125 NONAME + _ZN8QXmlItemC2ERK8QVariant @ 126 NONAME + _ZN8QXmlItemC2ERKS_ @ 127 NONAME + _ZN8QXmlItemC2Ev @ 128 NONAME + _ZN8QXmlItemD1Ev @ 129 NONAME + _ZN8QXmlItemD2Ev @ 130 NONAME + _ZN8QXmlItemaSERKS_ @ 131 NONAME + _ZN8QXmlName13fromClarkNameERK7QStringRK12QXmlNamePool @ 132 NONAME + _ZN8QXmlName8isNCNameERK7QString @ 133 NONAME + _ZN8QXmlNameC1ER12QXmlNamePoolRK7QStringS4_S4_ @ 134 NONAME + _ZN8QXmlNameC1Ev @ 135 NONAME + _ZN8QXmlNameC2ER12QXmlNamePoolRK7QStringS4_S4_ @ 136 NONAME + _ZN8QXmlNameC2Ev @ 137 NONAME + _ZN8QXmlNameaSERKS_ @ 138 NONAME + _ZN9QXmlQuery12bindVariableERK7QStringP9QIODevice @ 139 NONAME + _ZN9QXmlQuery12bindVariableERK7QStringRK8QXmlItem @ 140 NONAME + _ZN9QXmlQuery12bindVariableERK7QStringRKS_ @ 141 NONAME + _ZN9QXmlQuery12bindVariableERK8QXmlNameP9QIODevice @ 142 NONAME + _ZN9QXmlQuery12bindVariableERK8QXmlNameRK8QXmlItem @ 143 NONAME + _ZN9QXmlQuery12bindVariableERK8QXmlNameRKS_ @ 144 NONAME + _ZN9QXmlQuery14setUriResolverEPK20QAbstractUriResolver @ 145 NONAME + _ZN9QXmlQuery17setMessageHandlerEP23QAbstractMessageHandler @ 146 NONAME + _ZN9QXmlQuery22setInitialTemplateNameERK7QString @ 147 NONAME + _ZN9QXmlQuery22setInitialTemplateNameERK8QXmlName @ 148 NONAME + _ZN9QXmlQuery23setNetworkAccessManagerEP21QNetworkAccessManager @ 149 NONAME + _ZN9QXmlQuery8setFocusEP9QIODevice @ 150 NONAME + _ZN9QXmlQuery8setFocusERK4QUrl @ 151 NONAME + _ZN9QXmlQuery8setFocusERK7QString @ 152 NONAME + _ZN9QXmlQuery8setFocusERK8QXmlItem @ 153 NONAME + _ZN9QXmlQuery8setQueryEP9QIODeviceRK4QUrl @ 154 NONAME + _ZN9QXmlQuery8setQueryERK4QUrlS2_ @ 155 NONAME + _ZN9QXmlQuery8setQueryERK7QStringRK4QUrl @ 156 NONAME + _ZN9QXmlQueryC1ENS_13QueryLanguageERK12QXmlNamePool @ 157 NONAME + _ZN9QXmlQueryC1ERK12QXmlNamePool @ 158 NONAME + _ZN9QXmlQueryC1ERKS_ @ 159 NONAME + _ZN9QXmlQueryC1Ev @ 160 NONAME + _ZN9QXmlQueryC2ENS_13QueryLanguageERK12QXmlNamePool @ 161 NONAME + _ZN9QXmlQueryC2ERK12QXmlNamePool @ 162 NONAME + _ZN9QXmlQueryC2ERKS_ @ 163 NONAME + _ZN9QXmlQueryC2Ev @ 164 NONAME + _ZN9QXmlQueryD1Ev @ 165 NONAME + _ZN9QXmlQueryD2Ev @ 166 NONAME + _ZN9QXmlQueryaSERKS_ @ 167 NONAME + _ZNK10QXmlSchema11documentUriEv @ 168 NONAME + _ZNK10QXmlSchema11uriResolverEv @ 169 NONAME + _ZNK10QXmlSchema14messageHandlerEv @ 170 NONAME + _ZNK10QXmlSchema20networkAccessManagerEv @ 171 NONAME + _ZNK10QXmlSchema7isValidEv @ 172 NONAME + _ZNK10QXmlSchema8namePoolEv @ 173 NONAME + _ZNK13QXmlFormatter16indentationDepthEv @ 174 NONAME + _ZNK14QXmlSerializer12outputDeviceEv @ 175 NONAME + _ZNK14QXmlSerializer5codecEv @ 176 NONAME + _ZNK15QSourceLocation3uriEv @ 177 NONAME + _ZNK15QSourceLocation4lineEv @ 178 NONAME + _ZNK15QSourceLocation6columnEv @ 179 NONAME + _ZNK15QSourceLocation6isNullEv @ 180 NONAME + _ZNK15QSourceLocationeqERKS_ @ 181 NONAME + _ZNK15QSourceLocationneERKS_ @ 182 NONAME + _ZNK15QXmlResultItems7currentEv @ 183 NONAME + _ZNK15QXmlResultItems8hasErrorEv @ 184 NONAME + _ZNK18QXmlNodeModelIndexeqERKS_ @ 185 NONAME + _ZNK18QXmlNodeModelIndexneERKS_ @ 186 NONAME + _ZNK19QSimpleXmlNodeModel11elementByIdERK8QXmlName @ 187 NONAME + _ZNK19QSimpleXmlNodeModel11stringValueERK18QXmlNodeModelIndex @ 188 NONAME + _ZNK19QSimpleXmlNodeModel12nodesByIdrefERK8QXmlName @ 189 NONAME + _ZNK19QSimpleXmlNodeModel17namespaceBindingsERK18QXmlNodeModelIndex @ 190 NONAME + _ZNK19QSimpleXmlNodeModel7baseUriERK18QXmlNodeModelIndex @ 191 NONAME + _ZNK19QSimpleXmlNodeModel8namePoolEv @ 192 NONAME + _ZNK19QXmlSchemaValidator11uriResolverEv @ 193 NONAME + _ZNK19QXmlSchemaValidator14messageHandlerEv @ 194 NONAME + _ZNK19QXmlSchemaValidator20networkAccessManagerEv @ 195 NONAME + _ZNK19QXmlSchemaValidator6schemaEv @ 196 NONAME + _ZNK19QXmlSchemaValidator8namePoolEv @ 197 NONAME + _ZNK19QXmlSchemaValidator8validateEP9QIODeviceRK4QUrl @ 198 NONAME + _ZNK19QXmlSchemaValidator8validateERK10QByteArrayRK4QUrl @ 199 NONAME + _ZNK19QXmlSchemaValidator8validateERK4QUrl @ 200 NONAME + _ZNK20QAbstractUriResolver10metaObjectEv @ 201 NONAME + _ZNK21QAbstractXmlNodeModel10copyNodeToERK18QXmlNodeModelIndexP20QAbstractXmlReceiverRK6QFlagsINS_15NodeCopySettingEE @ 202 NONAME + _ZNK21QAbstractXmlNodeModel11isDeepEqualERK18QXmlNodeModelIndexS2_ @ 203 NONAME + _ZNK21QAbstractXmlNodeModel14sendNamespacesERK18QXmlNodeModelIndexP20QAbstractXmlReceiver @ 204 NONAME + _ZNK21QAbstractXmlNodeModel14sourceLocationERK18QXmlNodeModelIndex @ 205 NONAME + _ZNK21QAbstractXmlNodeModel18namespaceForPrefixERK18QXmlNodeModelIndexs @ 206 NONAME + _ZNK21QAbstractXmlNodeModel19sequencedTypedValueERK18QXmlNodeModelIndex @ 207 NONAME + _ZNK21QAbstractXmlNodeModel4typeERK18QXmlNodeModelIndex @ 208 NONAME + _ZNK21QAbstractXmlNodeModel7iterateERK18QXmlNodeModelIndexNS0_4AxisE @ 209 NONAME + _ZNK23QAbstractMessageHandler10metaObjectEv @ 210 NONAME + _ZNK8QXmlItem13isAtomicValueEv @ 211 NONAME + _ZNK8QXmlItem13toAtomicValueEv @ 212 NONAME + _ZNK8QXmlItem16toNodeModelIndexEv @ 213 NONAME + _ZNK8QXmlItem6isNodeEv @ 214 NONAME + _ZNK8QXmlItem6isNullEv @ 215 NONAME + _ZNK8QXmlName11toClarkNameERK12QXmlNamePool @ 216 NONAME + _ZNK8QXmlName12namespaceUriERK12QXmlNamePool @ 217 NONAME + _ZNK8QXmlName6isNullEv @ 218 NONAME + _ZNK8QXmlName6prefixERK12QXmlNamePool @ 219 NONAME + _ZNK8QXmlName9localNameERK12QXmlNamePool @ 220 NONAME + _ZNK8QXmlNameeqERKS_ @ 221 NONAME + _ZNK8QXmlNameneERKS_ @ 222 NONAME + _ZNK9QXmlQuery10evaluateToEP11QStringList @ 223 NONAME + _ZNK9QXmlQuery10evaluateToEP15QXmlResultItems @ 224 NONAME + _ZNK9QXmlQuery10evaluateToEP20QAbstractXmlReceiver @ 225 NONAME + _ZNK9QXmlQuery10evaluateToEP7QString @ 226 NONAME + _ZNK9QXmlQuery10evaluateToEP9QIODevice @ 227 NONAME + _ZNK9QXmlQuery11uriResolverEv @ 228 NONAME + _ZNK9QXmlQuery13queryLanguageEv @ 229 NONAME + _ZNK9QXmlQuery14messageHandlerEv @ 230 NONAME + _ZNK9QXmlQuery19initialTemplateNameEv @ 231 NONAME + _ZNK9QXmlQuery20networkAccessManagerEv @ 232 NONAME + _ZNK9QXmlQuery7isValidEv @ 233 NONAME + _ZNK9QXmlQuery8namePoolEv @ 234 NONAME + _ZTI13QXmlFormatter @ 235 NONAME + _ZTI14QXmlSerializer @ 236 NONAME + _ZTI15QXmlResultItems @ 237 NONAME + _ZTI19QSimpleXmlNodeModel @ 238 NONAME + _ZTI20QAbstractUriResolver @ 239 NONAME + _ZTI20QAbstractXmlReceiver @ 240 NONAME + _ZTI21QAbstractXmlNodeModel @ 241 NONAME + _ZTI23QAbstractMessageHandler @ 242 NONAME + _ZTV13QXmlFormatter @ 243 NONAME + _ZTV14QXmlSerializer @ 244 NONAME + _ZTV15QXmlResultItems @ 245 NONAME + _ZTV19QSimpleXmlNodeModel @ 246 NONAME + _ZTV20QAbstractUriResolver @ 247 NONAME + _ZTV20QAbstractXmlReceiver @ 248 NONAME + _ZTV21QAbstractXmlNodeModel @ 249 NONAME + _ZTV23QAbstractMessageHandler @ 250 NONAME + _Zls6QDebugRK15QSourceLocation @ 251 NONAME + -- cgit v0.12 From 79c6049ccaae4434add40d35b3e47a83ff4a102a Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 4 Nov 2009 10:56:40 +1000 Subject: Incorporate API review feedback for math3d classes. Reviewed-by: Sarah Smith --- demos/boxes/scene.cpp | 2 +- demos/boxes/trackball.cpp | 4 +- src/gui/math3d/qgenericmatrix.cpp | 106 ++++++++++++- src/gui/math3d/qgenericmatrix.h | 37 ++++- src/gui/math3d/qmatrix4x4.cpp | 134 +++------------- src/gui/math3d/qmatrix4x4.h | 15 +- src/gui/math3d/qquaternion.cpp | 4 +- src/gui/math3d/qquaternion.h | 2 +- .../qgraphicstransform/tst_qgraphicstransform.cpp | 6 +- tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp | 168 +++------------------ tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp | 4 +- 11 files changed, 197 insertions(+), 285 deletions(-) diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp index 2b75f19..a06e8a1 100644 --- a/demos/boxes/scene.cpp +++ b/demos/boxes/scene.cpp @@ -870,7 +870,7 @@ void Scene::renderCubemaps() float angle = 2.0f * PI * i / m_cubemaps.size(); - center = m_trackBalls[1].rotation().rotateVector(QVector3D(cos(angle), sin(angle), 0.0f)); + center = m_trackBalls[1].rotation().rotatedVector(QVector3D(cos(angle), sin(angle), 0.0f)); for (int face = 0; face < 6; ++face) { m_cubemaps[i]->begin(face); diff --git a/demos/boxes/trackball.cpp b/demos/boxes/trackball.cpp index 2b1b2e4..76324e6 100644 --- a/demos/boxes/trackball.cpp +++ b/demos/boxes/trackball.cpp @@ -93,7 +93,7 @@ void TrackBall::move(const QPointF& p, const QQuaternion &transformation) QLineF delta(m_lastPos, p); m_angularVelocity = 180*delta.length() / (PI*msecs); m_axis = QVector3D(-delta.dy(), delta.dx(), 0.0f).normalized(); - m_axis = transformation.rotateVector(m_axis); + m_axis = transformation.rotatedVector(m_axis); m_rotation = QQuaternion::fromAxisAndAngle(m_axis, 180 / PI * delta.length()) * m_rotation; } break; @@ -118,7 +118,7 @@ void TrackBall::move(const QPointF& p, const QQuaternion &transformation) m_angularVelocity = angle / msecs; m_axis.normalize(); - m_axis = transformation.rotateVector(m_axis); + m_axis = transformation.rotatedVector(m_axis); m_rotation = QQuaternion::fromAxisAndAngle(m_axis, angle) * m_rotation; } break; diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp index d211229..aa98536 100644 --- a/src/gui/math3d/qgenericmatrix.cpp +++ b/src/gui/math3d/qgenericmatrix.cpp @@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE The contents of the array \a values is assumed to be in row-major order. - \sa toValueArray() + \sa copyDataTo() */ /*! @@ -102,11 +102,11 @@ QT_BEGIN_NAMESPACE Returns true if this matrix is the identity; false otherwise. - \sa setIdentity() + \sa setToIdentity() */ /*! - \fn void QGenericMatrix::setIdentity() + \fn void QGenericMatrix::setToIdentity() Sets this matrix to the identity. @@ -213,9 +213,9 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QGenericMatrix::toValueArray(T *values) + \fn void QGenericMatrix::copyDataTo(T *values) const - Retrieves the N * M items in this matrix and writes them to \a values + Retrieves the N * M items in this matrix and copies them to \a values in row-major order. */ @@ -243,4 +243,100 @@ QT_BEGIN_NAMESPACE \sa data() */ +#ifndef QT_NO_DATASTREAM + +/*! + \fn QDataStream &operator<<(QDataStream &stream, const QGenericMatrix &matrix) + \relates QGenericMatrix + + Writes the given \a matrix to the given \a stream and returns a + reference to the stream. + + \sa {Format of the QDataStream Operators} +*/ + +/*! + \fn QDataStream &operator>>(QDataStream &stream, QGenericMatrix &matrix) + \relates QGenericMatrix + + Reads a NxM matrix from the given \a stream into the given \a matrix + and returns a reference to the stream. + + \sa {Format of the QDataStream Operators} +*/ + +#endif + +/*! + \typedef QMatrix2x2 + \relates QGenericMatrix + + The QMatrix2x2 type defines a convenient instantiation of the + QGenericMatrix template for 2 columns, 2 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix2x3 + \relates QGenericMatrix + + The QMatrix2x3 type defines a convenient instantiation of the + QGenericMatrix template for 2 columns, 3 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix2x4 + \relates QGenericMatrix + + The QMatrix2x4 type defines a convenient instantiation of the + QGenericMatrix template for 2 columns, 4 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix3x2 + \relates QGenericMatrix + + The QMatrix3x2 type defines a convenient instantiation of the + QGenericMatrix template for 3 columns, 2 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix3x3 + \relates QGenericMatrix + + The QMatrix3x3 type defines a convenient instantiation of the + QGenericMatrix template for 3 columns, 3 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix3x4 + \relates QGenericMatrix + + The QMatrix3x4 type defines a convenient instantiation of the + QGenericMatrix template for 3 columns, 4 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix4x2 + \relates QGenericMatrix + + The QMatrix4x2 type defines a convenient instantiation of the + QGenericMatrix template for 4 columns, 2 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix4x3 + \relates QGenericMatrix + + The QMatrix4x3 type defines a convenient instantiation of the + QGenericMatrix template for 4 columns, 3 rows, and qreal as + the element type. +*/ + QT_END_NAMESPACE diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h index f178d02..3871754 100644 --- a/src/gui/math3d/qgenericmatrix.h +++ b/src/gui/math3d/qgenericmatrix.h @@ -44,6 +44,7 @@ #include #include +#include QT_BEGIN_HEADER @@ -63,7 +64,7 @@ public: T& operator()(int row, int column); bool isIdentity() const; - void setIdentity(); + void setToIdentity(); void fill(T value); @@ -76,7 +77,7 @@ public: bool operator==(const QGenericMatrix& other) const; bool operator!=(const QGenericMatrix& other) const; - void toValueArray(T *values); + void copyDataTo(T *values) const; T *data() { return m[0]; } const T *data() const { return m[0]; } @@ -113,7 +114,7 @@ private: template Q_INLINE_TEMPLATE QGenericMatrix::QGenericMatrix() { - setIdentity(); + setToIdentity(); } template @@ -164,7 +165,7 @@ Q_OUTOFLINE_TEMPLATE bool QGenericMatrix::isIdentity() const } template -Q_OUTOFLINE_TEMPLATE void QGenericMatrix::setIdentity() +Q_OUTOFLINE_TEMPLATE void QGenericMatrix::setToIdentity() { for (int col = 0; col < N; ++col) { for (int row = 0; row < M; ++row) { @@ -316,7 +317,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix operator/(const QGenericMatrix -Q_OUTOFLINE_TEMPLATE void QGenericMatrix::toValueArray(T *values) +Q_OUTOFLINE_TEMPLATE void QGenericMatrix::copyDataTo(T *values) const { for (int col = 0; col < N; ++col) for (int row = 0; row < M; ++row) @@ -352,6 +353,32 @@ QDebug operator<<(QDebug dbg, const QGenericMatrix &m) #endif +#ifndef QT_NO_DATASTREAM + +template +QDataStream &operator<<(QDataStream &stream, const QGenericMatrix &matrix) +{ + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + stream << double(matrix(row, col)); + return stream; +} + +template +QDataStream &operator>>(QDataStream &stream, QGenericMatrix &matrix) +{ + double x; + for (int row = 0; row < M; ++row) { + for (int col = 0; col < N; ++col) { + stream >> x; + matrix(row, col) = T(x); + } + } + return stream; +} + +#endif + QT_END_NAMESPACE Q_DECLARE_METATYPE(QMatrix2x2) diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 5d624d8..ef2e4ab 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -73,10 +73,10 @@ static const qreal inv_dist_to_plane = 1. / 1024.; If the matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to - inferSpecialType() if they wish QMatrix4x4 to optimize further + optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc. - \sa toValueArray(), inferSpecialType() + \sa copyDataTo(), optimize() */ QMatrix4x4::QMatrix4x4(const qreal *values) { @@ -96,10 +96,10 @@ QMatrix4x4::QMatrix4x4(const qreal *values) If the matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to - inferSpecialType() if they wish QMatrix4x4 to optimize further + optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc. - \sa inferSpecialType() + \sa optimize() */ #if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) @@ -176,10 +176,10 @@ QMatrix4x4::QMatrix4x4(const qreal *values, int cols, int rows) If \a matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to - inferSpecialType() if they wish QMatrix4x4 to optimize further + optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc. - \sa toAffine(), inferSpecialType() + \sa toAffine(), optimize() */ QMatrix4x4::QMatrix4x4(const QMatrix& matrix) { @@ -208,10 +208,10 @@ QMatrix4x4::QMatrix4x4(const QMatrix& matrix) If \a transform has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to - inferSpecialType() if they wish QMatrix4x4 to optimize further + optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc. - \sa toTransform(), inferSpecialType() + \sa toTransform(), optimize() */ QMatrix4x4::QMatrix4x4(const QTransform& transform) { @@ -249,7 +249,7 @@ QMatrix4x4::QMatrix4x4(const QTransform& transform) Returns a reference to the element at position (\a row, \a column) in this matrix so that the element can be assigned to. - \sa inferSpecialType(), setColumn(), setRow() + \sa optimize(), setColumn(), setRow() */ /*! @@ -289,11 +289,11 @@ QMatrix4x4::QMatrix4x4(const QTransform& transform) Returns true if this matrix is the identity; false otherwise. - \sa setIdentity() + \sa setToIdentity() */ /*! - \fn void QMatrix4x4::setIdentity() + \fn void QMatrix4x4::setToIdentity() Sets this matrix to the identity. @@ -1027,7 +1027,7 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) if (y == 0.0f) { if (z != 0.0f) { // Rotate around the Z axis. - m.setIdentity(); + m.setToIdentity(); m.m[0][0] = c; m.m[1][1] = c; if (z < 0.0f) { @@ -1042,7 +1042,7 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) } } else if (z == 0.0f) { // Rotate around the Y axis. - m.setIdentity(); + m.setToIdentity(); m.m[0][0] = c; m.m[2][2] = c; if (y < 0.0f) { @@ -1057,7 +1057,7 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) } } else if (y == 0.0f && z == 0.0f) { // Rotate around the X axis. - m.setIdentity(); + m.setToIdentity(); m.m[1][1] = c; m.m[2][2] = c; if (x < 0.0f) { @@ -1135,7 +1135,7 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) if (y == 0.0f) { if (z != 0.0f) { // Rotate around the Z axis. - m.setIdentity(); + m.setToIdentity(); m.m[0][0] = c; m.m[1][1] = c; if (z < 0.0f) { @@ -1150,7 +1150,7 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) } } else if (z == 0.0f) { // Rotate around the Y axis. - m.setIdentity(); + m.setToIdentity(); m.m[0][0] = c; m.m[2][2] = 1.0f; if (y < 0.0f) { @@ -1163,7 +1163,7 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) } } else if (y == 0.0f && z == 0.0f) { // Rotate around the X axis. - m.setIdentity(); + m.setToIdentity(); m.m[1][1] = c; m.m[2][2] = 1.0f; if (x < 0.0f) { @@ -1512,10 +1512,10 @@ QMatrix4x4& QMatrix4x4::flipCoordinates() } /*! - Retrieves the 16 items in this matrix and writes them to \a values + Retrieves the 16 items in this matrix and copies them to \a values in row-major order. */ -void QMatrix4x4::toValueArray(qreal *values) const +void QMatrix4x4::copyDataTo(qreal *values) const { for (int row = 0; row < 4; ++row) for (int col = 0; col < 4; ++col) @@ -1739,7 +1739,7 @@ QRectF QMatrix4x4::mapRect(const QRectF& rect) const Returns a pointer to the raw data of this matrix. - \sa constData(), inferSpecialType() + \sa constData(), optimize() */ /*! @@ -1788,94 +1788,8 @@ QMatrix4x4 QMatrix4x4::orthonormalInverse() const return result; } -#ifndef QT_NO_VECTOR3D -/*! - Decomposes the current rotation matrix into an \a axis of rotation plus - an \a angle. The result can be used to construct an equivalent rotation - matrix using glRotate(). It is assumed that the homogenous coordinate - is 1.0. The returned vector is guaranteed to be normalized. - - \code - qreal angle; - QVector3D axis; - - matrix.extractAxisAngle(angle, axis); - glRotate(angle, axis[0], axis[1], axis[2]); - \endcode - - \sa rotate() -*/ -void QMatrix4x4::extractAxisRotation(qreal &angle, QVector3D &axis) const -{ - // Orientation is dependent on the upper 3x3 matrix; subtract the - // homogeneous scaling element from the trace of the 4x4 matrix - qreal tr = m[0][0] + m[1][1] + m[2][2]; - qreal cosa = qreal(0.5f * (tr - 1.0f)); - angle = acos(cosa) * 180.0f / M_PI; - - // Any axis will work if r is zero (means no rotation) - if (qFuzzyIsNull(angle)) { - axis.setX(1.0f); - axis.setY(0.0f); - axis.setZ(0.0f); - return; - } - - if (angle < 180.0f) { - axis.setX(m[1][2] - m[2][1]); - axis.setY(m[2][0] - m[0][2]); - axis.setZ(m[0][1] - m[1][0]); - axis.normalize(); - return; - } - - // rads == PI - qreal tmp; - - // r00 is maximum - if ((m[0][0] >= m[2][2]) && (m[0][0] >= m[1][1])) { - axis.setX(0.5f * qSqrt(m[0][0] - m[1][1] - m[2][2] + 1.0f)); - tmp = 0.5f / axis.x(); - axis.setY(m[1][0] * tmp); - axis.setZ(m[2][0] * tmp); - } - - // r11 is maximum - if ((m[1][1] >= m[2][2]) && (m[1][1] >= m[0][0])) { - axis.setY(0.5f * qSqrt(m[1][1] - m[0][0] - m[2][2] + 1.0f)); - tmp = 0.5f / axis.y(); - axis.setX(tmp * m[1][0]); - axis.setZ(tmp * m[2][1]); - } - - // r22 is maximum - if ((m[2][2] >= m[1][1]) && (m[2][2] >= m[0][0])) { - axis.setZ(0.5f * qSqrt(m[2][2] - m[0][0] - m[1][1] + 1.0f)); - tmp = 0.5f / axis.z(); - axis.setX(m[2][0]*tmp); - axis.setY(m[2][1]*tmp); - } -} - -/*! - If this is an orthonormal transformation matrix (e.g. only rotations and - translations have been applied to the matrix, no scaling, or shearing) - then the world translational component can be obtained by calling this function. - - This is most useful for camera matrices, where the negation of this vector - is effectively the camera world coordinates. -*/ -QVector3D QMatrix4x4::extractTranslation() const -{ - return QVector3D - (m[0][0] * m[3][0] + m[0][1] * m[3][1] + m[0][2] * m[3][2], - m[1][0] * m[3][0] + m[1][1] * m[3][1] + m[1][2] * m[3][2], - m[2][0] * m[3][0] + m[2][1] * m[3][1] + m[2][2] * m[3][2]); -} -#endif - /*! - Infers the special type of this matrix from its current elements. + Optimize the usage of this matrix from its current elements. Some operations such as translate(), scale(), and rotate() can be performed more efficiently if the matrix being modified is already @@ -1888,13 +1802,13 @@ QVector3D QMatrix4x4::extractTranslation() const the special type and will revert to the safest but least efficient operations thereafter. - By calling inferSpecialType() after directly modifying the matrix, + By calling optimize() after directly modifying the matrix, the programmer can force QMatrix4x4 to recover the special type if the elements appear to conform to one of the known optimized types. \sa operator()(), data(), translate() */ -void QMatrix4x4::inferSpecialType() +void QMatrix4x4::optimize() { // If the last element is not 1, then it can never be special. if (m[3][3] != 1.0f) { @@ -2011,7 +1925,7 @@ QDataStream &operator>>(QDataStream &stream, QMatrix4x4 &matrix) matrix(row, col) = qreal(x); } } - matrix.inferSpecialType(); + matrix.optimize(); return stream; } diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index ba74b89..daebf9d 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -63,7 +63,7 @@ class QVariant; class Q_GUI_EXPORT QMatrix4x4 { public: - inline QMatrix4x4() { setIdentity(); } + inline QMatrix4x4() { setToIdentity(); } explicit QMatrix4x4(const qreal *values); inline QMatrix4x4(qreal m11, qreal m12, qreal m13, qreal m14, qreal m21, qreal m22, qreal m23, qreal m24, @@ -87,7 +87,7 @@ public: inline void setRow(int index, const QVector4D& value); inline bool isIdentity() const; - inline void setIdentity(); + inline void setToIdentity(); inline void fill(qreal value); @@ -141,11 +141,6 @@ public: QMatrix4x4& rotate(const QQuaternion& quaternion); #endif -#ifndef QT_NO_VECTOR3D - void extractAxisRotation(qreal &angle, QVector3D &axis) const; - QVector3D extractTranslation() const; -#endif - QMatrix4x4& ortho(const QRect& rect); QMatrix4x4& ortho(const QRectF& rect); QMatrix4x4& ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); @@ -156,7 +151,7 @@ public: #endif QMatrix4x4& flipCoordinates(); - void toValueArray(qreal *values) const; + void copyDataTo(qreal *values) const; QMatrix toAffine() const; QTransform toTransform() const; @@ -183,7 +178,7 @@ public: inline const qreal *data() const { return m[0]; } inline const qreal *constData() const { return m[0]; } - void inferSpecialType(); + void optimize(); operator QVariant() const; @@ -330,7 +325,7 @@ inline bool QMatrix4x4::isIdentity() const return (m[3][3] == 1.0f); } -inline void QMatrix4x4::setIdentity() +inline void QMatrix4x4::setToIdentity() { m[0][0] = 1.0f; m[0][1] = 0.0f; diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index d5ec054..626cb3c 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -288,7 +288,7 @@ void QQuaternion::normalize() in 3D space. The following code: \code - QVector3D result = q.rotateVector(vector); + QVector3D result = q.rotatedVector(vector); \endcode is equivalent to the following: @@ -297,7 +297,7 @@ void QQuaternion::normalize() QVector3D result = (q * QQuaternion(0, vector) * q.conjugate()).vector(); \endcode */ -QVector3D QQuaternion::rotateVector(const QVector3D& vector) const +QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const { return (*this * QQuaternion(0, vector) * conjugate()).vector(); } diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index 7480a5c..5b2454f 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -95,7 +95,7 @@ public: QQuaternion conjugate() const; - QVector3D rotateVector(const QVector3D& vector) const; + QVector3D rotatedVector(const QVector3D& vector) const; QQuaternion &operator+=(const QQuaternion &quaternion); QQuaternion &operator-=(const QQuaternion &quaternion); diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index d8ab06e..9b15ab1 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -259,7 +259,7 @@ void tst_QGraphicsTransform::rotation3d() // Check that "rotation" produces the 4x4 form of the 3x3 matrix. // i.e. third row and column are 0 0 1 0. - t.setIdentity(); + t.setToIdentity(); rotation.applyTo(&t); QMatrix4x4 r(expected); if (sizeof(qreal) == sizeof(float) && angle == 268) { @@ -274,7 +274,7 @@ void tst_QGraphicsTransform::rotation3d() rotation.setAxis(QVector3D(0, 0, 0)); rotation.setOrigin(QVector3D(10, 10, 0)); - t.setIdentity(); + t.setToIdentity(); rotation.applyTo(&t); QVERIFY(t.isIdentity()); @@ -337,7 +337,7 @@ void tst_QGraphicsTransform::rotation3dArbitraryAxis() // Check that "rotation" produces the 4x4 form of the 3x3 matrix. // i.e. third row and column are 0 0 1 0. - t.setIdentity(); + t.setToIdentity(); rotation.applyTo(&t); QMatrix4x4 r(expected); QVERIFY(qFuzzyCompare(t, r)); diff --git a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp index ff5e00f..d6d217f2 100644 --- a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp @@ -151,14 +151,8 @@ private slots: void convertGeneric(); - void extractAxisRotation_data(); - void extractAxisRotation(); - - void extractTranslation_data(); - void extractTranslation(); - - void inferSpecialType_data(); - void inferSpecialType(); + void optimize_data(); + void optimize(); void columnsAndRows(); @@ -515,13 +509,13 @@ void tst_QMatrixNxN::create2x2() m5 = m3; QVERIFY(isSame(m5, uniqueValues2)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix2x2 m6(uniqueValues2); QVERIFY(isSame(m6, uniqueValues2)); qreal vals[4]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 4; ++index) QCOMPARE(vals[index], uniqueValues2[index]); } @@ -550,13 +544,13 @@ void tst_QMatrixNxN::create3x3() m5 = m3; QVERIFY(isSame(m5, uniqueValues3)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix3x3 m6(uniqueValues3); QVERIFY(isSame(m6, uniqueValues3)); qreal vals[9]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 9; ++index) QCOMPARE(vals[index], uniqueValues3[index]); } @@ -585,13 +579,13 @@ void tst_QMatrixNxN::create4x4() m5 = m3; QVERIFY(isSame(m5, uniqueValues4)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix4x4 m6(uniqueValues4); QVERIFY(isSame(m6, uniqueValues4)); qreal vals[16]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 16; ++index) QCOMPARE(vals[index], uniqueValues4[index]); @@ -627,13 +621,13 @@ void tst_QMatrixNxN::create4x3() m5 = m3; QVERIFY(isSame(m5, uniqueValues4x3)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix4x3 m6(uniqueValues4x3); QVERIFY(isSame(m6, uniqueValues4x3)); qreal vals[12]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 12; ++index) QCOMPARE(vals[index], uniqueValues4x3[index]); } @@ -802,7 +796,7 @@ void tst_QMatrixNxN::transposed4x3() QMatrix4x3 m3(uniqueValues4x3); QMatrix3x4 m4 = m3.transposed(); qreal values[12]; - m4.toValueArray(values); + m4.copyDataTo(values); for (int index = 0; index < 12; ++index) QCOMPARE(values[index], transposedValues3x4[index]); } @@ -1296,7 +1290,7 @@ void tst_QMatrixNxN::multiply4x3() QGenericMatrix<3, 3, qreal> m4; m4 = m1 * m2; qreal values[9]; - m4.toValueArray(values); + m4.copyDataTo(values); for (int index = 0; index < 9; ++index) QCOMPARE(values[index], ((const qreal *)m3Values)[index]); } @@ -1898,7 +1892,7 @@ void tst_QMatrixNxN::inverted4x4() } // Test again, after inferring the special matrix type. - m1.inferSpecialType(); + m1.optimize(); m2 = m1.inverted(&inv); QVERIFY(isSame(m2, (const qreal *)m2Values)); QCOMPARE(inv, invertible); @@ -1913,12 +1907,12 @@ void tst_QMatrixNxN::orthonormalInverse4x4() m2.rotate(45.0, 1.0, 0.0, 0.0); m2.translate(10.0, 0.0, 0.0); - // Use inferSpecialType() to drop the internal flags that + // Use optimize() to drop the internal flags that // mark the matrix as orthonormal. This will force inverted() // to compute m3.inverted() the long way. We can then compare // the result to what the faster algorithm produces on m2. QMatrix4x4 m3 = m2; - m3.inferSpecialType(); + m3.optimize(); bool invertible; QVERIFY(qFuzzyCompare(m2.inverted(&invertible), m3.inverted())); QVERIFY(invertible); @@ -1926,7 +1920,7 @@ void tst_QMatrixNxN::orthonormalInverse4x4() QMatrix4x4 m4; m4.rotate(45.0, 0.0, 1.0, 0.0); QMatrix4x4 m5 = m4; - m5.inferSpecialType(); + m5.optimize(); QVERIFY(qFuzzyCompare(m4.inverted(), m5.inverted())); QMatrix4x4 m6; @@ -1934,7 +1928,7 @@ void tst_QMatrixNxN::orthonormalInverse4x4() m1.translate(-20.0, 20.0, 15.0); m1.rotate(25, 1.0, 0.0, 0.0); QMatrix4x4 m7 = m6; - m7.inferSpecialType(); + m7.optimize(); QVERIFY(qFuzzyCompare(m6.inverted(), m7.inverted())); } @@ -2081,7 +2075,7 @@ void tst_QMatrixNxN::scale4x4() m8.scale(x); QVERIFY(isSame(m8, (const qreal *)resultValues)); - m8.inferSpecialType(); + m8.optimize(); m8.scale(1.0f); QVERIFY(isSame(m8, (const qreal *)resultValues)); @@ -2412,7 +2406,7 @@ void tst_QMatrixNxN::rotate4x4() if (x != 0 || y != 0 || z != 0) { QQuaternion q = QQuaternion::fromAxisAndAngle(QVector3D(x, y, z), angle); - QVector3D vq = q.rotateVector(v1); + QVector3D vq = q.rotatedVector(v1); QVERIFY(fuzzyCompare(vq.x(), v1x)); QVERIFY(fuzzyCompare(vq.y(), v1y)); QVERIFY(fuzzyCompare(vq.z(), v1z)); @@ -2509,7 +2503,7 @@ void tst_QMatrixNxN::normalMatrix() // Perform the test again, after inferring special matrix types. // This tests the optimized paths in the normalMatrix() function. - m1.inferSpecialType(); + m1.optimize(); n1 = m1.normalMatrix(); if (invertible) @@ -2850,120 +2844,6 @@ void tst_QMatrixNxN::convertGeneric() QVERIFY(isSame(m11, conv4x4)); } -void tst_QMatrixNxN::extractAxisRotation_data() -{ - QTest::addColumn("x"); - QTest::addColumn("y"); - QTest::addColumn("z"); - QTest::addColumn("angle"); - - QTest::newRow("1, 0, 0, 0 deg") << 1.0f << 0.0f << 0.0f << 0.0f; - QTest::newRow("1, 0, 0, 90 deg") << 1.0f << 0.0f << 0.0f << 90.0f; - QTest::newRow("1, 0, 0, 270 deg") << 1.0f << 0.0f << 0.0f << 270.0f; - QTest::newRow("1, 0, 0, 45 deg") << 1.0f << 0.0f << 0.0f << 45.0f; - QTest::newRow("1, 0, 0, 120 deg") << 1.0f << 0.0f << 0.0f << 120.0f; - QTest::newRow("1, 0, 0, 300 deg") << 1.0f << 0.0f << 0.0f << 300.0f; - - QTest::newRow("0, 1, 0, 90 deg") << 0.0f << 1.0f << 0.0f << 90.0f; - QTest::newRow("0, 1, 0, 270 deg") << 0.0f << 1.0f << 0.0f << 270.0f; - QTest::newRow("0, 1, 0, 45 deg") << 0.0f << 1.0f << 0.0f << 45.0f; - QTest::newRow("0, 1, 0, 120 deg") << 0.0f << 1.0f << 0.0f << 120.0f; - QTest::newRow("0, 1, 0, 300 deg") << 0.0f << 1.0f << 0.0f << 300.0f; - - QTest::newRow("0, 0, 1, 90 deg") << 0.0f << 0.0f << 1.0f << 90.0f; - QTest::newRow("0, 0, 1, 270 deg") << 0.0f << 0.0f << 1.0f << 270.0f; - QTest::newRow("0, 0, 1, 45 deg") << 0.0f << 0.0f << 1.0f << 45.0f; - QTest::newRow("0, 0, 1, 120 deg") << 0.0f << 0.0f << 1.0f << 120.0f; - QTest::newRow("0, 0, 1, 300 deg") << 0.0f << 0.0f << 1.0f << 300.0f; - - QTest::newRow("1, 1, 1, 90 deg") << 1.0f << 1.0f << 1.0f << 90.0f; - QTest::newRow("1, 1, 1, 270 deg") << 1.0f << 1.0f << 1.0f << 270.0f; - QTest::newRow("1, 1, 1, 45 deg") << 1.0f << 1.0f << 1.0f << 45.0f; - QTest::newRow("1, 1, 1, 120 deg") << 1.0f << 1.0f << 1.0f << 120.0f; - QTest::newRow("1, 1, 1, 300 deg") << 1.0f << 1.0f << 1.0f << 300.0f; -} - -void tst_QMatrixNxN::extractAxisRotation() -{ - QFETCH(float, x); - QFETCH(float, y); - QFETCH(float, z); - QFETCH(float, angle); - - QMatrix4x4 m; - QVector3D origAxis(x, y, z); - - m.rotate(angle, x, y, z); - - origAxis.normalize(); - QVector3D extractedAxis; - qreal extractedAngle; - - m.extractAxisRotation(extractedAngle, extractedAxis); - - if (angle > 180) { - QVERIFY(fuzzyCompare(360.0f - angle, extractedAngle)); - QVERIFY(fuzzyCompare(extractedAxis, -origAxis)); - } else { - QVERIFY(fuzzyCompare(angle, extractedAngle)); - QVERIFY(fuzzyCompare(extractedAxis, origAxis)); - } -} - -void tst_QMatrixNxN::extractTranslation_data() -{ - QTest::addColumn("rotation"); - QTest::addColumn("x"); - QTest::addColumn("y"); - QTest::addColumn("z"); - - static QMatrix4x4 m1; - - QTest::newRow("identity, 100, 50, 25") - << m1 << 100.0f << 50.0f << 250.0f; - - m1.rotate(45.0, 1.0, 0.0, 0.0); - QTest::newRow("rotX 45 + 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f; - - m1.setIdentity(); - m1.rotate(45.0, 0.0, 1.0, 0.0); - QTest::newRow("rotY 45 + 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f; - - m1.setIdentity(); - m1.rotate(75, 0.0, 0.0, 1.0); - m1.rotate(25, 1.0, 0.0, 0.0); - m1.rotate(45, 0.0, 1.0, 0.0); - QTest::newRow("rotZ 75, rotX 25, rotY 45, 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f; -} - -void tst_QMatrixNxN::extractTranslation() -{ - QFETCH(QMatrix4x4, rotation); - QFETCH(float, x); - QFETCH(float, y); - QFETCH(float, z); - - rotation.translate(x, y, z); - - QVector3D vec = rotation.extractTranslation(); - - QVERIFY(fuzzyCompare(vec.x(), x)); - QVERIFY(fuzzyCompare(vec.y(), y)); - QVERIFY(fuzzyCompare(vec.z(), z)); - - QMatrix4x4 lookAt; - QVector3D eye(1.5f, -2.5f, 2.5f); - lookAt.lookAt(eye, - QVector3D(10.0f, 10.0f, 10.0f), - QVector3D(0.0f, 1.0f, 0.0f)); - - QVector3D extEye = lookAt.extractTranslation(); - - QVERIFY(fuzzyCompare(eye.x(), -extEye.x())); - QVERIFY(fuzzyCompare(eye.y(), -extEye.y())); - QVERIFY(fuzzyCompare(eye.z(), -extEye.z())); -} - // Copy of "flagBits" in qmatrix4x4.h. enum { Identity = 0x0001, // Identity matrix @@ -2981,7 +2861,7 @@ struct Matrix4x4 }; // Test the inferring of special matrix types. -void tst_QMatrixNxN::inferSpecialType_data() +void tst_QMatrixNxN::optimize_data() { QTest::addColumn("mValues"); QTest::addColumn("flagBits"); @@ -3029,13 +2909,13 @@ void tst_QMatrixNxN::inferSpecialType_data() QTest::newRow("below") << (void *)belowValues << (int)General; } -void tst_QMatrixNxN::inferSpecialType() +void tst_QMatrixNxN::optimize() { QFETCH(void *, mValues); QFETCH(int, flagBits); QMatrix4x4 m((const qreal *)mValues); - m.inferSpecialType(); + m.optimize(); QCOMPARE(reinterpret_cast(&m)->flagBits, flagBits); } @@ -3362,7 +3242,7 @@ void tst_QMatrixNxN::mapVector() QFETCH(void *, mValues); QMatrix4x4 m1((const qreal *)mValues); - m1.inferSpecialType(); + m1.optimize(); QVector3D v(3.5f, -1.0f, 2.5f); diff --git a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp b/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp index 71f45ff..f80b579 100644 --- a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp +++ b/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp @@ -220,7 +220,7 @@ void tst_QMatrix4x4::mapVector3D() QVector3D v(10.5f, -2.0f, 3.0f); QVector3D result; - m1.inferSpecialType(); + m1.optimize(); QBENCHMARK { result = m1 * v; @@ -244,7 +244,7 @@ void tst_QMatrix4x4::mapVector2D() QPointF v(10.5f, -2.0f); QPointF result; - m1.inferSpecialType(); + m1.optimize(); QBENCHMARK { result = m1 * v; -- cgit v0.12 From ac30ce00afe700e5ba803038c95121313f33509b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 4 Nov 2009 13:18:08 +1000 Subject: Attempt to fix qdoc error caused by renaming of ftp example to qftp. Reviewed-by: Trust Me --- doc/src/examples/ftp.qdoc | 2 +- doc/src/getting-started/examples.qdoc | 2 +- doc/src/network-programming/qtnetwork.qdoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/examples/ftp.qdoc b/doc/src/examples/ftp.qdoc index 8fded88..782613c 100644 --- a/doc/src/examples/ftp.qdoc +++ b/doc/src/examples/ftp.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \example network/ftp + \example network/qftp \title FTP Example The FTP example demonstrates a simple FTP client that can be used diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 05940e4..79cbe89 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -729,7 +729,7 @@ \o \l{network/network-chat}{Network Chat} \o \l{network/fortuneclient}{Fortune Client}\raisedaster \o \l{network/fortuneserver}{Fortune Server}\raisedaster - \o \l{network/ftp}{FTP}\raisedaster + \o \l{network/qftp}{FTP}\raisedaster \o \l{network/http}{HTTP} \o \l{network/loopback}{Loopback} \o \l{network/threadedfortuneserver}{Threaded Fortune Server}\raisedaster diff --git a/doc/src/network-programming/qtnetwork.qdoc b/doc/src/network-programming/qtnetwork.qdoc index d9377fb..b44b84f 100644 --- a/doc/src/network-programming/qtnetwork.qdoc +++ b/doc/src/network-programming/qtnetwork.qdoc @@ -155,7 +155,7 @@ commands based on the result of a previous command. It also enables you to provide detailed feedback to the user. - The \l{network/ftp}{FTP} example + The \l{network/qftp}{FTP} example illustrates how to write an FTP client. Writing your own FTP (or HTTP) server is possible using the lower-level classes QTcpSocket and QTcpServer. -- cgit v0.12 From 064383eba647c2729e283f68db2394cb6a8df0c3 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Wed, 4 Nov 2009 13:23:58 +1000 Subject: Fixed lastError() for QTDS driver. Previously, no lastError was available on syntax errors, bad column names, etc. Merge-request: 1987 Reviewed-by: Bill King --- src/sql/drivers/tds/qsql_tds.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp index 2508833..ca1502c 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/sql/drivers/tds/qsql_tds.cpp @@ -164,13 +164,13 @@ Q_GLOBAL_STATIC(QTDSErrorHash, errs) extern "C" { static int CS_PUBLIC qTdsMsgHandler (DBPROCESS* dbproc, - DBINT /*msgno*/, + DBINT msgno, int msgstate, int severity, char* msgtext, - char* /*srvname*/, + char* srvname, char* /*procname*/, - int /*line*/) + int line) { QTDSResultPrivate* p = errs()->value(dbproc); @@ -181,9 +181,20 @@ static int CS_PUBLIC qTdsMsgHandler (DBPROCESS* dbproc, } if (severity > 0) { - QString errMsg = QString::fromLatin1("%1 (%2)").arg(QString::fromAscii(msgtext)).arg( - msgstate); + QString errMsg = QString::fromLatin1("%1 (Msg %2, Level %3, State %4, Server %5, Line %6)") + .arg(QString::fromAscii(msgtext)) + .arg(msgno) + .arg(severity) + .arg(msgstate) + .arg(QString::fromAscii(srvname)) + .arg(line); p->addErrorMsg(errMsg); + if (severity > 10) { + // Severe messages are really errors in the sense of lastError + errMsg = p->getErrorMsgs(); + p->lastError = qMakeError(errMsg, QSqlError::UnknownError, msgno); + p->clearErrorMsgs(); + } } return INT_CANCEL; -- cgit v0.12 From ce14a4a0bc290018e597d0a4f8e9f279c63d4cc0 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 4 Nov 2009 13:31:37 +1000 Subject: Remove QMatrix4x4& return values in response to API review feedback Reviewed-by: Sarah Smith --- src/gui/math3d/qmatrix4x4.cpp | 103 +++++++++++++++-------------------- src/gui/math3d/qmatrix4x4.h | 36 ++++++------ tests/auto/qvariant/tst_qvariant.cpp | 6 +- 3 files changed, 65 insertions(+), 80 deletions(-) diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index ef2e4ab..2c3d616 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -694,11 +694,11 @@ QMatrix4x4 operator/(const QMatrix4x4& matrix, qreal divisor) /*! Multiplies this matrix by another that scales coordinates by - the components of \a vector. Returns this matrix. + the components of \a vector. \sa translate(), rotate() */ -QMatrix4x4& QMatrix4x4::scale(const QVector3D& vector) +void QMatrix4x4::scale(const QVector3D& vector) { qreal vx = vector.x(); qreal vy = vector.y(); @@ -732,7 +732,6 @@ QMatrix4x4& QMatrix4x4::scale(const QVector3D& vector) m[2][3] *= vz; flagBits = General; } - return *this; } #endif @@ -740,11 +739,11 @@ QMatrix4x4& QMatrix4x4::scale(const QVector3D& vector) \overload Multiplies this matrix by another that scales coordinates by the - components \a x, and \a y. Returns this matrix. + components \a x, and \a y. \sa translate(), rotate() */ -QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y) +void QMatrix4x4::scale(qreal x, qreal y) { if (flagBits == Identity) { m[0][0] = x; @@ -768,18 +767,17 @@ QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y) m[1][3] *= y; flagBits = General; } - return *this; } /*! \overload Multiplies this matrix by another that scales coordinates by the - components \a x, \a y, and \a z. Returns this matrix. + components \a x, \a y, and \a z. \sa translate(), rotate() */ -QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y, qreal z) +void QMatrix4x4::scale(qreal x, qreal y, qreal z) { if (flagBits == Identity) { m[0][0] = x; @@ -810,18 +808,17 @@ QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y, qreal z) m[2][3] *= z; flagBits = General; } - return *this; } /*! \overload Multiplies this matrix by another that scales coordinates by the - given \a factor. Returns this matrix. + given \a factor. \sa translate(), rotate() */ -QMatrix4x4& QMatrix4x4::scale(qreal factor) +void QMatrix4x4::scale(qreal factor) { if (flagBits == Identity) { m[0][0] = factor; @@ -852,17 +849,16 @@ QMatrix4x4& QMatrix4x4::scale(qreal factor) m[2][3] *= factor; flagBits = General; } - return *this; } #ifndef QT_NO_VECTOR3D /*! Multiplies this matrix by another that translates coordinates by - the components of \a vector. Returns this matrix. + the components of \a vector. \sa scale(), rotate() */ -QMatrix4x4& QMatrix4x4::translate(const QVector3D& vector) +void QMatrix4x4::translate(const QVector3D& vector) { qreal vx = vector.x(); qreal vy = vector.y(); @@ -895,7 +891,6 @@ QMatrix4x4& QMatrix4x4::translate(const QVector3D& vector) else if (flagBits != (Rotation | Translation)) flagBits = General; } - return *this; } #endif @@ -904,11 +899,11 @@ QMatrix4x4& QMatrix4x4::translate(const QVector3D& vector) \overload Multiplies this matrix by another that translates coordinates - by the components \a x, and \a y. Returns this matrix. + by the components \a x, and \a y. \sa scale(), rotate() */ -QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y) +void QMatrix4x4::translate(qreal x, qreal y) { if (flagBits == Identity) { m[3][0] = x; @@ -935,18 +930,17 @@ QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y) else if (flagBits != (Rotation | Translation)) flagBits = General; } - return *this; } /*! \overload Multiplies this matrix by another that translates coordinates - by the components \a x, \a y, and \a z. Returns this matrix. + by the components \a x, \a y, and \a z. \sa scale(), rotate() */ -QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y, qreal z) +void QMatrix4x4::translate(qreal x, qreal y, qreal z) { if (flagBits == Identity) { m[3][0] = x; @@ -976,20 +970,19 @@ QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y, qreal z) else if (flagBits != (Rotation | Translation)) flagBits = General; } - return *this; } #ifndef QT_NO_VECTOR3D /*! Multiples this matrix by another that rotates coordinates through - \a angle degrees about \a vector. Returns this matrix. + \a angle degrees about \a vector. \sa scale(), translate() */ -QMatrix4x4& QMatrix4x4::rotate(qreal angle, const QVector3D& vector) +void QMatrix4x4::rotate(qreal angle, const QVector3D& vector) { - return rotate(angle, vector.x(), vector.y(), vector.z()); + rotate(angle, vector.x(), vector.y(), vector.z()); } #endif @@ -998,14 +991,14 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, const QVector3D& vector) \overload Multiplies this matrix by another that rotates coordinates through - \a angle degrees about the vector (\a x, \a y, \a z). Returns this matrix. + \a angle degrees about the vector (\a x, \a y, \a z). \sa scale(), translate() */ -QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) +void QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) { if (angle == 0.0f) - return *this; + return; QMatrix4x4 m(1); // The "1" says to not load the identity. qreal c, s, ic; if (angle == 90.0f || angle == -270.0f) { @@ -1102,18 +1095,17 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) flagBits = flags | Rotation; else flagBits = Rotation; - return *this; } /*! \internal */ -QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) +void QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) { // Used by QGraphicsRotation::applyTo() to perform a rotation // and projection back to 2D in a single step. if (angle == 0.0f) - return *this; + return; QMatrix4x4 m(1); // The "1" says to not load the identity. qreal c, s, ic; if (angle == 90.0f || angle == -270.0f) { @@ -1206,7 +1198,6 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) flagBits = flags | Rotation; else flagBits = Rotation; - return *this; } #ifndef QT_NO_QUATERNION @@ -1214,11 +1205,11 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) /*! Multiples this matrix by another that rotates coordinates according to a specified \a quaternion. The \a quaternion is assumed to have - been normalized. Returns this matrix. + been normalized. \sa scale(), translate(), QQuaternion */ -QMatrix4x4& QMatrix4x4::rotate(const QQuaternion& quaternion) +void QMatrix4x4::rotate(const QQuaternion& quaternion) { // Algorithm from: // http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 @@ -1254,7 +1245,6 @@ QMatrix4x4& QMatrix4x4::rotate(const QQuaternion& quaternion) flagBits = flags | Rotation; else flagBits = Rotation; - return *this; } #endif @@ -1265,17 +1255,16 @@ QMatrix4x4& QMatrix4x4::rotate(const QQuaternion& quaternion) Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by \a rect. The near and far clipping planes will be -1 and 1 respectively. - Returns this matrix. \sa frustum(), perspective() */ -QMatrix4x4& QMatrix4x4::ortho(const QRect& rect) +void QMatrix4x4::ortho(const QRect& rect) { // Note: rect.right() and rect.bottom() subtract 1 in QRect, // which gives the location of a pixel within the rectangle, // instead of the extent of the rectangle. We want the extent. // QRectF expresses the extent properly. - return ortho(rect.x(), rect.x() + rect.width(), rect.y() + rect.height(), rect.y(), -1.0f, 1.0f); + ortho(rect.x(), rect.x() + rect.width(), rect.y() + rect.height(), rect.y(), -1.0f, 1.0f); } /*! @@ -1284,28 +1273,27 @@ QMatrix4x4& QMatrix4x4::ortho(const QRect& rect) Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by \a rect. The near and far clipping planes will be -1 and 1 respectively. - Returns this matrix. \sa frustum(), perspective() */ -QMatrix4x4& QMatrix4x4::ortho(const QRectF& rect) +void QMatrix4x4::ortho(const QRectF& rect) { - return ortho(rect.left(), rect.right(), rect.bottom(), rect.top(), -1.0f, 1.0f); + ortho(rect.left(), rect.right(), rect.bottom(), rect.top(), -1.0f, 1.0f); } /*! Multiplies this matrix by another that applies an orthographic projection for a window with lower-left corner (\a left, \a bottom), upper-right corner (\a right, \a top), and the specified \a nearPlane - and \a farPlane clipping planes. Returns this matrix. + and \a farPlane clipping planes. \sa frustum(), perspective() */ -QMatrix4x4& QMatrix4x4::ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) +void QMatrix4x4::ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) { // Bail out if the projection volume is zero-sized. if (left == right || bottom == top || nearPlane == farPlane) - return *this; + return; // Construct the projection. qreal width = right - left; @@ -1324,7 +1312,7 @@ QMatrix4x4& QMatrix4x4::ortho(qreal left, qreal right, qreal bottom, qreal top, (2.0f / width, 2.0f / invheight, -1.0f)); - return *this; + return; } #endif QMatrix4x4 m(1); @@ -1347,22 +1335,22 @@ QMatrix4x4& QMatrix4x4::ortho(qreal left, qreal right, qreal bottom, qreal top, // Apply the projection. *this *= m; - return *this; + return; } /*! Multiplies this matrix by another that applies a perspective frustum projection for a window with lower-left corner (\a left, \a bottom), upper-right corner (\a right, \a top), and the specified \a nearPlane - and \a farPlane clipping planes. Returns this matrix. + and \a farPlane clipping planes. \sa ortho(), perspective() */ -QMatrix4x4& QMatrix4x4::frustum(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) +void QMatrix4x4::frustum(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) { // Bail out if the projection volume is zero-sized. if (left == right || bottom == top || nearPlane == farPlane) - return *this; + return; // Construct the projection. QMatrix4x4 m(1); @@ -1388,7 +1376,6 @@ QMatrix4x4& QMatrix4x4::frustum(qreal left, qreal right, qreal bottom, qreal top // Apply the projection. *this *= m; - return *this; } /*! @@ -1396,22 +1383,21 @@ QMatrix4x4& QMatrix4x4::frustum(qreal left, qreal right, qreal bottom, qreal top projection. The field of view will be \a angle degrees within a window with a given \a aspect ratio. The projection will have the specified \a nearPlane and \a farPlane clipping planes. - Returns this matrix. \sa ortho(), frustum() */ -QMatrix4x4& QMatrix4x4::perspective(qreal angle, qreal aspect, qreal nearPlane, qreal farPlane) +void QMatrix4x4::perspective(qreal angle, qreal aspect, qreal nearPlane, qreal farPlane) { // Bail out if the projection volume is zero-sized. if (nearPlane == farPlane || aspect == 0.0f) - return *this; + return; // Construct the projection. QMatrix4x4 m(1); qreal radians = (angle / 2.0f) * M_PI / 180.0f; qreal sine = qSin(radians); if (sine == 0.0f) - return *this; + return; qreal cotan = qCos(radians) / sine; qreal clip = farPlane - nearPlane; m.m[0][0] = cotan / aspect; @@ -1433,7 +1419,6 @@ QMatrix4x4& QMatrix4x4::perspective(qreal angle, qreal aspect, qreal nearPlane, // Apply the projection. *this *= m; - return *this; } #ifndef QT_NO_VECTOR3D @@ -1443,9 +1428,8 @@ QMatrix4x4& QMatrix4x4::perspective(qreal angle, qreal aspect, qreal nearPlane, transformation. The \a center value indicates the center of the view that the \a eye is looking at. The \a up value indicates which direction should be considered up with respect to the \a eye. - Returns this matrix. */ -QMatrix4x4& QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up) +void QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up) { QVector3D forward = (center - eye).normalized(); QVector3D side = QVector3D::crossProduct(forward, up).normalized(); @@ -1471,7 +1455,7 @@ QMatrix4x4& QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, co m.m[3][3] = 1.0f; *this *= m; - return translate(-eye); + translate(-eye); } #endif @@ -1480,11 +1464,11 @@ QMatrix4x4& QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, co Flips between right-handed and left-handed coordinate systems by multiplying the y and z co-ordinates by -1. This is normally used to create a left-handed orthographic view without scaling - the viewport as ortho() does. Returns this matrix. + the viewport as ortho() does. \sa ortho() */ -QMatrix4x4& QMatrix4x4::flipCoordinates() +void QMatrix4x4::flipCoordinates() { if (flagBits == Scale || flagBits == (Scale | Translation)) { m[1][1] = -m[1][1]; @@ -1508,7 +1492,6 @@ QMatrix4x4& QMatrix4x4::flipCoordinates() m[2][3] = -m[2][3]; flagBits = General; } - return *this; } /*! diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index daebf9d..4193bdc 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -127,29 +127,29 @@ public: friend inline bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2); #ifndef QT_NO_VECTOR3D - QMatrix4x4& scale(const QVector3D& vector); - QMatrix4x4& translate(const QVector3D& vector); - QMatrix4x4& rotate(qreal angle, const QVector3D& vector); + void scale(const QVector3D& vector); + void translate(const QVector3D& vector); + void rotate(qreal angle, const QVector3D& vector); #endif - QMatrix4x4& scale(qreal x, qreal y); - QMatrix4x4& scale(qreal x, qreal y, qreal z); - QMatrix4x4& scale(qreal factor); - QMatrix4x4& translate(qreal x, qreal y); - QMatrix4x4& translate(qreal x, qreal y, qreal z); - QMatrix4x4& rotate(qreal angle, qreal x, qreal y, qreal z = 0.0f); + void scale(qreal x, qreal y); + void scale(qreal x, qreal y, qreal z); + void scale(qreal factor); + void translate(qreal x, qreal y); + void translate(qreal x, qreal y, qreal z); + void rotate(qreal angle, qreal x, qreal y, qreal z = 0.0f); #ifndef QT_NO_QUATERNION - QMatrix4x4& rotate(const QQuaternion& quaternion); + void rotate(const QQuaternion& quaternion); #endif - QMatrix4x4& ortho(const QRect& rect); - QMatrix4x4& ortho(const QRectF& rect); - QMatrix4x4& ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); - QMatrix4x4& frustum(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); - QMatrix4x4& perspective(qreal angle, qreal aspect, qreal nearPlane, qreal farPlane); + void ortho(const QRect& rect); + void ortho(const QRectF& rect); + void ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); + void frustum(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); + void perspective(qreal angle, qreal aspect, qreal nearPlane, qreal farPlane); #ifndef QT_NO_VECTOR3D - QMatrix4x4& lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up); + void lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up); #endif - QMatrix4x4& flipCoordinates(); + void flipCoordinates(); void copyDataTo(qreal *values) const; @@ -203,7 +203,7 @@ private: QMatrix4x4 orthonormalInverse() const; - QMatrix4x4& projectedRotate(qreal angle, qreal x, qreal y, qreal z); + void projectedRotate(qreal angle, qreal x, qreal y, qreal z); friend class QGraphicsRotation; }; diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index e2a606f..3d68a73 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -1432,8 +1432,10 @@ void tst_QVariant::matrix4x4() QVariant variant; QMatrix4x4 matrix = qVariantValue(variant); QVERIFY(matrix.isIdentity()); - qVariantSetValue(variant, QMatrix4x4().scale(2.0)); - QCOMPARE(QMatrix4x4().scale(2.0), qVariantValue(variant)); + QMatrix4x4 m; + m.scale(2.0f); + qVariantSetValue(variant, m); + QCOMPARE(m, qVariantValue(variant)); void *mmatrix = QMetaType::construct(QVariant::Matrix4x4, 0); QVERIFY(mmatrix); -- cgit v0.12 From 936a4571f0997d776c4672ea298c9840f676042d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 4 Nov 2009 13:55:25 +1000 Subject: Fix trivial qdoc error Reviewed-by: Trust Me --- src/gui/s60framework/qs60mainappui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 4ad78f9..4c4c994 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -163,7 +163,7 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type) /*! * \brief Handles raw window server events. * - * The event type and information is passed in \a event, while the receiving control is passed in + * The event type and information is passed in \a wsEvent, while the receiving control is passed in * \a destination. * * If you override this function, you should call the base class implementation if you do not -- cgit v0.12 From b41f6618f01a7e9a7d6b5772a5bdfb8841aa2c8b Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 4 Nov 2009 13:13:24 +1000 Subject: qdoc updates for QML Reviewed-by:Michael Brasser --- tools/qdoc3/config.h | 4 ++++ tools/qdoc3/cppcodemarker.cpp | 24 ++++++++++++++---------- tools/qdoc3/cppcodeparser.cpp | 21 +++++++++++++++++---- tools/qdoc3/doc.cpp | 4 ++++ tools/qdoc3/helpprojectwriter.cpp | 12 ++++++++++-- tools/qdoc3/htmlgenerator.cpp | 8 +++++--- tools/qdoc3/node.cpp | 4 +++- tools/qdoc3/node.h | 13 +++++++++++-- tools/qdoc3/test/classic.css | 7 ++++++- tools/qdoc3/test/qt-cpp-ignore.qdocconf | 1 + 10 files changed, 75 insertions(+), 23 deletions(-) diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index 07cdb59..725129a 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -162,6 +162,10 @@ class Config #define CONFIG_FILEEXTENSIONS "fileextensions" +#ifdef QDOC_QML +#define CONFIG_QMLONLY "qmlonly" +#endif + QT_END_NAMESPACE #endif diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index a32f92b..c07be8b 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -353,6 +353,10 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary) QString name = taggedQmlNode(node); if (summary) { name = linkTag(node,name); + } else if (node->type() == Node::QmlProperty) { + const QmlPropertyNode* pn = static_cast(node); + if (pn->isAttached()) + name.prepend(pn->element() + QLatin1Char('.')); } name = "<@name>" + name + ""; QString synopsis = name; @@ -1109,15 +1113,15 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, if (qmlClassNode) { if (style == Summary) { FastSection qmlproperties(qmlClassNode, - "QML Properties", + "Properties", "property", "properties"); FastSection qmlattachedproperties(qmlClassNode, - "QML Attached Properties", + "Attached Properties", "property", "properties"); FastSection qmlsignals(qmlClassNode, - "QML Signals", + "Signals", "signal", "signals"); FastSection qmlattachedsignals(qmlClassNode, @@ -1125,7 +1129,7 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, "signal", "signals"); FastSection qmlmethods(qmlClassNode, - "QML Methods", + "Methods", "method", "methods"); FastSection qmlattachedmethods(qmlClassNode, @@ -1173,12 +1177,12 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, append(sections,qmlattachedmethods); } else if (style == Detailed) { - FastSection qmlproperties(qmlClassNode,"QML Property Documentation"); - FastSection qmlattachedproperties(qmlClassNode,"QML Attached Property Documentation"); - FastSection qmlsignals(qmlClassNode,"QML Signal Documentation"); - FastSection qmlattachedsignals(qmlClassNode,"QML Attached Signal Documentation"); - FastSection qmlmethods(qmlClassNode,"QML Method Documentation"); - FastSection qmlattachedmethods(qmlClassNode,"QML Attached Method Documentation"); + FastSection qmlproperties(qmlClassNode, "Property Documentation"); + FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation"); + FastSection qmlsignals(qmlClassNode,"Signal Documentation"); + FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation"); + FastSection qmlmethods(qmlClassNode,"Method Documentation"); + FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation"); NodeList::ConstIterator c = qmlClassNode->childNodes().begin(); while (c != qmlClassNode->childNodes().end()) { if ((*c)->subType() == Node::QmlPropertyGroup) { diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 843bec8..cabbe38 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -799,14 +799,26 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc, } } if (qmlPropGroup) { - new QmlPropertyNode(qmlPropGroup,property,type,attached); + const ClassNode *correspondingClass = static_cast(qmlPropGroup->parent())->classNode(); + PropertyNode *correspondingProperty = 0; + if (correspondingClass) + correspondingProperty = static_cast((Node*)correspondingClass->findNode(property, Node::Property)); + QmlPropertyNode *qmlPropNode = new QmlPropertyNode(qmlPropGroup,property,type,attached); + if (correspondingProperty) { + bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*'); + qmlPropNode->setWritable(writableList || correspondingProperty->isWritable()); + } ++arg; while (arg != args.end()) { if (splitQmlPropertyArg(doc,(*arg),type,element,property)) { - new QmlPropertyNode(qmlPropGroup, + QmlPropertyNode * qmlPropNode = new QmlPropertyNode(qmlPropGroup, property, type, attached); + if (correspondingProperty) { + bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*'); + qmlPropNode->setWritable(writableList || correspondingProperty->isWritable()); + } } ++arg; } @@ -1751,9 +1763,10 @@ bool CppCodeParser::matchProperty(InnerNode *parent) if (key == "READ") tre->addPropertyFunction(property, value, PropertyNode::Getter); - else if (key == "WRITE") + else if (key == "WRITE") { tre->addPropertyFunction(property, value, PropertyNode::Setter); - else if (key == "STORED") + property->setWritable(true); + } else if (key == "STORED") property->setStored(value.toLower() == "true"); else if (key == "DESIGNABLE") property->setDesignable(value.toLower() == "true"); diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 748390f..f4931b8 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -2841,6 +2841,10 @@ void Doc::initialize(const Config& config) DocParser::sourceDirs = config.getStringList(CONFIG_SOURCEDIRS); DocParser::quoting = config.getBool(CONFIG_QUOTINGINFORMATION); +#ifdef QDOC_QML + QmlClassNode::qmlOnly = config.getBool(CONFIG_QMLONLY); +#endif + QStringMap reverseAliasMap; QSet commands = config.subVars(CONFIG_ALIAS); diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp index 4973387..52f54c0 100644 --- a/tools/qdoc3/helpprojectwriter.cpp +++ b/tools/qdoc3/helpprojectwriter.cpp @@ -187,8 +187,16 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const details << node->parent()->name()+"::"+node->name(); } else if (node->type() == Node::Fake) { const FakeNode *fake = static_cast(node); - details << fake->fullTitle(); - details << fake->fullTitle(); +#ifdef QDOC_QML + if (fake->subType() == Node::QmlClass) { + details << (QmlClassNode::qmlOnly ? fake->name() : fake->fullTitle()); + details << "QML." + fake->name(); + } else +#endif + { + details << fake->fullTitle(); + details << fake->fullTitle(); + } } else { details << node->name(); details << node->name(); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index eaf4b2e..afd1e74 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4192,13 +4192,15 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, const QmlPropGroupNode* qpgn = static_cast(node); NodeList::ConstIterator p = qpgn->childNodes().begin(); out() << "
"; - out() << ""; + out() << "
"; while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { qpn = static_cast(*p); out() << ""; if (qpgn->isDefault()) { @@ -4279,7 +4281,7 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn, } /*! - Output the "[Xxx instantiates the C++ class QFxXxx]" + Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]" line for the QML element, if there should be one. If there is no class node, or if the class node status @@ -4309,7 +4311,7 @@ void HtmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, } /*! - Output the "[QFxXxx is instantiated by QML element Xxx]" + Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]" line for the class, if there should be one. If there is no QML element, or if the class node status diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 61855bc..ecb4a44 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1127,6 +1127,8 @@ bool TargetNode::isInnerNode() const } #ifdef QDOC_QML +bool QmlClassNode::qmlOnly = false; + /*! Constructor for the Qml class node. */ @@ -1135,7 +1137,7 @@ QmlClassNode::QmlClassNode(InnerNode *parent, const ClassNode* cn) : FakeNode(parent, name, QmlClass), cnode(cn) { - setTitle("QML " + name + " Element Reference"); + setTitle((qmlOnly ? "" : "QML ") + name + " Element Reference"); } /*! diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 20ccb95..5712879 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -362,6 +362,8 @@ class QmlClassNode : public FakeNode const ClassNode* classNode() const { return cnode; } virtual QString fileBase() const; + static bool qmlOnly; + private: const ClassNode* cnode; }; @@ -374,7 +376,7 @@ class QmlPropGroupNode : public FakeNode bool attached); virtual ~QmlPropGroupNode() { } - const QString& element() const { return name(); } + const QString& element() const { return parent()->name(); } void setDefault() { isdefault = true; } bool isDefault() const { return isdefault; } bool isAttached() const { return att; } @@ -396,14 +398,16 @@ class QmlPropertyNode : public LeafNode void setDataType(const QString& dataType) { dt = dataType; } void setStored(bool stored) { sto = toTrool(stored); } void setDesignable(bool designable) { des = toTrool(designable); } + void setWritable(bool writable) { wri = toTrool(writable); } const QString &dataType() const { return dt; } QString qualifiedDataType() const { return dt; } bool isStored() const { return fromTrool(sto,true); } bool isDesignable() const { return fromTrool(des,false); } + bool isWritable() const { return fromTrool(wri,true); } bool isAttached() const { return att; } - const QString& element() const { return parent()->name(); } + const QString& element() const { return static_cast(parent())->element(); } private: enum Trool { Trool_True, Trool_False, Trool_Default }; @@ -414,6 +418,7 @@ class QmlPropertyNode : public LeafNode QString dt; Trool sto; Trool des; + Trool wri; bool att; }; @@ -635,6 +640,7 @@ class PropertyNode : public LeafNode void addSignal(FunctionNode *function, FunctionRole role); void setStored(bool stored) { sto = toTrool(stored); } void setDesignable(bool designable) { des = toTrool(designable); } + void setWritable(bool writable) { wri = toTrool(writable); } void setOverriddenFrom(const PropertyNode *baseProperty); const QString &dataType() const { return dt; } @@ -647,6 +653,7 @@ class PropertyNode : public LeafNode NodeList notifiers() const { return functions(Notifier); } bool isStored() const { return fromTrool(sto, storedDefault()); } bool isDesignable() const { return fromTrool(des, designableDefault()); } + bool isWritable() const { return fromTrool(wri, writableDefault()); } const PropertyNode *overriddenFrom() const { return overrides; } private: @@ -657,11 +664,13 @@ class PropertyNode : public LeafNode bool storedDefault() const { return true; } bool designableDefault() const { return !setters().isEmpty(); } + bool writableDefault() const { return !setters().isEmpty(); } QString dt; NodeList funcs[NumFunctionRoles]; Trool sto; Trool des; + Trool wri; const PropertyNode *overrides; }; diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index 320da66..b8cae8e 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -268,10 +268,15 @@ span.string,span.char border-style: solid; border-color: #ddd; font-weight: bold; - padding: 6px 0px 6px 10px; + padding: 6px 10px 6px 10px; margin: 42px 0px 0px 0px; } +.qmlreadonly { + float: right; + color: red +} + .qmldoc { } diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf index 1efc215..dcf33dc 100644 --- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf +++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf @@ -69,6 +69,7 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \ QT_END_NAMESPACE \ QT_END_INCLUDE_NAMESPACE \ PHONON_EXPORT \ + Q_DECLARATIVE_EXPORT \ Q_GADGET \ QWEBKIT_EXPORT Cpp.ignoredirectives = Q_DECLARE_HANDLE \ -- cgit v0.12 From 714f255d1da79c8824531fdea580d2ad7364e00b Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 4 Nov 2009 13:14:24 +1000 Subject: Declarative building infrastructure. Does nothing if no declarative directories installed. --- bin/syncqt | 2 ++ configure | 39 +++++++++++++++++++++++++++++++++++++-- mkspecs/features/qt.prf | 3 ++- src/corelib/global/qglobal.h | 13 +++++++++++++ src/src.pro | 5 +++++ tests/auto/auto.pro | 2 ++ tools/configure/configureapp.cpp | 12 ++++++++++++ tools/tools.pro | 1 + 8 files changed, 74 insertions(+), 3 deletions(-) diff --git a/bin/syncqt b/bin/syncqt index 6605bfa..a14a82d 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -31,6 +31,7 @@ my %modules = ( # path to module name map "QtSql" => "$basedir/src/sql", "QtNetwork" => "$basedir/src/network", "QtSvg" => "$basedir/src/svg", + "QtDeclarative" => "$basedir/src/declarative", "QtScript" => "$basedir/src/script", "QtScriptTools" => "$basedir/src/scripttools", "Qt3Support" => "$basedir/src/qt3support", @@ -682,6 +683,7 @@ foreach (@modules_to_sync) { $master_contents .= "#include \n" if("$_" eq "gui"); $master_contents .= "#include \n" if("$_" eq "network"); $master_contents .= "#include \n" if("$_" eq "svg"); + $master_contents .= "#include \n" if("$_" eq "declarative"); $master_contents .= "#include \n" if("$_" eq "script"); $master_contents .= "#include \n" if("$_" eq "scripttools"); $master_contents .= "#include \n" if("$_" eq "qt3support"); diff --git a/configure b/configure index e3022b7..9c3e417 100755 --- a/configure +++ b/configure @@ -673,6 +673,7 @@ CFG_PHONON=auto CFG_PHONON_BACKEND=yes CFG_MULTIMEDIA=yes CFG_SVG=yes +CFG_DECLARATIVE=auto CFG_WEBKIT=auto # (yes|no|auto) CFG_JAVASCRIPTCORE_JIT=auto @@ -913,7 +914,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style yes options - -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-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|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config) + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-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) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` VAL=yes ;; @@ -1844,6 +1845,17 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi fi + ;; + declarative) + if [ "$VAL" = "yes" ]; then + CFG_DECLARATIVE="yes" + else + if [ "$VAL" = "no" ]; then + CFG_DECLARATIVE="no" + else + UNKNOWN_OPT=yes + fi + fi ;; webkit) if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then @@ -3233,7 +3245,7 @@ Usage: $relconf [-h] [-prefix ] [-prefix-install] [-bindir ] [-libdir [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-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-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative] [additional platform specific options (see below)] @@ -3391,6 +3403,9 @@ fi -no-scripttools .... Do not build the QtScriptTools module. + -scripttools ....... Build the QtScriptTools module. + + -no-declarative .....Do not build the declarative module. + -declarative ....... Build the declarative module. + -platform target ... The operating system and compiler you are building on ($PLATFORM). @@ -5788,6 +5803,19 @@ if [ "$CFG_ALSA" = "auto" ]; then fi fi +if [ -f "$relpath/src/declarative/declarative.pro" ]; then + if [ "$CFG_DECLARATIVE" = "auto" ]; then + CFG_DECLARATIVE=yes + fi +else + if [ "$CFG_DECLARATIVE" = "auto" ] || [ "$CFG_DECLARATIVE" = "no" ]; then + CFG_DECLARATIVE=no + else + echo "Error: Unable to locate the qt-declarative package. Refer to the documentation on how to build the package." + exit 1 + fi +fi + if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS @@ -6405,6 +6433,12 @@ else QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SVG" fi +if [ "$CFG_DECLARATIVE" = "yes" ]; then + QT_CONFIG="$QT_CONFIG declarative" +else + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DECLARATIVE" +fi + if [ "$CFG_WEBKIT" = "auto" ]; then CFG_WEBKIT="$canBuildWebKit" fi @@ -7321,6 +7355,7 @@ if [ "$CFG_WEBKIT" = "yes" ]; then echo "JavaScriptCore JIT .. $CFG_JAVASCRIPTCORE_JIT" fi fi +echo "Declarative module .. $CFG_DECLARATIVE" echo "STL support ......... $CFG_STL" echo "PCH support ......... $CFG_PRECOMPILE" echo "MMX/3DNOW/SSE/SSE2.. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}" diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 7f7d882..af93f11 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -36,7 +36,7 @@ INCLUDEPATH = $$QMAKE_INCDIR_QT $$INCLUDEPATH #prepending prevents us from picki win32:INCLUDEPATH += $$QMAKE_INCDIR_QT/ActiveQt # As order does matter for static libs, we reorder the QT variable here -TMPLIBS = webkit phonon multimedia dbus testlib script scripttools svg qt3support sql xmlpatterns xml egl opengl openvg gui network core +TMPLIBS = declarative webkit phonon multimedia dbus testlib script scripttools svg qt3support sql xmlpatterns xml egl opengl openvg gui network core for(QTLIB, $$list($$TMPLIBS)) { contains(QT, $$QTLIB): QT_ORDERED += $$QTLIB } @@ -169,6 +169,7 @@ for(QTLIB, $$list($$lower($$unique(QT)))) { symbian:isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x040000 0x1600000 } else:isEqual(QTLIB, webkit):qlib = QtWebKit + else:isEqual(QTLIB, declarative):qlib = QtDeclarative else:isEqual(QTLIB, multimedia):qlib = QtMultimedia else:message("Unknown QT: $$QTLIB"):qlib = !isEmpty(qlib) { diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index cbb8fda..1dbdc6d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1207,6 +1207,11 @@ class QDataStream; # else # define Q_SVG_EXPORT Q_DECL_IMPORT # endif +# if defined(QT_BUILD_DECLARATIVE_LIB) +# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT +# else +# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT +# endif # if defined(QT_BUILD_OPENGL_LIB) # define Q_OPENGL_EXPORT Q_DECL_EXPORT # else @@ -1259,6 +1264,7 @@ class QDataStream; # define Q_SQL_EXPORT Q_DECL_IMPORT # define Q_NETWORK_EXPORT Q_DECL_IMPORT # define Q_SVG_EXPORT Q_DECL_IMPORT +# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT # define Q_CANVAS_EXPORT Q_DECL_IMPORT # define Q_OPENGL_EXPORT Q_DECL_IMPORT # define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT @@ -1287,6 +1293,7 @@ class QDataStream; # define Q_SQL_EXPORT Q_DECL_EXPORT # define Q_NETWORK_EXPORT Q_DECL_EXPORT # define Q_SVG_EXPORT Q_DECL_EXPORT +# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT # define Q_OPENGL_EXPORT Q_DECL_EXPORT # define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT # define Q_OPENVG_EXPORT Q_DECL_EXPORT @@ -1301,6 +1308,7 @@ class QDataStream; # define Q_SQL_EXPORT # define Q_NETWORK_EXPORT # define Q_SVG_EXPORT +# define Q_DECLARATIVE_EXPORT # define Q_OPENGL_EXPORT # define Q_MULTIMEDIA_EXPORT # define Q_XML_EXPORT @@ -2462,6 +2470,7 @@ Q_CORE_EXPORT int qt_symbian_exception2Error(const std::exception& ex); #define QT_MODULE_SCRIPTTOOLS 0x10000 #define QT_MODULE_OPENVG 0x20000 #define QT_MODULE_MULTIMEDIA 0x40000 +#define QT_MODULE_DECLARATIVE 0x80000 /* Qt editions */ #define QT_EDITION_CONSOLE (QT_MODULE_CORE \ @@ -2492,6 +2501,7 @@ Q_CORE_EXPORT int qt_symbian_exception2Error(const std::exception& ex); | QT_MODULE_QT3SUPPORTLIGHT \ | QT_MODULE_QT3SUPPORT \ | QT_MODULE_SVG \ + | QT_MODULE_DECLARATIVE \ | QT_MODULE_GRAPHICSVIEW \ | QT_MODULE_HELP \ | QT_MODULE_TEST \ @@ -2563,6 +2573,9 @@ QT_LICENSED_MODULE(Qt3Support) #if (QT_EDITION & QT_MODULE_SVG) QT_LICENSED_MODULE(Svg) #endif +#if (QT_EDITION & QT_MODULE_DECLARATIVE) +QT_LICENSED_MODULE(Declarative) +#endif #if (QT_EDITION & QT_MODULE_ACTIVEQT) QT_LICENSED_MODULE(ActiveQt) #endif diff --git a/src/src.pro b/src/src.pro index 238f534..5307612 100644 --- a/src/src.pro +++ b/src/src.pro @@ -32,6 +32,7 @@ contains(QT_CONFIG, webkit) { } contains(QT_CONFIG, script): SRC_SUBDIRS += src_script contains(QT_CONFIG, scripttools): SRC_SUBDIRS += src_scripttools +contains(QT_CONFIG, declarative): SRC_SUBDIRS += src_declarative SRC_SUBDIRS += src_plugins src_s60main.subdir = $$QT_SOURCE_TREE/src/s60main @@ -92,6 +93,8 @@ src_javascriptcore.subdir = $$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore src_javascriptcore.target = sub-javascriptcore src_webkit.subdir = $$QT_SOURCE_TREE/src/3rdparty/webkit/WebCore src_webkit.target = sub-webkit +src_declarative.subdir = $$QT_SOURCE_TREE/src/declarative +src_declarative.target = sub-declarative #CONFIG += ordered !wince*:!symbian:!ordered { @@ -118,10 +121,12 @@ src_webkit.target = sub-webkit src_tools_uic3.depends = src_qt3support src_xml src_tools_idc.depends = src_corelib src_tools_activeqt.depends = src_tools_idc src_gui + src_declarative.depends = src_xml src_gui src_script src_network src_svg src_plugins.depends = src_gui src_sql src_svg contains(QT_CONFIG, webkit) { src_webkit.depends = src_gui src_sql src_network src_xml contains(QT_CONFIG, phonon):src_webkit.depends += src_phonon + contains(QT_CONFIG, declarative):src_declarative.depends += src_webkit #exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore } contains(QT_CONFIG, qt3support): src_plugins.depends += src_qt3support diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 0f7a7f1..1ec4c16 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -501,3 +501,5 @@ contains(QT_CONFIG, webkit): SUBDIRS += \ qwebhistoryinterface \ qwebelement \ qwebhistory + +contains(QT_CONFIG, declarative): SUBDIRS += declarative diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 3f891f6..e2b7d58 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -249,6 +249,7 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "MULTIMEDIA" ] = "yes"; dictionary[ "DIRECTSHOW" ] = "no"; dictionary[ "WEBKIT" ] = "auto"; + dictionary[ "DECLARATIVE" ] = "no"; dictionary[ "PLUGIN_MANIFESTS" ] = "yes"; QString version; @@ -905,6 +906,10 @@ void Configure::parseCmdLine() dictionary[ "WEBKIT" ] = "no"; } else if( configCmdLine.at(i) == "-webkit" ) { dictionary[ "WEBKIT" ] = "yes"; + } else if( configCmdLine.at(i) == "-no-declarative" ) { + dictionary[ "DECLARATIVE" ] = "no"; + } else if( configCmdLine.at(i) == "-declarative" ) { + dictionary[ "DECLARATIVE" ] = "yes"; } else if( configCmdLine.at(i) == "-no-plugin-manifests" ) { dictionary[ "PLUGIN_MANIFESTS" ] = "no"; } else if( configCmdLine.at(i) == "-plugin-manifests" ) { @@ -1745,6 +1750,8 @@ bool Configure::displayHelp() desc("SCRIPT", "yes", "-script", "Build the QtScript module."); desc("SCRIPTTOOLS", "no", "-no-scripttools", "Do not build the QtScriptTools module."); desc("SCRIPTTOOLS", "yes", "-scripttools", "Build the QtScriptTools module."); + desc("DECLARATIVE", "no", "-no-declarative", "Do not build the declarative module"); + desc("DECLARATIVE", "yes", "-declarative", "Build the declarative module"); desc( "-arch ", "Specify an architecture.\n" "Available values for :"); @@ -2507,6 +2514,9 @@ void Configure::generateOutputVars() if (dictionary["WEBKIT"] == "yes") qtConfig += "webkit"; + if (dictionary["DECLARATIVE"] == "yes") + qtConfig += "declarative"; + // We currently have no switch for QtSvg, so add it unconditionally. qtConfig += "svg"; @@ -2875,6 +2885,7 @@ void Configure::generateConfigfiles() if(dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS"; if(dictionary["IPV6"] == "no") qconfigList += "QT_NO_IPV6"; if(dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT"; + if(dictionary["DECLARATIVE"] == "no") qconfigList += "QT_NO_DECLARATIVE"; if(dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON"; if(dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA"; if(dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS"; @@ -3173,6 +3184,7 @@ void Configure::displayConfig() cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl; cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl; cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl; + cout << "Declarative support........." << dictionary[ "DECLARATIVE" ] << endl; cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl; cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl; cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl; diff --git a/tools/tools.pro b/tools/tools.pro index 4b36115..87ba3c9 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -26,6 +26,7 @@ mac { embedded:SUBDIRS += kmap2qmap +contains(QT_CONFIG, declarative):SUBDIRS += qmlviewer qmldebugger contains(QT_CONFIG, dbus):SUBDIRS += qdbus !wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator embedded: SUBDIRS += makeqpf -- cgit v0.12 From bd0fe34b7ae7ece37f013c193c28cce4fe8ba9ec Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 4 Nov 2009 07:45:27 +0000 Subject: Removed some logging from MMF Phonon backend Reviewed-by: trustme --- src/3rdparty/phonon/mmf/ancestormovemonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp index 876499c..0447d57 100644 --- a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp @@ -116,7 +116,7 @@ bool AncestorMoveMonitor::eventFilter(QObject *watched, QEvent *event) if(event->type() == QEvent::Move || event->type() == QEvent::ParentChange) { - TRACE_ENTRY("watched 0x%08x event.type %d", watched, event->type()); + //TRACE_ENTRY("watched 0x%08x event.type %d", watched, event->type()); const Hash::const_iterator it = m_hash.find(watched); if(it != m_hash.end()) { @@ -141,7 +141,7 @@ bool AncestorMoveMonitor::eventFilter(QObject *watched, QEvent *event) } } - TRACE_EXIT_0(); + //TRACE_EXIT_0(); } // The event is never consumed by this filter -- cgit v0.12 From 14238b8f58b2f7496cde8b829870a6180286ea14 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 4 Nov 2009 17:53:51 +1000 Subject: QAbstractVideoSurface API review changes. Rename isStarted() and startedChanged() to is active() and activeChanged(). Remove the the similar format argument from isFormatSupported() and add a new nearestFormat() function which provides the same functionality. Reviewed-by: Justin McPherson --- .../multimedia/videographicsitem/videoitem.cpp | 2 +- .../multimedia/videographicsitem/videoplayer.cpp | 3 +- examples/multimedia/videowidget/videoplayer.cpp | 3 +- examples/multimedia/videowidget/videowidget.cpp | 2 +- src/multimedia/video/qabstractvideosurface.cpp | 60 ++++++++++++++-------- src/multimedia/video/qabstractvideosurface.h | 8 +-- src/multimedia/video/qabstractvideosurface_p.h | 5 +- .../tst_qabstractvideosurface.cpp | 38 ++++++++++---- 8 files changed, 76 insertions(+), 45 deletions(-) diff --git a/examples/multimedia/videographicsitem/videoitem.cpp b/examples/multimedia/videographicsitem/videoitem.cpp index c95e335..2d7b38e 100644 --- a/examples/multimedia/videographicsitem/videoitem.cpp +++ b/examples/multimedia/videographicsitem/videoitem.cpp @@ -129,7 +129,7 @@ void VideoItem::stop() bool VideoItem::present(const QVideoFrame &frame) { if (!framePainted) { - if (!isStarted()) + if (!QAbstractVideoSurface::isActive()) setError(StoppedError); return false; diff --git a/examples/multimedia/videographicsitem/videoplayer.cpp b/examples/multimedia/videographicsitem/videoplayer.cpp index 83644db..9ac4152 100644 --- a/examples/multimedia/videographicsitem/videoplayer.cpp +++ b/examples/multimedia/videographicsitem/videoplayer.cpp @@ -119,8 +119,7 @@ void VideoPlayer::openFile() QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); if (!fileName.isEmpty()) { - if (videoItem->isStarted()) - videoItem->stop(); + videoItem->stop(); movie.setFileName(fileName); diff --git a/examples/multimedia/videowidget/videoplayer.cpp b/examples/multimedia/videowidget/videoplayer.cpp index ed24714..cd146e8 100644 --- a/examples/multimedia/videowidget/videoplayer.cpp +++ b/examples/multimedia/videowidget/videoplayer.cpp @@ -100,8 +100,7 @@ void VideoPlayer::openFile() QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); if (!fileName.isEmpty()) { - if (surface->isStarted()) - surface->stop(); + surface->stop(); movie.setFileName(fileName); diff --git a/examples/multimedia/videowidget/videowidget.cpp b/examples/multimedia/videowidget/videowidget.cpp index 80688e1..f73a52f 100644 --- a/examples/multimedia/videowidget/videowidget.cpp +++ b/examples/multimedia/videowidget/videowidget.cpp @@ -84,7 +84,7 @@ void VideoWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - if (surface->isStarted()) { + if (surface->isActive()) { const QRect videoRect = surface->videoRect(); if (!videoRect.contains(event->rect())) { diff --git a/src/multimedia/video/qabstractvideosurface.cpp b/src/multimedia/video/qabstractvideosurface.cpp index a4f51a2..33dc815 100644 --- a/src/multimedia/video/qabstractvideosurface.cpp +++ b/src/multimedia/video/qabstractvideosurface.cpp @@ -57,8 +57,8 @@ QT_BEGIN_NAMESPACE of each frame is compatible with a stream format supplied when starting a presentation. A list of pixel formats a surface can present is given by the supportedPixelFormats() function, - and the isFormatSupported() function will test if a complete video format is supported. In - some cases when a format is not supported; isFormatSupported() may suggest a similar format. + and the isFormatSupported() function will test if a video surface format is supported. If a + format is not supported the nearestFormat() function may be able to suggest a similar format. For example if a surface supports fixed set of resolutions it may suggest the smallest supported resolution that contains the proposed resolution. @@ -118,21 +118,37 @@ QAbstractVideoSurface::~QAbstractVideoSurface() */ /*! - Tests a video \a format to determine if a surface can accept it. If the format isn't supported - the surface may suggest a \a similar format that is supported. + Tests a video surface \a format to determine if a surface can accept it. Returns true if the format is supported by the surface, and false otherwise. */ -bool QAbstractVideoSurface::isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const +bool QAbstractVideoSurface::isFormatSupported(const QVideoSurfaceFormat &format) const { - Q_UNUSED(similar); - return supportedPixelFormats(format.handleType()).contains(format.pixelFormat()); } /*! + Returns a supported video surface format that is similar to \a format. + + A similar surface format is one that has the same \l {QVideoSurfaceFormat::pixelFormat()}{pixel + format} and \l {QVideoSurfaceFormat::handleType()}{handle type} but differs in some of the other + properties. For example if there are restrictions on the \l {QVideoSurfaceFormat::frameSize()} + {frame sizes} a video surface can accept it may suggest a format with a larger frame size and + a \l {QVideoSurfaceFormat::viewport()}{viewport} the size of the original frame size. + + If the format is already supported it will be returned unchanged, or if there is no similar + supported format an invalid format will be returned. +*/ + +QVideoSurfaceFormat QAbstractVideoSurface::nearestFormat(const QVideoSurfaceFormat &format) const +{ + return isFormatSupported(format) + ? format + : QVideoSurfaceFormat(); +} + +/*! \fn QAbstractVideoSurface::supportedFormatsChanged() Signals that the set of formats supported by a video surface has changed. @@ -162,23 +178,23 @@ QVideoSurfaceFormat QAbstractVideoSurface::surfaceFormat() const Returns true if the surface was started, and false if an error occurred. - \sa isStarted(), stop() + \sa isActive(), stop() */ bool QAbstractVideoSurface::start(const QVideoSurfaceFormat &format) { Q_D(QAbstractVideoSurface); - bool wasStarted = d->started; + bool wasActive = d->active; - d->started = true; + d->active = true; d->format = format; d->error = NoError; emit surfaceFormatChanged(d->format); - if (!wasStarted) - emit startedChanged(true); + if (!wasActive) + emit activeChanged(true); return true; } @@ -186,18 +202,18 @@ bool QAbstractVideoSurface::start(const QVideoSurfaceFormat &format) /*! Stops a video surface presenting frames and releases any resources acquired in start(). - \sa isStarted(), start() + \sa isActive(), start() */ void QAbstractVideoSurface::stop() { Q_D(QAbstractVideoSurface); - if (d->started) { + if (d->active) { d->format = QVideoSurfaceFormat(); - d->started = false; + d->active = false; - emit startedChanged(false); + emit activeChanged(false); emit surfaceFormatChanged(d->format); } } @@ -208,17 +224,17 @@ void QAbstractVideoSurface::stop() Returns true if the surface has been started, and false otherwise. */ -bool QAbstractVideoSurface::isStarted() const +bool QAbstractVideoSurface::isActive() const { - return d_func()->started; + return d_func()->active; } /*! - \fn QAbstractVideoSurface::startedChanged(bool started) + \fn QAbstractVideoSurface::activeChanged(bool active) - Signals that the \a started state of a video surface has changed. + Signals that the \a active state of a video surface has changed. - \sa isStarted(), start(), stop() + \sa isActive(), start(), stop() */ /*! diff --git a/src/multimedia/video/qabstractvideosurface.h b/src/multimedia/video/qabstractvideosurface.h index 3823eeb..58d06f1 100644 --- a/src/multimedia/video/qabstractvideosurface.h +++ b/src/multimedia/video/qabstractvideosurface.h @@ -75,22 +75,22 @@ public: virtual QList supportedPixelFormats( QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const = 0; - virtual bool isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar = 0) const; + virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const; + virtual QVideoSurfaceFormat nearestFormat(const QVideoSurfaceFormat &format) const; QVideoSurfaceFormat surfaceFormat() const; virtual bool start(const QVideoSurfaceFormat &format); virtual void stop(); - bool isStarted() const; + bool isActive() const; virtual bool present(const QVideoFrame &frame) = 0; Error error() const; Q_SIGNALS: - void startedChanged(bool started); + void activeChanged(bool active); void surfaceFormatChanged(const QVideoSurfaceFormat &format); void supportedFormatsChanged(); diff --git a/src/multimedia/video/qabstractvideosurface_p.h b/src/multimedia/video/qabstractvideosurface_p.h index 3142b78..8675fac 100644 --- a/src/multimedia/video/qabstractvideosurface_p.h +++ b/src/multimedia/video/qabstractvideosurface_p.h @@ -64,14 +64,13 @@ class QAbstractVideoSurfacePrivate : public QObjectPrivate public: QAbstractVideoSurfacePrivate() : error(QAbstractVideoSurface::NoError) - , started(false) + , active(false) { } mutable QAbstractVideoSurface::Error error; QVideoSurfaceFormat format; - bool started; - + bool active; }; QT_END_NAMESPACE diff --git a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp index 20ca759..b4d2ac8 100644 --- a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp +++ b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp @@ -61,6 +61,8 @@ private slots: void setError(); void isFormatSupported_data(); void isFormatSupported(); + void nearestFormat_data(); + void nearestFormat(); void start_data(); void start(); }; @@ -232,6 +234,22 @@ void tst_QAbstractVideoSurface::isFormatSupported() QCOMPARE(surface.isFormatSupported(format), supported); } +void tst_QAbstractVideoSurface::nearestFormat_data() +{ + isFormatSupported_data(); +} + +void tst_QAbstractVideoSurface::nearestFormat() +{ + QFETCH(SupportedFormatMap, supportedFormats); + QFETCH(QVideoSurfaceFormat, format); + QFETCH(bool, supported); + + QtTestVideoSurface surface(supportedFormats); + + QCOMPARE(surface.nearestFormat(format) == format, supported); +} + void tst_QAbstractVideoSurface::start_data() { QTest::addColumn("format"); @@ -256,35 +274,35 @@ void tst_QAbstractVideoSurface::start() surface.setError(QAbstractVideoSurface::ResourceError); QSignalSpy formatSpy(&surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); - QSignalSpy startedSpy(&surface, SIGNAL(startedChanged(bool))); + QSignalSpy activeSpy(&surface, SIGNAL(activeChanged(bool))); - QVERIFY(!surface.isStarted()); + QVERIFY(!surface.isActive()); QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat()); QVERIFY(surface.start(format)); - QVERIFY(surface.isStarted()); + QVERIFY(surface.isActive()); QCOMPARE(surface.surfaceFormat(), format); QCOMPARE(formatSpy.count(), 1); - QCOMPARE(qvariant_cast(formatSpy.at(0).at(0)), format); + QCOMPARE(qvariant_cast(formatSpy.last().at(0)), format); - QCOMPARE(startedSpy.count(), 1); - QCOMPARE(startedSpy.at(0).at(0).toBool(), true); + QCOMPARE(activeSpy.count(), 1); + QCOMPARE(activeSpy.last().at(0).toBool(), true); // error() is reset on a successful start. QCOMPARE(surface.error(), QAbstractVideoSurface::NoError); surface.stop(); - QVERIFY(!surface.isStarted()); + QVERIFY(!surface.isActive()); QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat()); QCOMPARE(formatSpy.count(), 2); - QCOMPARE(qvariant_cast(formatSpy.at(1).at(0)), QVideoSurfaceFormat()); + QCOMPARE(qvariant_cast(formatSpy.last().at(0)), QVideoSurfaceFormat()); - QCOMPARE(startedSpy.count(), 2); - QCOMPARE(startedSpy.at(1).at(0).toBool(), false); + QCOMPARE(activeSpy.count(), 2); + QCOMPARE(activeSpy.last().at(0).toBool(), false); } QTEST_MAIN(tst_QAbstractVideoSurface) -- cgit v0.12 From 70e62dacd529e9257c5bb372a680fe2ec4786a9c Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 4 Nov 2009 17:55:35 +1000 Subject: QVideoSurfaceFormat API review changes. Rename YuvColorSpace enum and related functions to YCbCrColorSpace. Remove ViewportMode enum and make setFrameSize() always reset the viewport to fill the frame. Reviewed-by: Justin McPherson --- src/multimedia/video/qvideosurfaceformat.cpp | 68 ++++++++----------- src/multimedia/video/qvideosurfaceformat.h | 18 ++--- .../tst_qvideosurfaceformat.cpp | 77 ++++++++-------------- 3 files changed, 61 insertions(+), 102 deletions(-) diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp index e6ef8f3..c898e3a 100644 --- a/src/multimedia/video/qvideosurfaceformat.cpp +++ b/src/multimedia/video/qvideosurfaceformat.cpp @@ -57,7 +57,7 @@ public: , handleType(QAbstractVideoBuffer::NoHandle) , scanLineDirection(QVideoSurfaceFormat::TopToBottom) , pixelAspectRatio(1, 1) - , yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) + , ycbcrColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) , frameRate(0.0) { } @@ -71,7 +71,7 @@ public: , scanLineDirection(QVideoSurfaceFormat::TopToBottom) , frameSize(size) , pixelAspectRatio(1, 1) - , yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) + , ycbcrColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) , viewport(QPoint(0, 0), size) , frameRate(0.0) { @@ -84,7 +84,7 @@ public: , scanLineDirection(other.scanLineDirection) , frameSize(other.frameSize) , pixelAspectRatio(other.pixelAspectRatio) - , yuvColorSpace(other.yuvColorSpace) + , ycbcrColorSpace(other.ycbcrColorSpace) , viewport(other.viewport) , frameRate(other.frameRate) , propertyNames(other.propertyNames) @@ -101,7 +101,7 @@ public: && pixelAspectRatio == other.pixelAspectRatio && viewport == other.viewport && frameRatesEqual(frameRate, other.frameRate) - && yuvColorSpace == other.yuvColorSpace + && ycbcrColorSpace == other.ycbcrColorSpace && propertyNames.count() == other.propertyNames.count()) { for (int i = 0; i < propertyNames.count(); ++i) { int j = other.propertyNames.indexOf(propertyNames.at(i)); @@ -125,7 +125,7 @@ public: QVideoSurfaceFormat::Direction scanLineDirection; QSize frameSize; QSize pixelAspectRatio; - QVideoSurfaceFormat::YuvColorSpace yuvColorSpace; + QVideoSurfaceFormat::YCbCrColorSpace ycbcrColorSpace; QRect viewport; qreal frameRate; QList propertyNames; @@ -168,19 +168,10 @@ public: \value BottomToTop Scan lines are arranged from the bottom of the frame to the top. */ -/*! - \enum QVideoSurfaceFormat::ViewportMode - - Enumerates the methods for updating the stream viewport when the frame size is changed. - - \value ResetViewport The viewport is reset to cover an entire frame. - \value KeepViewport The viewport is kept within the bounds the frame. -*/ - /*! - \enum QVideoSurfaceFormat::YuvColorSpace + \enum QVideoSurfaceFormat::YCbCrColorSpace - Enumerates the YUV color space of video frames. + Enumerates the Y'CbCr color space of video frames. \value YCbCr_Undefined No color space is specified. @@ -340,21 +331,13 @@ int QVideoSurfaceFormat::frameHeight() const /*! Sets the size of frames in a video stream to \a size. - The viewport \a mode indicates how the view port should be updated. + This will reset the viewport() to fill the entire frame. */ -void QVideoSurfaceFormat::setFrameSize(const QSize &size, ViewportMode mode) +void QVideoSurfaceFormat::setFrameSize(const QSize &size) { d->frameSize = size; - - switch (mode) { - case ResetViewport: - d->viewport = QRect(QPoint(0, 0), size); - break; - case KeepViewport: - d->viewport = QRect(QPoint(0, 0), size).intersected(d->viewport); - break; - } + d->viewport = QRect(QPoint(0, 0), size); } /*! @@ -362,12 +345,13 @@ void QVideoSurfaceFormat::setFrameSize(const QSize &size, ViewportMode mode) Sets the \a width and \a height of frames in a video stream. - The viewport \a mode indicates how the view port should be updated. + This will reset the viewport() to fill the entire frame. */ -void QVideoSurfaceFormat::setFrameSize(int width, int height, ViewportMode mode) +void QVideoSurfaceFormat::setFrameSize(int width, int height) { - setFrameSize(QSize(width, height), mode); + d->frameSize = QSize(width, height); + d->viewport = QRect(0, 0, width, height); } /*! @@ -458,22 +442,22 @@ void QVideoSurfaceFormat::setPixelAspectRatio(int horizontal, int vertical) } /*! - Returns a YUV color space of a video stream. + Returns the Y'CbCr color space of a video stream. */ -QVideoSurfaceFormat::YuvColorSpace QVideoSurfaceFormat::yuvColorSpace() const +QVideoSurfaceFormat::YCbCrColorSpace QVideoSurfaceFormat::yCbCrColorSpace() const { - return d->yuvColorSpace; + return d->ycbcrColorSpace; } /*! - Sets a YUV color \a space of a video stream. + Sets the Y'CbCr color \a space of a video stream. It is only used with raw YUV frame types. */ -void QVideoSurfaceFormat::setYuvColorSpace(QVideoSurfaceFormat::YuvColorSpace space) +void QVideoSurfaceFormat::setYCbCrColorSpace(QVideoSurfaceFormat::YCbCrColorSpace space) { - d->yuvColorSpace = space; + d->ycbcrColorSpace = space; } /*! @@ -508,7 +492,7 @@ QList QVideoSurfaceFormat::propertyNames() const << "frameRate" << "pixelAspectRatio" << "sizeHint" - << "yuvColorSpace") + << "yCbCrColorSpace") + d->propertyNames; } @@ -540,8 +524,8 @@ QVariant QVideoSurfaceFormat::property(const char *name) const return qVariantFromValue(d->pixelAspectRatio); } else if (qstrcmp(name, "sizeHint") == 0) { return sizeHint(); - } else if (qstrcmp(name, "yuvColorSpace") == 0) { - return qVariantFromValue(d->yuvColorSpace); + } else if (qstrcmp(name, "yCbCrColorSpace") == 0) { + return qVariantFromValue(d->ycbcrColorSpace); } else { int id = 0; for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} @@ -585,9 +569,9 @@ void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value) d->pixelAspectRatio = qvariant_cast(value); } else if (qstrcmp(name, "sizeHint") == 0) { // read only. - } else if (qstrcmp(name, "yuvColorSpace") == 0) { - if (qVariantCanConvert(value)) - d->yuvColorSpace = qvariant_cast(value); + } else if (qstrcmp(name, "yCbCrColorSpace") == 0) { + if (qVariantCanConvert(value)) + d->ycbcrColorSpace = qvariant_cast(value); } else { int id = 0; for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h index 1f4a5cb..ee60244 100644 --- a/src/multimedia/video/qvideosurfaceformat.h +++ b/src/multimedia/video/qvideosurfaceformat.h @@ -68,13 +68,7 @@ public: BottomToTop }; - enum ViewportMode - { - ResetViewport, - KeepViewport - }; - - enum YuvColorSpace + enum YCbCrColorSpace { YCbCr_Undefined, YCbCr_BT601, @@ -106,8 +100,8 @@ public: QAbstractVideoBuffer::HandleType handleType() const; QSize frameSize() const; - void setFrameSize(const QSize &size, ViewportMode mode = ResetViewport); - void setFrameSize(int width, int height, ViewportMode mode = ResetViewport); + void setFrameSize(const QSize &size); + void setFrameSize(int width, int height); int frameWidth() const; int frameHeight() const; @@ -125,8 +119,8 @@ public: void setPixelAspectRatio(const QSize &ratio); void setPixelAspectRatio(int width, int height); - YuvColorSpace yuvColorSpace() const; - void setYuvColorSpace(YuvColorSpace colorSpace); + YCbCrColorSpace yCbCrColorSpace() const; + void setYCbCrColorSpace(YCbCrColorSpace colorSpace); QSize sizeHint() const; @@ -145,7 +139,7 @@ Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoSurfaceFormat &); QT_END_NAMESPACE Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction) -Q_DECLARE_METATYPE(QVideoSurfaceFormat::YuvColorSpace) +Q_DECLARE_METATYPE(QVideoSurfaceFormat::YCbCrColorSpace) QT_END_HEADER diff --git a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp index 9623e80..a47cb48 100644 --- a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp +++ b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp @@ -68,8 +68,8 @@ private slots: void scanLineDirection(); void frameRate_data(); void frameRate(); - void yuvColorSpace_data(); - void yuvColorSpace(); + void yCbCrColorSpace_data(); + void yCbCrColorSpace(); void pixelAspectRatio_data(); void pixelAspectRatio(); void sizeHint_data(); @@ -81,9 +81,6 @@ private slots: void assign(); }; -Q_DECLARE_METATYPE(QVideoSurfaceFormat::ViewportMode) - - tst_QVideoSurfaceFormat::tst_QVideoSurfaceFormat() { } @@ -122,7 +119,7 @@ void tst_QVideoSurfaceFormat::constructNull() QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom); QCOMPARE(format.frameRate(), 0.0); QCOMPARE(format.pixelAspectRatio(), QSize(1, 1)); - QCOMPARE(format.yuvColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); + QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); } void tst_QVideoSurfaceFormat::construct_data() @@ -161,7 +158,7 @@ void tst_QVideoSurfaceFormat::construct() QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom); QCOMPARE(format.frameRate(), 0.0); QCOMPARE(format.pixelAspectRatio(), QSize(1, 1)); - QCOMPARE(format.yuvColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); + QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); } void tst_QVideoSurfaceFormat::frameSize_data() @@ -202,45 +199,23 @@ void tst_QVideoSurfaceFormat::viewport_data() QTest::addColumn("initialSize"); QTest::addColumn("viewport"); QTest::addColumn("newSize"); - QTest::addColumn("viewportMode"); QTest::addColumn("expectedViewport"); QTest::newRow("grow reset") << QSize(64, 64) << QRect(8, 8, 48, 48) << QSize(1024, 1024) - << QVideoSurfaceFormat::ResetViewport << QRect(0, 0, 1024, 1024); - QTest::newRow("grow keep") - << QSize(64, 64) - << QRect(8, 8, 48, 48) - << QSize(1024, 1024) - << QVideoSurfaceFormat::KeepViewport - << QRect(8, 8, 48, 48); QTest::newRow("shrink reset") << QSize(1024, 1024) << QRect(8, 8, 1008, 1008) << QSize(64, 64) - << QVideoSurfaceFormat::ResetViewport << QRect(0, 0, 64, 64); - QTest::newRow("shrink keep") - << QSize(1024, 1024) - << QRect(8, 8, 1008, 1008) - << QSize(64, 64) - << QVideoSurfaceFormat::KeepViewport - << QRect(8, 8, 56, 56); QTest::newRow("unchanged reset") << QSize(512, 512) << QRect(8, 8, 496, 496) << QSize(512, 512) - << QVideoSurfaceFormat::ResetViewport << QRect(0, 0, 512, 512); - QTest::newRow("unchanged keep") - << QSize(512, 512) - << QRect(8, 8, 496, 496) - << QSize(512, 512) - << QVideoSurfaceFormat::KeepViewport - << QRect(8, 8, 496, 496); } void tst_QVideoSurfaceFormat::viewport() @@ -248,7 +223,6 @@ void tst_QVideoSurfaceFormat::viewport() QFETCH(QSize, initialSize); QFETCH(QRect, viewport); QFETCH(QSize, newSize); - QFETCH(QVideoSurfaceFormat::ViewportMode, viewportMode); QFETCH(QRect, expectedViewport); { @@ -261,7 +235,7 @@ void tst_QVideoSurfaceFormat::viewport() QCOMPARE(format.viewport(), viewport); QCOMPARE(format.property("viewport").toRect(), viewport); - format.setFrameSize(newSize, viewportMode); + format.setFrameSize(newSize); QCOMPARE(format.viewport(), expectedViewport); QCOMPARE(format.property("viewport").toRect(), expectedViewport); @@ -350,9 +324,9 @@ void tst_QVideoSurfaceFormat::frameRate() } } -void tst_QVideoSurfaceFormat::yuvColorSpace_data() +void tst_QVideoSurfaceFormat::yCbCrColorSpace_data() { - QTest::addColumn("colorspace"); + QTest::addColumn("colorspace"); QTest::newRow("undefined") << QVideoSurfaceFormat::YCbCr_Undefined; @@ -364,24 +338,24 @@ void tst_QVideoSurfaceFormat::yuvColorSpace_data() << QVideoSurfaceFormat::YCbCr_JPEG; } -void tst_QVideoSurfaceFormat::yuvColorSpace() +void tst_QVideoSurfaceFormat::yCbCrColorSpace() { - QFETCH(QVideoSurfaceFormat::YuvColorSpace, colorspace); + QFETCH(QVideoSurfaceFormat::YCbCrColorSpace, colorspace); { QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32); - format.setYuvColorSpace(colorspace); + format.setYCbCrColorSpace(colorspace); - QCOMPARE(format.yuvColorSpace(), colorspace); - QCOMPARE(qvariant_cast(format.property("yuvColorSpace")), + QCOMPARE(format.yCbCrColorSpace(), colorspace); + QCOMPARE(qvariant_cast(format.property("yCbCrColorSpace")), colorspace); } { QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32); - format.setProperty("yuvColorSpace", qVariantFromValue(colorspace)); + format.setProperty("yCbCrColorSpace", qVariantFromValue(colorspace)); - QCOMPARE(format.yuvColorSpace(), colorspace); - QCOMPARE(qvariant_cast(format.property("yuvColorSpace")), + QCOMPARE(format.yCbCrColorSpace(), colorspace); + QCOMPARE(qvariant_cast(format.property("yCbCrColorSpace")), colorspace); } } @@ -483,7 +457,7 @@ void tst_QVideoSurfaceFormat::staticPropertyNames() QVERIFY(propertyNames.contains("scanLineDirection")); QVERIFY(propertyNames.contains("frameRate")); QVERIFY(propertyNames.contains("pixelAspectRatio")); - QVERIFY(propertyNames.contains("yuvColorSpace")); + QVERIFY(propertyNames.contains("yCbCrColorSpace")); QVERIFY(propertyNames.contains("sizeHint")); QCOMPARE(propertyNames.count(), 10); } @@ -566,19 +540,26 @@ void tst_QVideoSurfaceFormat::compare() QCOMPARE(format1 == format4, false); QCOMPARE(format1 != format4, true); - format2.setFrameSize(1024, 768, QVideoSurfaceFormat::ResetViewport); + format2.setFrameSize(1024, 768); // Not equal, frame size differs. QCOMPARE(format1 == format2, false); QCOMPARE(format1 != format2, true); - format1.setFrameSize(1024, 768, QVideoSurfaceFormat::KeepViewport); + format1.setFrameSize(1024, 768); + + // Equal. + QCOMPARE(format1 == format2, true); + QCOMPARE(format1 != format2, false); + + format1.setViewport(QRect(0, 0, 800, 600)); + format2.setViewport(QRect(112, 84, 800, 600)); - // Not equal, viewport differs. + // Not equal, viewports differ. QCOMPARE(format1 == format2, false); QCOMPARE(format1 != format2, true); - format1.setViewport(QRect(0, 0, 1024, 768)); + format1.setViewport(QRect(112, 84, 800, 600)); // Equal. QCOMPARE(format1 == format2, true); @@ -620,13 +601,13 @@ void tst_QVideoSurfaceFormat::compare() QCOMPARE(format1 == format2, true); QCOMPARE(format1 != format2, false); - format2.setYuvColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601); + format2.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601); // Not equal yuv color space differs. QCOMPARE(format1 == format2, false); QCOMPARE(format1 != format2, true); - format1.setYuvColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601); + format1.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601); // Equal. QCOMPARE(format1 == format2, true); -- cgit v0.12 From db997a02c1d306260d8bbfe4f13e8312efb6fa7c Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 4 Nov 2009 17:56:49 +1000 Subject: QVideoFrame API review changes. Rename equivalentImageFormat() to imageFormatFromPixelFormat(). Rename equivalentPixelFormat() to pixelFormatFromImageFormat(). Rename numBytes() to mappedBytes(). Reviewed-by: Justin McPherson --- .../multimedia/videographicsitem/videoitem.cpp | 2 +- .../multimedia/videowidget/videowidgetsurface.cpp | 4 +-- src/multimedia/video/qvideoframe.cpp | 34 +++++++++++----------- src/multimedia/video/qvideoframe.h | 6 ++-- tests/auto/qvideoframe/tst_qvideoframe.cpp | 18 ++++++------ 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/examples/multimedia/videographicsitem/videoitem.cpp b/examples/multimedia/videographicsitem/videoitem.cpp index 2d7b38e..99e8df8 100644 --- a/examples/multimedia/videographicsitem/videoitem.cpp +++ b/examples/multimedia/videographicsitem/videoitem.cpp @@ -104,7 +104,7 @@ QList VideoItem::supportedPixelFormats( bool VideoItem::start(const QVideoSurfaceFormat &format) { if (isFormatSupported(format)) { - imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); + imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat()); imageSize = format.frameSize(); framePainted = true; diff --git a/examples/multimedia/videowidget/videowidgetsurface.cpp b/examples/multimedia/videowidget/videowidgetsurface.cpp index ec9b8b5..b69375c 100644 --- a/examples/multimedia/videowidget/videowidgetsurface.cpp +++ b/examples/multimedia/videowidget/videowidgetsurface.cpp @@ -73,7 +73,7 @@ bool VideoWidgetSurface::isFormatSupported( { Q_UNUSED(similar); - const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); + const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat()); const QSize size = format.frameSize(); return imageFormat != QImage::Format_Invalid @@ -85,7 +85,7 @@ bool VideoWidgetSurface::isFormatSupported( //! [2] bool VideoWidgetSurface::start(const QVideoSurfaceFormat &format) { - const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); + const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat()); const QSize size = format.frameSize(); if (imageFormat != QImage::Format_Invalid && !size.isEmpty()) { diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp index c884da0..ae38e82 100644 --- a/src/multimedia/video/qvideoframe.cpp +++ b/src/multimedia/video/qvideoframe.cpp @@ -59,7 +59,7 @@ public: : startTime(-1) , endTime(-1) , data(0) - , numBytes(0) + , mappedBytes(0) , bytesPerLine(0) , pixelFormat(QVideoFrame::Format_Invalid) , fieldType(QVideoFrame::ProgressiveFrame) @@ -72,7 +72,7 @@ public: , startTime(-1) , endTime(-1) , data(0) - , numBytes(0) + , mappedBytes(0) , bytesPerLine(0) , pixelFormat(format) , fieldType(QVideoFrame::ProgressiveFrame) @@ -89,7 +89,7 @@ public: qint64 startTime; qint64 endTime; uchar *data; - int numBytes; + int mappedBytes; int bytesPerLine; QVideoFrame::PixelFormat pixelFormat; QVideoFrame::FieldType fieldType; @@ -109,7 +109,7 @@ private: The contents of a video frame can be mapped to memory using the map() function. While mapped the video data can accessed using the bits() function which returns a pointer to a - buffer, the total size of which is given by the numBytes(), and the size of each line is given + buffer, the total size of which is given by the mappedBytes(), and the size of each line is given by bytesPerLine(). The return value of the handle() function may be used to access frame data using the internal buffer's native APIs. @@ -304,12 +304,12 @@ QVideoFrame::QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFo \note This will construct an invalid video frame if there is no frame type equivalent to the image format. - \sa equivalentPixelFormat() + \sa pixelFormatFromImageFormat() */ QVideoFrame::QVideoFrame(const QImage &image) : d(new QVideoFramePrivate( - image.size(), equivalentPixelFormat(image.format()))) + image.size(), pixelFormatFromImageFormat(image.format()))) { if (d->pixelFormat != Format_Invalid) d->buffer = new QImageVideoBuffer(image); @@ -510,9 +510,9 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode) { if (d->buffer != 0 && d->data == 0) { Q_ASSERT(d->bytesPerLine == 0); - Q_ASSERT(d->numBytes == 0); + Q_ASSERT(d->mappedBytes == 0); - d->data = d->buffer->map(mode, &d->numBytes, &d->bytesPerLine); + d->data = d->buffer->map(mode, &d->mappedBytes, &d->bytesPerLine); return d->data != 0; } @@ -532,7 +532,7 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode) void QVideoFrame::unmap() { if (d->data != 0) { - d->numBytes = 0; + d->mappedBytes = 0; d->bytesPerLine = 0; d->data = 0; @@ -548,7 +548,7 @@ void QVideoFrame::unmap() This value is only valid while the frame data is \l {map()}{mapped}. - \sa bits(), map(), numBytes() + \sa bits(), map(), mappedBytes() */ int QVideoFrame::bytesPerLine() const @@ -561,7 +561,7 @@ int QVideoFrame::bytesPerLine() const This value is only valid while the frame data is \l {map()}{mapped}. - \sa map(), numBytes(), bytesPerLine() + \sa map(), mappedBytes(), bytesPerLine() */ uchar *QVideoFrame::bits() @@ -574,7 +574,7 @@ uchar *QVideoFrame::bits() This value is only valid while the frame data is \l {map()}{mapped}. - \sa map(), numBytes(), bytesPerLine() + \sa map(), mappedBytes(), bytesPerLine() */ const uchar *QVideoFrame::bits() const @@ -583,16 +583,16 @@ const uchar *QVideoFrame::bits() const } /*! - Returns the number of bytes occupied by the frame data. + Returns the number of bytes occupied by the mapped frame data. This value is only valid while the frame data is \l {map()}{mapped}. \sa map() */ -int QVideoFrame::numBytes() const +int QVideoFrame::mappedBytes() const { - return d->numBytes; + return d->mappedBytes; } /*! @@ -649,7 +649,7 @@ void QVideoFrame::setEndTime(qint64 time) format QVideoFrame::InvalidType is returned instead. */ -QVideoFrame::PixelFormat QVideoFrame::equivalentPixelFormat(QImage::Format format) +QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat(QImage::Format format) { switch (format) { case QImage::Format_Invalid: @@ -689,7 +689,7 @@ QVideoFrame::PixelFormat QVideoFrame::equivalentPixelFormat(QImage::Format forma format QImage::Format_Invalid is returned instead. */ -QImage::Format QVideoFrame::equivalentImageFormat(PixelFormat format) +QImage::Format QVideoFrame::imageFormatFromPixelFormat(PixelFormat format) { switch (format) { case Format_Invalid: diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h index e1b46a8..d08008b 100644 --- a/src/multimedia/video/qvideoframe.h +++ b/src/multimedia/video/qvideoframe.h @@ -141,7 +141,7 @@ public: uchar *bits(); const uchar *bits() const; - int numBytes() const; + int mappedBytes() const; QVariant handle() const; @@ -151,8 +151,8 @@ public: qint64 endTime() const; void setEndTime(qint64 time); - static PixelFormat equivalentPixelFormat(QImage::Format format); - static QImage::Format equivalentImageFormat(PixelFormat format); + static PixelFormat pixelFormatFromImageFormat(QImage::Format format); + static QImage::Format imageFormatFromPixelFormat(PixelFormat format); private: QExplicitlySharedDataPointer d; diff --git a/tests/auto/qvideoframe/tst_qvideoframe.cpp b/tests/auto/qvideoframe/tst_qvideoframe.cpp index b231069..432ef5c 100644 --- a/tests/auto/qvideoframe/tst_qvideoframe.cpp +++ b/tests/auto/qvideoframe/tst_qvideoframe.cpp @@ -524,7 +524,7 @@ void tst_QVideoFrame::assign() void tst_QVideoFrame::map_data() { QTest::addColumn("size"); - QTest::addColumn("numBytes"); + QTest::addColumn("mappedBytes"); QTest::addColumn("bytesPerLine"); QTest::addColumn("pixelFormat"); QTest::addColumn("mode"); @@ -554,29 +554,29 @@ void tst_QVideoFrame::map_data() void tst_QVideoFrame::map() { QFETCH(QSize, size); - QFETCH(int, numBytes); + QFETCH(int, mappedBytes); QFETCH(int, bytesPerLine); QFETCH(QVideoFrame::PixelFormat, pixelFormat); QFETCH(QAbstractVideoBuffer::MapMode, mode); - QVideoFrame frame(numBytes, size, bytesPerLine, pixelFormat); + QVideoFrame frame(mappedBytes, size, bytesPerLine, pixelFormat); QVERIFY(!frame.bits()); - QCOMPARE(frame.numBytes(), 0); + QCOMPARE(frame.mappedBytes(), 0); QCOMPARE(frame.bytesPerLine(), 0); QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); QVERIFY(frame.map(mode)); QVERIFY(frame.bits()); - QCOMPARE(frame.numBytes(), numBytes); + QCOMPARE(frame.mappedBytes(), mappedBytes); QCOMPARE(frame.bytesPerLine(), bytesPerLine); QCOMPARE(frame.mapMode(), mode); frame.unmap(); QVERIFY(!frame.bits()); - QCOMPARE(frame.numBytes(), 0); + QCOMPARE(frame.mappedBytes(), 0); QCOMPARE(frame.bytesPerLine(), 0); QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); } @@ -614,21 +614,21 @@ void tst_QVideoFrame::mapImage() QVideoFrame frame(image); QVERIFY(!frame.bits()); - QCOMPARE(frame.numBytes(), 0); + QCOMPARE(frame.mappedBytes(), 0); QCOMPARE(frame.bytesPerLine(), 0); QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); QVERIFY(frame.map(mode)); QVERIFY(frame.bits()); - QCOMPARE(frame.numBytes(), image.numBytes()); + QCOMPARE(frame.mappedBytes(), image.numBytes()); QCOMPARE(frame.bytesPerLine(), image.bytesPerLine()); QCOMPARE(frame.mapMode(), mode); frame.unmap(); QVERIFY(!frame.bits()); - QCOMPARE(frame.numBytes(), 0); + QCOMPARE(frame.mappedBytes(), 0); QCOMPARE(frame.bytesPerLine(), 0); QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); } -- cgit v0.12 From 950cd9b3c1ae6a1b462d596a62aea92f9c231afb Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 4 Nov 2009 09:43:55 +0100 Subject: Stabilize tests --- tests/auto/qlistview/tst_qlistview.cpp | 12 ++++++------ tests/auto/qtreeview/tst_qtreeview.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 246f092..1c8fecf 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1788,13 +1788,13 @@ void tst_QListView::task262152_setModelColumnNavigate() view.show(); QTest::qWaitForWindowShown(&view); - QTest::qWait(100); + QTest::qWait(120); QTest::keyClick(&view, Qt::Key_Down); - QTest::qWait(100); - QCOMPARE(view.currentIndex(), model.index(1,1)); + QTest::qWait(30); + QTRY_COMPARE(view.currentIndex(), model.index(1,1)); QTest::keyClick(&view, Qt::Key_Down); - QTest::qWait(100); - QCOMPARE(view.currentIndex(), model.index(2,1)); + QTest::qWait(30); + QTRY_COMPARE(view.currentIndex(), model.index(2,1)); } @@ -1862,7 +1862,7 @@ void tst_QListView::taskQTBUG_435_deselectOnViewportClick() view.setSelectionMode(QAbstractItemView::ExtendedSelection); view.selectAll(); QCOMPARE(view.selectionModel()->selectedIndexes().count(), model.rowCount()); - + QPoint p = view.visualRect(model.index(model.rowCount() - 1)).center() + QPoint(0, 20); //first the left button diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 90e6c5c..58f059b 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -3669,11 +3669,11 @@ void tst_QTreeView::doubleClickedWithSpans() //end the previous edition QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p); - QTest::qWait(100); + QTest::qWait(150); QTest::mousePress(view.viewport(), Qt::LeftButton, 0, p); QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, p); QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, p); - QCOMPARE(spy.count(), 2); + QTRY_COMPARE(spy.count(), 2); } QTEST_MAIN(tst_QTreeView) -- cgit v0.12 From 47546dd3cae4cb6f1ca87621fb3752524f9d050d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 4 Nov 2009 10:06:57 +0100 Subject: Compile on Mac OS X On Mac, there are compat overloads to e.g. setInternalTextureFormat() so we need to specify which function to call to avoid ambiguity. Reviewed-by: Samuel --- src/opengl/qglpixmapfilter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 8768fbc..0eaab28 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -518,7 +518,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const m_singlePass = false; QGLFramebufferObjectFormat format; - format.setInternalTextureFormat(GL_RGBA); + format.setInternalTextureFormat(GLenum(GL_RGBA)); QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size() / 2, format, true); if (!fbo) -- cgit v0.12 From d319fccebfd5f2e7175945275ffc3e73240d766c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 4 Nov 2009 09:45:59 +0000 Subject: Call PositionChanged from QSymbianControl::SizeChanged This is necessitated by the fact that CCoeControl::SetExtent calls SizeChanged, but does not call PositionChanged. This causes a bug in the handling of orientation changes. When the screen orientation changes, QSymbianControl::HandleResourceChange(KInternalStatusPaneChange) is called on the top-level widget. This results in a call to SetExtent. Because PositionChanged was not being called, the outcome was that the size of the widget's data.crect variable was updated, but not its position. This meant that mouse events sent to this widget or any of its children were incorrectly handled: 1. QSymbianControl::HandlePointerEventL works out which widget should receive the event. This uses CCoeControl::PositionRelativeToScreen, and therefore calculates the correct widget. 2. In constructing the QMouseEvent object, QWidget::mapFromGlobal is used to translate the event position into the receiving widget's co-ordinate system. This uses data.crect.topLeft(), therefore giving the wrong value, resulting in the widget's event handler discarding the event. Task-number: QTBUG-4697 Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 2b24011..e65a40e 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -869,6 +869,11 @@ void QSymbianControl::SizeChanged() tlwExtra->inTopLevelResize = false; } } + + // CCoeControl::SetExtent calls SizeChanged, but does not call + // PositionChanged, so we call it here to ensure that the widget's + // position is updated. + PositionChanged(); } void QSymbianControl::PositionChanged() -- cgit v0.12 From bffb6602177476f08710b40a83205b9ab839f6f4 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 4 Nov 2009 10:49:51 +0100 Subject: WebKit line ending fix in AccessibilityAllInOne.cpp. Reviewed-by: TrustMe --- .../accessibility/AccessibilityAllInOne.cpp | 88 +++++++++++----------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp index 04124bd..83cf5d0 100755 --- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp @@ -1,44 +1,44 @@ -/* - * Copyright (C) 2009 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -- cgit v0.12 From 2747f200ce27599af74f01cb629ec8930bae7b44 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Wed, 4 Nov 2009 11:18:40 +0100 Subject: Provide hook that's called when items' stacking order is changed. This is required by the QtDeclarative module. As an isolated change, this is just a noop. It takes effect when somebody reimpements the private virtual function. Reviewed-by: Alan Alpert --- src/gui/graphicsview/qgraphicsitem.cpp | 16 ++++++++++++++++ src/gui/graphicsview/qgraphicsitem_p.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e69a295..e014763 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -4345,6 +4345,12 @@ void QGraphicsItem::stackBefore(const QGraphicsItem *sibling) ++index; } d_ptr->siblingIndex = siblingIndex; + for (int i = 0; i < siblings->size(); ++i) { + int &index = siblings->at(i)->d_ptr->siblingIndex; + if (i != siblingIndex && index >= siblingIndex && index <= myIndex) + siblings->at(i)->d_ptr->siblingOrderChange(); + } + d_ptr->siblingOrderChange(); } } @@ -5342,6 +5348,16 @@ void QGraphicsItemPrivate::subFocusItemChange() /*! \internal + Subclasses can reimplement this function to be notified when its + siblingIndex order is changed. +*/ +void QGraphicsItemPrivate::siblingOrderChange() +{ +} + +/*! + \internal + Tells us if it is a proxy widget */ bool QGraphicsItemPrivate::isProxyWidget() const diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 92d45f6..977fa96 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -431,6 +431,7 @@ public: static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b); void ensureSequentialSiblingIndex(); inline void sendScenePosChange(); + virtual void siblingOrderChange(); QPainterPath cachedClipPath; QRectF childrenBoundingRect; -- cgit v0.12 From 4567799c51b4126c693746e7c5c963faddb40225 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 3 Nov 2009 16:53:33 +0100 Subject: Save the normal geometry on mac before the window is maximized Do the same as on Windows - before the window is maximized save its normal geometry so that when the window is restored we set the geometry back. Task-number: QTBUG-4418 Reviewed-by: Prasanth --- src/gui/kernel/qcocoawindowdelegate_mac.mm | 12 ++++++++++++ src/gui/kernel/qcocoawindowdelegate_mac_p.h | 1 + src/gui/kernel/qwidget_mac.mm | 10 +++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 803a1b1..9fb674e 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -307,6 +307,18 @@ static void cleanupCocoaWindowDelegate() return m_windowHash->value(window); } +- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame +{ + Q_UNUSED(newFrame); + // saving the current window geometry before the window is maximized + QWidget *qwidget = m_windowHash->value(window); + if (qwidget->isWindow() && !(qwidget->windowState() & Qt::WindowMaximized)) { + QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget); + widgetPrivate->topData()->normalGeometry = qwidget->geometry(); + } + return YES; +} + - (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)defaultFrame { NSRect frameToReturn = defaultFrame; diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/gui/kernel/qcocoawindowdelegate_mac_p.h index 3728002..243ba03 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h +++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h @@ -78,6 +78,7 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData) - (void)windowDidResignKey:(NSNotification*)notification; - (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu; - (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard; +- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; @end @protocol NSDrawerDelegate diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 9270220..e6dd0ee 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -730,6 +730,7 @@ static EventTypeSpec window_events[] = { { kEventClassWindow, kEventWindowClose }, { kEventClassWindow, kEventWindowExpanded }, { kEventClassWindow, kEventWindowHidden }, + { kEventClassWindow, kEventWindowZoom }, { kEventClassWindow, kEventWindowZoomed }, { kEventClassWindow, kEventWindowCollapsed }, { kEventClassWindow, kEventWindowToolbarSwitchMode }, @@ -812,6 +813,9 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, QShowEvent qse; QApplication::sendSpontaneousEvent(widget, &qse); + } else if(ekind == kEventWindowZoom) { + widget->d_func()->topData()->normalGeometry = widget->geometry(); + handled_event = false; } else if(ekind == kEventWindowZoomed) { WindowPartCode windowPart; GetEventParameter(event, kEventParamWindowPartCode, @@ -3487,10 +3491,10 @@ void QWidget::setWindowState(Qt::WindowStates newstate) qt_mac_set_fullscreen_mode(true); } else { needShow = isVisible(); - setParent(parentWidget(), d->topData()->savedFlags); - setGeometry(d->topData()->normalGeometry); if(!qApp->desktop()->screenNumber(this)) qt_mac_set_fullscreen_mode(false); + setParent(parentWidget(), d->topData()->savedFlags); + setGeometry(d->topData()->normalGeometry); d->topData()->normalGeometry.setRect(0, 0, -1, -1); } } @@ -3592,7 +3596,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) [window zoom:window]; #endif needSendStateChange = oldstate == windowState(); // Zoom didn't change flags. - } else if(oldstate & Qt::WindowMaximized) { + } else if(oldstate & Qt::WindowMaximized && !(oldstate & Qt::WindowFullScreen)) { #ifndef QT_MAC_USE_COCOA Point idealSize; ZoomWindowIdeal(window, inZoomIn, &idealSize); -- cgit v0.12 From 968eabf3ff6b686867d964f2a3437a228be0ea6b Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 4 Nov 2009 11:57:56 +0200 Subject: Added UIDs to projects lacking them Also added symbianpkgrules.pri include to some examples Reviewed-by: Janne Koskinen --- examples/painting/svggenerator/svggenerator.pro | 5 ++++- examples/xmlpatterns/filetree/filetree.pro | 5 ++++- examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro | 5 +++++ examples/xmlpatterns/recipes/recipes.pro | 5 ++++- examples/xmlpatterns/schema/schema.pro | 5 +++++ examples/xmlpatterns/trafficinfo/trafficinfo.pro | 5 +++++ src/plugins/graphicssystems/openvg/openvg.pro | 2 ++ tools/xmlpatterns/xmlpatterns.pro | 3 +++ tools/xmlpatternsvalidator/xmlpatternsvalidator.pro | 2 ++ 9 files changed, 34 insertions(+), 3 deletions(-) diff --git a/examples/painting/svggenerator/svggenerator.pro b/examples/painting/svggenerator/svggenerator.pro index 1134619..e0e4895 100644 --- a/examples/painting/svggenerator/svggenerator.pro +++ b/examples/painting/svggenerator/svggenerator.pro @@ -14,4 +14,7 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS svggenerator.pro sources.path = $$[QT_INSTALL_EXAMPLES]/painting/svggenerator INSTALLS += target sources -symbian:TARGET.UID3 = 0xA000CF68 \ No newline at end of file +symbian { + TARGET.UID3 = 0xA000CF68 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/xmlpatterns/filetree/filetree.pro b/examples/xmlpatterns/filetree/filetree.pro index 0238c23..1683491 100644 --- a/examples/xmlpatterns/filetree/filetree.pro +++ b/examples/xmlpatterns/filetree/filetree.pro @@ -12,4 +12,7 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xq *.html sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/filetree INSTALLS += target sources -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +symbian { + TARGET.UID3 = 0xA000D7C4 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro b/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro index 39f0106..5a63b2b 100644 --- a/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro +++ b/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro @@ -11,3 +11,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/qobjectxmlmodel sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xq *.html sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/qobjectxmlmodel INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7C8 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/xmlpatterns/recipes/recipes.pro b/examples/xmlpatterns/recipes/recipes.pro index f02a018..67d6d73 100644 --- a/examples/xmlpatterns/recipes/recipes.pro +++ b/examples/xmlpatterns/recipes/recipes.pro @@ -10,4 +10,7 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xq *.html forms files sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/recipes INSTALLS += target sources -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +symbian { + TARGET.UID3 = 0xA000D7C5 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/xmlpatterns/schema/schema.pro b/examples/xmlpatterns/schema/schema.pro index af32e0a..4d3520c 100644 --- a/examples/xmlpatterns/schema/schema.pro +++ b/examples/xmlpatterns/schema/schema.pro @@ -9,3 +9,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xq *.html files sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7C6 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/xmlpatterns/trafficinfo/trafficinfo.pro b/examples/xmlpatterns/trafficinfo/trafficinfo.pro index 52bcc19..99825d0 100644 --- a/examples/xmlpatterns/trafficinfo/trafficinfo.pro +++ b/examples/xmlpatterns/trafficinfo/trafficinfo.pro @@ -7,3 +7,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/trafficinfo sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/trafficinfo INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7C7 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/src/plugins/graphicssystems/openvg/openvg.pro b/src/plugins/graphicssystems/openvg/openvg.pro index d36570c..781cdc4 100644 --- a/src/plugins/graphicssystems/openvg/openvg.pro +++ b/src/plugins/graphicssystems/openvg/openvg.pro @@ -10,3 +10,5 @@ HEADERS = qgraphicssystem_vg_p.h target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target + +symbian: TARGET.UID3 = 0x2001E62C diff --git a/tools/xmlpatterns/xmlpatterns.pro b/tools/xmlpatterns/xmlpatterns.pro index 1c5ab2c..47f5a48 100644 --- a/tools/xmlpatterns/xmlpatterns.pro +++ b/tools/xmlpatterns/xmlpatterns.pro @@ -27,3 +27,6 @@ HEADERS = main.h \ qapplicationargumentparser.cpp \ qcoloringmessagehandler_p.h \ qcoloroutput_p.h + +symbian: TARGET.UID3 = 0xA000D7C9 + diff --git a/tools/xmlpatternsvalidator/xmlpatternsvalidator.pro b/tools/xmlpatternsvalidator/xmlpatternsvalidator.pro index 8491129..17fc465 100644 --- a/tools/xmlpatternsvalidator/xmlpatternsvalidator.pro +++ b/tools/xmlpatternsvalidator/xmlpatternsvalidator.pro @@ -15,3 +15,5 @@ CONFIG -= app_bundle SOURCES = main.cpp HEADERS = main.h + +symbian: TARGET.UID3 = 0xA000D7CA -- cgit v0.12 From 0009fa533e4d5ca1a75ba3b56af082cdcfee55cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 4 Nov 2009 11:46:37 +0100 Subject: Missing % for printf variable Reviewed-by: Friedemann Kleint --- src/network/access/qnetworkaccessdebugpipebackend.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index 4f7f15c..fecbe83 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -229,7 +229,7 @@ void QNetworkAccessDebugPipeBackend::possiblyFinish() void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() { - qWarning("QNetworkAccessDebugPipeBackend::closeDownstreamChannel()",operation());; + qWarning("QNetworkAccessDebugPipeBackend::closeDownstreamChannel() %d",operation());; //if (operation() == QNetworkAccessManager::GetOperation) // socket.disconnectFromHost(); } @@ -237,7 +237,7 @@ void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() void QNetworkAccessDebugPipeBackend::socketError() { - qWarning("QNetworkAccessDebugPipeBackend::socketError()", socket.error()); + qWarning("QNetworkAccessDebugPipeBackend::socketError() %d",socket.error()); QNetworkReply::NetworkError code; switch (socket.error()) { case QAbstractSocket::RemoteHostClosedError: -- cgit v0.12 From f4f6012d181cf60fd04fc5bf69b21786977f0de0 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 4 Nov 2009 10:38:41 +0000 Subject: Implemented metadata handling in Phonon MMF backend Task-number: QTBUG-4662 Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 21 +++++++++++++++++++++ src/3rdparty/phonon/mmf/abstractmediaplayer.h | 6 ++++++ src/3rdparty/phonon/mmf/abstractplayer.h | 3 ++- src/3rdparty/phonon/mmf/audioplayer.cpp | 21 ++++++++++++++++++++- src/3rdparty/phonon/mmf/audioplayer.h | 4 ++++ src/3rdparty/phonon/mmf/mediaobject.cpp | 1 + src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 13 +++++++++++++ src/3rdparty/phonon/mmf/mmf_videoplayer.h | 4 ++++ src/plugins/phonon/mmf/plugin/plugin.pro | 11 ++++++----- 9 files changed, 77 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index b443194..f2efaa0 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -392,7 +392,28 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) play(); } } +} + +void MMF::AbstractMediaPlayer::updateMetaData() +{ + TRACE_CONTEXT(AbstractMediaPlayer::updateMetaData, EAudioInternal); + TRACE_ENTRY_0(); + + m_metaData.clear(); + + const int numberOfEntries = numberOfMetaDataEntries(); + for(int i=0; i entry = metaDataEntry(i); + // Note that we capitalize the key, as required by the Ogg Vorbis + // metadata standard to which Phonon adheres: + // http://xiph.org/vorbis/doc/v-comment.html + m_metaData.insert(entry.first.toUpper(), entry.second); + } + + emit metaDataChanged(m_metaData); + + TRACE_EXIT_0(); } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index 1ea236b..cff7bab 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -73,6 +73,10 @@ protected: virtual void close() = 0; virtual void changeState(PrivateState newState); + void updateMetaData(); + virtual int numberOfMetaDataEntries() const = 0; + virtual QPair metaDataEntry(int index) const = 0; + protected: bool tickTimerRunning() const; void startTickTimer(); @@ -105,6 +109,8 @@ private: MediaSource m_source; MediaSource m_nextSource; + QMultiMap m_metaData; + }; } } diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index 1c4ea02..66496cc 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -97,13 +97,14 @@ public: const QString &errorMessage = QString()); Phonon::State state() const; + Q_SIGNALS: void totalTimeChanged(qint64 length); void finished(); void tick(qint64 time); void stateChanged(Phonon::State oldState, Phonon::State newState); - + void metaDataChanged(const QMultiMap& metaData); protected: /** diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index 1d259a8..8fccfe6 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -182,8 +182,8 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError, if (KErrNone == aError) { maxVolumeChanged(m_player->MaxVolume()); - emit totalTimeChanged(totalTime()); + updateMetaData(); changeState(StoppedState); } else { // TODO: set different error states according to value of aError? @@ -251,5 +251,24 @@ void MMF::AudioPlayer::MaloLoadingComplete() #endif // QT_PHONON_MMF_AUDIO_DRM +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +int MMF::AudioPlayer::numberOfMetaDataEntries() const +{ + int numberOfEntries = 0; + m_player->GetNumberOfMetaDataEntries(numberOfEntries); // ignoring return code + return numberOfEntries; +} + +QPair MMF::AudioPlayer::metaDataEntry(int index) const +{ + CMMFMetaDataEntry *entry = 0; + QT_TRAP_THROWING(entry = m_player->GetMetaDataEntryL(index)); + return QPair(qt_TDesC2QString(entry->Name()), qt_TDesC2QString(entry->Value())); +} + + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h index 60ef436..bc60076 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.h +++ b/src/3rdparty/phonon/mmf/audioplayer.h @@ -94,6 +94,10 @@ public: private: void construct(); + // AbstractMediaPlayer + virtual int numberOfMetaDataEntries() const; + virtual QPair metaDataEntry(int index) const; + private: /** * Using CPlayerType typedef in order to be able to easily switch between diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 74aaa58..f004fd7 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -322,6 +322,7 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) connect(m_player.data(), SIGNAL(stateChanged(Phonon::State, Phonon::State)), SIGNAL(stateChanged(Phonon::State, Phonon::State))); connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished())); connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); + connect(m_player.data(), SIGNAL(metaDataChanged(const QMultiMap&)), SIGNAL(metaDataChanged(const QMultiMap&))); // We need to call setError() after doing the connects, otherwise the // error won't be received. diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index fe469cf..ba7d005 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -490,6 +490,19 @@ bool MMF::VideoPlayer::getNativeWindowSystemHandles() TRACE_RETURN("changed %d", changed); } +int MMF::VideoPlayer::numberOfMetaDataEntries() const +{ + int numberOfEntries = 0; + TRAP_IGNORE(numberOfEntries = m_player->NumberOfMetaDataEntriesL()); + return numberOfEntries; +} + +QPair MMF::VideoPlayer::metaDataEntry(int index) const +{ + CMMFMetaDataEntry *entry = 0; + QT_TRAP_THROWING(entry = m_player->MetaDataEntryL(index)); + return QPair(qt_TDesC2QString(entry->Name()), qt_TDesC2QString(entry->Value())); +} QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h index 8072404..fa4e59b 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h @@ -86,6 +86,10 @@ private: void updateMmfOutput(); + // AbstractMediaPlayer + virtual int numberOfMetaDataEntries() const; + virtual QPair metaDataEntry(int index) const; + private: QScopedPointer m_player; diff --git a/src/plugins/phonon/mmf/plugin/plugin.pro b/src/plugins/phonon/mmf/plugin/plugin.pro index 793c307..8a7de98 100644 --- a/src/plugins/phonon/mmf/plugin/plugin.pro +++ b/src/plugins/phonon/mmf/plugin/plugin.pro @@ -69,11 +69,12 @@ debug { LIBS += -lhal } -LIBS += -lmediaclientvideo # For CVideoPlayerUtility -LIBS += -lcone # For CCoeEnv -LIBS += -lws32 # For RWindow -LIBS += -lefsrv # For file server -LIBS += -lapgrfx -lapmime # For recognizer +LIBS += -lmediaclientvideo # For CVideoPlayerUtility +LIBS += -lcone # For CCoeEnv +LIBS += -lws32 # For RWindow +LIBS += -lefsrv # For file server +LIBS += -lapgrfx -lapmime # For recognizer +LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry # These are for effects. LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect -- cgit v0.12 From e1a81c96790bee72ee4fbd2b0c4a7b48078c4ec1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 4 Nov 2009 11:41:31 +0100 Subject: Fixes StyleSheets: Incorrect display of custom style to QComboBox Two problem: - When QWindowsStyle draw CC_ComboBox, it does not save/restor the painter, whilt it does modify the pen and the brush. - QStyleSheetStyle CE_ComboBoxLabel did not specify the palette role to paint the text with, leaving the one from the palette Task-number: QTBUG-3974 Reviewed-by: Gabriel --- src/gui/styles/qstylesheetstyle.cpp | 2 +- src/gui/styles/qwindowsstyle.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index dfe5209..e61658b 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3675,7 +3675,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q } if (!cb->currentText.isEmpty() && !cb->editable) { drawItemText(p, editRect.adjusted(0, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->palette, - cb->state & State_Enabled, cb->currentText); + cb->state & State_Enabled, cb->currentText, QPalette::Text); } p->restore(); return; diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 5cf738e..abce4d2 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -2994,6 +2994,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp #ifndef QT_NO_COMBOBOX case CC_ComboBox: if (const QStyleOptionComboBox *cmb = qstyleoption_cast(opt)) { + p->save(); QBrush editBrush = cmb->palette.brush(QPalette::Base); if ((cmb->subControls & SC_ComboBoxFrame)) { if (cmb->frame) { @@ -3063,6 +3064,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget); } } + p->restore(); } break; #endif // QT_NO_COMBOBOX -- cgit v0.12 From dfceed4535110d345b89658729b66bbdb2c3d7ca Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 4 Nov 2009 12:05:46 +0100 Subject: Fixed crash when QImage::createAlphaMask() runs out of memory Reviewed-by: Trond --- src/gui/image/qimage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 571ef9d..21ca1e3 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4083,7 +4083,8 @@ QImage QImage::createAlphaMask(Qt::ImageConversionFlags flags) const } QImage mask(d->width, d->height, Format_MonoLSB); - dither_to_Mono(mask.d, d, flags, true); + if (!mask.isNull()) + dither_to_Mono(mask.d, d, flags, true); return mask; } -- cgit v0.12 From b2a4a87c93468b1a2e5ae002d4e7ce2a2315e747 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Nov 2009 12:13:10 +0100 Subject: Changelog 4.6.0: Designer/uic/uic3. --- dist/changes-4.6.0 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 887e93e..01b3c58 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -66,6 +66,29 @@ information about a particular change. be consistent with win32-msvc200x. **************************************************************************** +* Tools * +**************************************************************************** + +- Designer + + - [233683] Promoted Widgets are now stored correctly in scratchpad. + - [249823] Added search functionality to the resource browser. + - [254282] Enabled the use of promoted widgets in form templates. + - [254824] Made it possible to override the createAction()/createWidget() + functions of QUiLoader. + - [256332] Enabled deleting all pages of a QTabWidget or QStackedWidget. + - [259238] Fixed menubar/menu editing in right-to-left mode. + - [259918] Fixed setting of object names for container pages not to use + localized strings. + - [260658] Fixed saving of alpha values set in the palette editor. + - It is now possible to further specify the kind of custom widget + string properties using XML tags. + +- uic3 + + - [128859] Fixed code generation of QLabel's wordWrap property. + +**************************************************************************** * DirectFB * **************************************************************************** -- cgit v0.12 From 26ded29b31c71ff43036798015cb1c77aae427e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 4 Nov 2009 12:22:18 +0100 Subject: Fixed compilation and linking of EGL on Windows CE. Moved duplicated and broken code for setting up the include and library paths into the egl.prf feature file, which egl.pri and opengl.pro now includes using the qmake feature system. Task-number: QTBUG-5148 Reviewed-by: Tom Cooksey --- mkspecs/common/wince/qmake.conf | 1 + mkspecs/features/egl.prf | 32 +++++++++++++++++++++++++++++--- src/gui/egl/egl.pri | 10 ++-------- src/opengl/opengl.pro | 10 ++-------- 4 files changed, 34 insertions(+), 19 deletions(-) diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf index d87be02..ff99f1b 100644 --- a/mkspecs/common/wince/qmake.conf +++ b/mkspecs/common/wince/qmake.conf @@ -64,6 +64,7 @@ QMAKE_LIBS_NETWORK = ws2.lib QMAKE_LIBS_OPENGL = QMAKE_LIBS_COMPAT = +QMAKE_LIBS_EGL = libEGL.lib QMAKE_LIBS_OPENGL_ES1 = libGLES_CM.lib QMAKE_LIBS_OPENGL_ES1CL = libGLES_CL.lib QMAKE_LIBS_OPENGL_ES2 = libGLESv2.lib diff --git a/mkspecs/features/egl.prf b/mkspecs/features/egl.prf index 22002c3..00f70d3 100644 --- a/mkspecs/features/egl.prf +++ b/mkspecs/features/egl.prf @@ -1,3 +1,29 @@ -!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL -!isEmpty(QMAKE_LIBDIR_EGL): LIBS += -L$$QMAKE_LIBDIR_EGL -!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL +# On UNIX, we can use config tests to figure out if egl.h is in +# EGL/egl.h or GLES/egl.h. Sadly, there are no config tests on WinCE +# so we have to assume that for GLES 1.1 (CL), the EGL header is in +# GLES/egl.h. We also assume there is no separate libEGL.lib library, +# so we use the GL library instead. + +wince*:contains(QT_CONFIG, opengles1) { + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1 + LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1 + for(p, QMAKE_LIBDIR_OPENGL_ES1) { + exists($$p):LIBS_PRIVATE += -L$$p + } + DEFINES += QT_GLES_EGL +} else:wince*:contains(QT_CONFIG, opengles1cl) { + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1CL + LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1CL + LIBS += $$QMAKE_LFLAGS_EGL + for(p, QMAKE_LIBDIR_OPENGL_ES1CL) { + exists($$p):LIBS_PRIVATE += -L$$p + } + DEFINES += QT_GLES_EGL +} else { + INCLUDEPATH += $$QMAKE_INCDIR_EGL + LIBS_PRIVATE += $$QMAKE_LIBS_EGL + LIBS += $$QMAKE_LFLAGS_EGL + for(p, QMAKE_LIBDIR_EGL) { + exists($$p):LIBS_PRIVATE += -L$$p + } +} diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 627d511..669d311 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -1,3 +1,5 @@ +CONFIG += egl + HEADERS += \ egl/qegl_p.h \ egl/qeglproperties_p.h @@ -19,11 +21,3 @@ unix { } } } - -for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS_PRIVATE += -L$$p -} - -!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL -!isEmpty(QMAKE_LIBS_EGL): LIBS_PRIVATE += $$QMAKE_LIBS_EGL -!isEmpty(QMAKE_LFLAGS_EGL): LIBS += $$QMAKE_LFLAGS_EGL diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 7d6052b..deaf3bd 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -15,14 +15,7 @@ contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles1):CONFIG += opengles1 contains(QT_CONFIG, opengles1cl):CONFIG += opengles1cl contains(QT_CONFIG, opengles2):CONFIG += opengles2 - -contains(QT_CONFIG, opengles.*) { - for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS_PRIVATE += -L$$p - } - !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL - !isEmpty(QMAKE_LIBS_EGL): LIBS_PRIVATE += $$QMAKE_LIBS_EGL -} +contains(QT_CONFIG, egl):CONFIG += egl HEADERS += qgl.h \ qgl_p.h \ @@ -163,3 +156,4 @@ contains(QT_CONFIG,opengles1) { LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL LIBS += $$QMAKE_LFLAGS_OPENGL } + -- cgit v0.12 From 3c3db55c205012de15bab758b3bb4857d132cb98 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Wed, 4 Nov 2009 12:43:31 +0100 Subject: Fix compiler error. Reviewed-by: Trust Me --- src/gui/image/qpixmap_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 49a8942..cd8a4d4 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -753,7 +753,7 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) return QPixmap(); QScopedPointer data(new QS60PixmapData(QPixmapData::PixmapType)); - data->fromNativeType(reinterpret_cast(bitmap), QPixmapData::SgImage); + data->fromNativeType(reinterpret_cast(sgImage), QPixmapData::SgImage); QPixmap pixmap(data.take()); return pixmap; } -- cgit v0.12 From 202dee4e4840ef899edcb638fabc28b281e7a2dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 4 Nov 2009 12:51:12 +0100 Subject: Avoid warning on 64 bit systems --- src/corelib/tools/qmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 65c3d2a..0441107 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -151,7 +151,7 @@ class QMap static inline int payload() { return sizeof(PayloadNode) - sizeof(QMapData::Node *); } static inline int alignment() { #ifdef Q_ALIGNOF - return qMax(sizeof(void*), Q_ALIGNOF(Node)); + return int(qMax(sizeof(void*), Q_ALIGNOF(Node))); #else return 0; #endif -- cgit v0.12 From 5b6815ba1d6d82687b8244172482bb089210c8d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 4 Nov 2009 13:11:15 +0100 Subject: Fixed hardcoded GL library names on WinCE. Task-number: QTBUG-5148 Reviewed-by: Tom Cooksey --- examples/opengl/hellogl_es/hellogl_es.pro | 9 --------- examples/opengl/hellogl_es2/hellogl_es2.pro | 6 ------ mkspecs/features/win32/opengl.prf | 12 ++++++++++-- src/opengl/opengl.pro | 17 +---------------- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/examples/opengl/hellogl_es/hellogl_es.pro b/examples/opengl/hellogl_es/hellogl_es.pro index 3168743..80ef7df 100644 --- a/examples/opengl/hellogl_es/hellogl_es.pro +++ b/examples/opengl/hellogl_es/hellogl_es.pro @@ -20,15 +20,6 @@ HEADERS += bubble.h RESOURCES += texture.qrc QT += opengl -wince*:{ - contains(QT_CONFIG,opengles1) { - QMAKE_LIBS += "libGLES_CM.lib" - } - contains(QT_CONFIG,opengles1cl) { - QMAKE_LIBS += "libGLES_CL.lib" - } -} - # install target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es.pro diff --git a/examples/opengl/hellogl_es2/hellogl_es2.pro b/examples/opengl/hellogl_es2/hellogl_es2.pro index d5ad4b8..92b4224 100644 --- a/examples/opengl/hellogl_es2/hellogl_es2.pro +++ b/examples/opengl/hellogl_es2/hellogl_es2.pro @@ -25,9 +25,3 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es2.pro sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2 INSTALLS += target sources - - -wince*: { - QMAKE_LIBS += "libGLESv2.lib" - -} \ No newline at end of file diff --git a/mkspecs/features/win32/opengl.prf b/mkspecs/features/win32/opengl.prf index 30af2a3..3414781 100644 --- a/mkspecs/features/win32/opengl.prf +++ b/mkspecs/features/win32/opengl.prf @@ -1,3 +1,11 @@ -QMAKE_LIBS += $$QMAKE_LIBS_OPENGL -QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL +# WinCE does not have a platform directory for .prf files, and the +# win32 directory is searched for .prfs by qmake on WinCE. Ideally +# there should be a features/wince/opengl.prf which contains the wince +# block below. +wince* { + include(../unix/opengl.prf) +} else { + QMAKE_LIBS += $$QMAKE_LIBS_OPENGL + QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL +} diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index deaf3bd..b2474ed 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -54,7 +54,7 @@ SOURCES += qgl.cpp \ gl2paintengineex/qpaintengineex_opengl2_p.h \ gl2paintengineex/qglengineshadersource_p.h \ gl2paintengineex/qglcustomshaderstage_p.h \ - gl2paintengineex/qtriangulatingstroker_p.h + gl2paintengineex/qtriangulatingstroker_p.h SOURCES += qglshaderprogram.cpp \ qglpixmapfilter.cpp \ @@ -142,18 +142,3 @@ embedded { } INCLUDEPATH += ../3rdparty/harfbuzz/src - -contains(QT_CONFIG,opengles1) { - LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1 - LIBS += $$QMAKE_LFLAGS_OPENGL_ES1 -} else:contains(QT_CONFIG,opengles1cl) { - LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1CL - LIBS += $$QMAKE_LFLAGS_OPENGL_ES1CL -} else:contains(QT_CONFIG,opengles2) { - LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES2 - LIBS += $$QMAKE_LFLAGS_OPENGL_ES2 -} else { - LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL - LIBS += $$QMAKE_LFLAGS_OPENGL -} - -- cgit v0.12 From 052a34bef9cf682e3ea0e2183223b0dcab3c05b7 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Wed, 4 Nov 2009 13:37:01 +0100 Subject: Fix new failure in compatibilityChildInsertedEvents The new QEvent::WinIdChange event is sent when QWidget::show() creates the native window id, so we need to expect that event as well. Reviewed-by: TrustMe --- tests/auto/qwidget/tst_qwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 5630370..3595b84 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -6319,6 +6319,7 @@ void tst_QWidget::compatibilityChildInsertedEvents() widget.show(); expected = EventRecorder::EventList() + << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Polish) << qMakePair(&widget, QEvent::Move) << qMakePair(&widget, QEvent::Resize) @@ -6404,6 +6405,7 @@ void tst_QWidget::compatibilityChildInsertedEvents() widget.show(); expected = EventRecorder::EventList() + << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Polish) #ifdef QT_HAS_QT3SUPPORT << qMakePair(&widget, QEvent::ChildInserted) @@ -6501,6 +6503,7 @@ void tst_QWidget::compatibilityChildInsertedEvents() widget.show(); expected = EventRecorder::EventList() + << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Polish) #ifdef QT_HAS_QT3SUPPORT << qMakePair(&widget, QEvent::ChildInserted) -- cgit v0.12 From a1ccc70d07235ac8f0a76c8d2393afc97f968060 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 4 Nov 2009 14:06:07 +0100 Subject: Fix to the unregistration of the animation to the global timer The unregistration has to happen befaire calling virtual methods to support changing the state in those functions. Reviewed-by: ogoffart --- src/corelib/animation/qabstractanimation.cpp | 30 ++++++++++------------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 7fa3ae3..4f93c1e 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -348,29 +348,26 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) state = newState; QWeakPointer guard(q); - q->updateState(oldState, newState); - if (!guard) - return; + //unregistration of the animation must always happen before calls to + //virtual function (updateState) to ensure a correct state of the timer + if (oldState == QAbstractAnimation::Running) { + if (newState == QAbstractAnimation::Paused && hasRegisteredTimer) + QUnifiedTimer::instance()->ensureTimerUpdate(); + //the animation, is not running any more + QUnifiedTimer::instance()->unregisterAnimation(q); + } - //this is to be safe if updateState changes the state - if (state == oldState) + q->updateState(oldState, newState); + if (!guard || newState != state) //this is to be safe if updateState changes the state return; // Notify state change emit q->stateChanged(oldState, newState); - if (!guard) + if (!guard || newState != state) //this is to be safe if updateState changes the state return; switch (state) { case QAbstractAnimation::Paused: - if (hasRegisteredTimer) - // currentTime needs to be updated if pauseTimer is active - QUnifiedTimer::instance()->ensureTimerUpdate(); - if (!guard) - return; - //here we're sure that we were in running state before and that the - //animation is currently registered - QUnifiedTimer::instance()->unregisterAnimation(q); break; case QAbstractAnimation::Running: { @@ -390,15 +387,10 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) case QAbstractAnimation::Stopped: // Leave running state. int dura = q->duration(); - if (!guard) - return; if (deleteWhenStopped) q->deleteLater(); - if (oldState == QAbstractAnimation::Running) - QUnifiedTimer::instance()->unregisterAnimation(q); - if (dura == -1 || loopCount < 0 || (oldDirection == QAbstractAnimation::Forward && (oldCurrentTime * (oldCurrentLoop + 1)) == (dura * loopCount)) || (oldDirection == QAbstractAnimation::Backward && oldCurrentTime == 0)) { -- cgit v0.12 From ff1bd9c821aa1e314d6ca738204cdd0ae60a8369 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 4 Nov 2009 14:04:40 +0100 Subject: Fix crash in QMenu when using QWidgetAction If the QWidgetAction is not the first in a menu, it crashed. This is because when the QEvent::ActionRemoved is sent, the event->before() is not set. We need to find another way to clean up the widgetItems list. This basically revert 4b6ab00e6d68c7 Reviewed-by: Thierry --- src/gui/widgets/qmenu.cpp | 41 +++++++++++--------------- src/gui/widgets/qmenu_p.h | 2 +- tests/auto/qwidgetaction/tst_qwidgetaction.cpp | 2 ++ 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 1b5d1cd..e78c1b4 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -273,7 +273,7 @@ void QMenuPrivate::updateActionRects() const for (int i = 0; i < actions.count(); ++i) { QAction *action = actions.at(i); - if (action->isSeparator() || !action->isVisible() || widgetItems.at(i)) + if (action->isSeparator() || !action->isVisible() || widgetItems.contains(action)) continue; //..and some members hasCheckableItems |= action->isCheckable(); @@ -301,7 +301,7 @@ void QMenuPrivate::updateActionRects() const const QFontMetrics &fm = opt.fontMetrics; QSize sz; - if (QWidget *w = widgetItems.at(i)) { + if (QWidget *w = widgetItems.value(action)) { sz = w->sizeHint().expandedTo(w->minimumSize()).expandedTo(w->minimumSizeHint()).boundedTo(w->maximumSize()); } else { //calc what I think the size is.. @@ -370,7 +370,7 @@ void QMenuPrivate::updateActionRects() const rect.setWidth(max_column_width); //uniform width //we need to update the widgets geometry - if (QWidget *widget = widgetItems.at(i)) { + if (QWidget *widget = widgetItems.value(actions.at(i))) { widget->setGeometry(rect); widget->setVisible(actions.at(i)->isVisible()); } @@ -583,8 +583,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason q->update(actionRect(action)); if (reason == SelectedFromKeyboard) { - const int actionIndex = actions.indexOf(action); - QWidget *widget = widgetItems.at(actionIndex); + QWidget *widget = widgetItems.value(action); if (widget) { if (widget->focusPolicy() != Qt::NoFocus) widget->setFocus(Qt::TabFocusReason); @@ -800,7 +799,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc current.moveTop(current.top() + delta); //we need to update the widgets geometry - if (QWidget *w = widgetItems.at(i)) + if (QWidget *w = widgetItems.value(actions.at(i))) w->setGeometry(current); } } @@ -1392,11 +1391,12 @@ QMenu::QMenu(QMenuPrivate &dd, QWidget *parent) QMenu::~QMenu() { Q_D(QMenu); - for (int i = 0; i < d->widgetItems.count(); ++i) { - if (QWidget *widget = d->widgetItems.at(i)) { - QWidgetAction *action = static_cast(d->actions.at(i)); + QHash::iterator it = d->widgetItems.begin(); + for (; it != d->widgetItems.end(); ++it) { + if (QWidget *widget = it.value()) { + QWidgetAction *action = static_cast(it.key()); action->releaseWidget(widget); - d->widgetItems[i] = 0; + *it = 0; } } @@ -2151,7 +2151,7 @@ void QMenu::paintEvent(QPaintEvent *e) QAction *action = d->actions.at(i); QRect adjustedActionRect = d->actionRects.at(i); if (!e->rect().intersects(adjustedActionRect) - || d->widgetItems.at(i)) + || d->widgetItems.value(action)) continue; //set the clip region to be extra safe (and adjust for the scrollers) QRegion adjustedActionReg(adjustedActionRect); @@ -2862,25 +2862,20 @@ void QMenu::actionEvent(QActionEvent *e) connect(e->action(), SIGNAL(triggered()), this, SLOT(_q_actionTriggered())); connect(e->action(), SIGNAL(hovered()), this, SLOT(_q_actionHovered())); } - QWidget *widget = 0; - if (QWidgetAction *wa = qobject_cast(e->action())) - widget = wa->requestWidget(this); - - int index = d->actions.indexOf(e->action()); - Q_ASSERT(index != -1); - d->widgetItems.insert(index, widget); - + if (QWidgetAction *wa = qobject_cast(e->action())) { + QWidget *widget = wa->requestWidget(this); + if (widget) + d->widgetItems.insert(wa, widget); + } } else if (e->type() == QEvent::ActionRemoved) { e->action()->disconnect(this); if (e->action() == d->currentAction) d->currentAction = 0; - int index = d->actions.indexOf(e->before()) + 1; if (QWidgetAction *wa = qobject_cast(e->action())) { - if (QWidget *widget = d->widgetItems.at(index)) + if (QWidget *widget = d->widgetItems.value(wa)) wa->releaseWidget(widget); } - Q_ASSERT(index != -1); - d->widgetItems.removeAt(index); + d->widgetItems.remove(e->action()); } #ifdef Q_WS_MAC diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 9348f7b..a5bde7c 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -190,7 +190,7 @@ public: QRect actionRect(QAction *) const; mutable QVector actionRects; - mutable QWidgetList widgetItems; + mutable QHash widgetItems; void updateActionRects() const; QRect popupGeometry(const QWidget *widget) const; QRect popupGeometry(int screen = -1) const; diff --git a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp index 50b3337..d25738f 100644 --- a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp @@ -395,7 +395,9 @@ void tst_QWidgetAction::releaseWidgetCrash() QMainWindow *w = new QMainWindow; QAction *a = new CrashedAction(w); QMenu *menu = w->menuBar()->addMenu("Test"); + menu->addAction("foo"); menu->addAction(a); + menu->addAction("bar"); delete w; } -- cgit v0.12 From d14cf629997e6cfc454af257f6f0df8ce5224363 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 4 Nov 2009 14:25:23 +0100 Subject: Fixed crash with nullptr in QPixmapData::transformed Reviewed-By: Trond --- src/gui/image/qpixmap_x11.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 8a0120a..c735031 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1916,8 +1916,8 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, free(dptr); return bm; } else { // color pixmap - QPixmap pm; - QX11PixmapData *x11Data = static_cast(pm.data.data()); + QX11PixmapData *x11Data = new QX11PixmapData(QPixmapData::PixmapType); + QPixmap pm(x11Data); x11Data->flags &= ~QX11PixmapData::Uninitialized; x11Data->xinfo = xinfo; x11Data->d = d; -- cgit v0.12 From 126638922389ca967c1a82b6254de8ac00042158 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 4 Nov 2009 13:41:15 +0100 Subject: Cocoa: QColorDialog crashing when selection colors from system palette The reason was that we did not handle the color space of the selected color correctly. When selection from the system palette, the color points to an index rather than e.g. RGB directly. This patch closes the gap. Another, a bit more evil, crash comes when trying to click on 'SelectedMenuItemColor' from the 'Developer' palette. The exact same behaviour occurs when testing a native cocoa app in xcode directly. So, to handle this as gracefully as possible, we sourround the 'run modal' call with try-catch, and makes sure that we don't quit the dialog until the user actually tells it to. Bugreport to Apple created (bugreport.apple.com): 7364080 Task-number: QTBUG-4578 Reviewed-by: Prasanth --- src/gui/dialogs/qcolordialog_mac.mm | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index 9e4fdd1..5f074c0 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -252,15 +252,20 @@ QT_USE_NAMESPACE delete mQtColor; mQtColor = new QColor(); NSColor *color = [mColorPanel color]; - NSString *colorSpace = [color colorSpaceName]; - if (colorSpace == NSDeviceCMYKColorSpace) { - CGFloat cyan, magenta, yellow, black, alpha; + NSString *colorSpaceName = [color colorSpaceName]; + if (colorSpaceName == NSDeviceCMYKColorSpace) { + CGFloat cyan = 0, magenta = 0, yellow = 0, black = 0, alpha = 0; [color getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha]; mQtColor->setCmykF(cyan, magenta, yellow, black, alpha); - } else if (colorSpace == NSCalibratedRGBColorSpace || colorSpace == NSDeviceRGBColorSpace) { - CGFloat red, green, blue, alpha; + } else if (colorSpaceName == NSCalibratedRGBColorSpace || colorSpaceName == NSDeviceRGBColorSpace) { + CGFloat red = 0, green = 0, blue = 0, alpha = 0; [color getRed:&red green:&green blue:&blue alpha:&alpha]; mQtColor->setRgbF(red, green, blue, alpha); + } else if (colorSpaceName == NSNamedColorSpace) { + NSColor *tmpColor = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; + CGFloat red = 0, green = 0, blue = 0, alpha = 0; + [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha]; + mQtColor->setRgbF(red, green, blue, alpha); } else { NSColorSpace *colorSpace = [color colorSpace]; if ([colorSpace colorSpaceModel] == NSCMYKColorSpaceModel && [color numberOfComponents] == 5){ @@ -269,7 +274,7 @@ QT_USE_NAMESPACE mQtColor->setCmykF(components[0], components[1], components[2], components[3], components[4]); } else { NSColor *tmpColor = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; - CGFloat red, green, blue, alpha; + CGFloat red = 0, green = 0, blue = 0, alpha = 0; [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha]; mQtColor->setRgbF(red, green, blue, alpha); } @@ -319,7 +324,18 @@ QT_USE_NAMESPACE QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active); QMacCocoaAutoReleasePool pool; mDialogIsExecuting = true; - [NSApp runModalForWindow:mColorPanel]; + bool modalEnded = false; + while (!modalEnded) { + @try { + [NSApp runModalForWindow:mColorPanel]; + modalEnded = true; + } @catch (NSException *) { + // For some reason, NSColorPanel throws an exception when + // clicking on 'SelectedMenuItemColor' from the 'Developer' + // palette (tab three). + } + } + QAbstractEventDispatcher::instance()->interrupt(); if (mResultCode == NSCancelButton) mPriv->colorDialog()->reject(); -- cgit v0.12 From 77e5de0865f4a3810edc57ef5c8558200215b31c Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Wed, 4 Nov 2009 14:47:30 +0100 Subject: Doc: fix broken link in QBitmap Reviewed-by: Pierre --- src/gui/image/qbitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index e081735..4b8d4b8 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE object. Just like the QPixmap class, QBitmap is optimized by the use of - implicit data sharing. For more information, see the {Implicit + implicit data sharing. For more information, see the \l {Implicit Data Sharing} documentation. \sa QPixmap, QImage, QImageReader, QImageWriter -- cgit v0.12 From be6357bfa96cdaffa5797fef99e95cac7121e5b3 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 4 Nov 2009 15:21:37 +0200 Subject: Fixed modal dialog fading support in Symbian. Switched to use S60 API instead of Symbian one, the rationale is given below as an copy/paste from S60 docs: "Cross-application fading support Symbian OS provides some support for fading, but this only covers fading within an application. The S60 UI can have more than one application on the screen at once (in fact, since the system parts of the Status pane are inside EikServer, it always has more than one application on the screen). The S60 UI introduced the fading and drawing system to manage the fading state for the whole system. Application and UI control code for S60 should not attempt to set fade for a popup window directly. Instead, the popup window should implement the MAknFadedComponent interface, and should use the TAknPopupFader support class to set the fade. The application UI base classes interact with the fading and drawing system by informing it when the foreground status of the application changes. They also use it to implement system wide fading." There is also task QTBUG-5393 to implement fading support in future without S60 dependency. Task-number: QTBUG-5181 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_p.h | 2 +- src/gui/kernel/qapplication_s60.cpp | 4 ++-- src/gui/kernel/qt_s60_p.h | 23 ++++++++++++++++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 0fa7269..ec308c0 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -72,7 +72,7 @@ #include #endif #ifdef Q_OS_SYMBIAN -#include +#include #endif QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 1b0659a..5fe9536 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1255,7 +1255,7 @@ bool QApplicationPrivate::modalState() void QApplicationPrivate::enterModal_sys(QWidget *widget) { if (widget) { - widget->effectiveWinId()->DrawableWindow()->FadeBehind(ETrue); + static_cast(widget->effectiveWinId())->FadeBehindPopup(ETrue); // Modal partial screen dialogs (like queries) capture pointer events. // ### FixMe: Add specialized behaviour for fullscreen modal dialogs widget->effectiveWinId()->SetGloballyCapturing(ETrue); @@ -1270,7 +1270,7 @@ void QApplicationPrivate::enterModal_sys(QWidget *widget) void QApplicationPrivate::leaveModal_sys(QWidget *widget) { if (widget) { - widget->effectiveWinId()->DrawableWindow()->FadeBehind(EFalse); + static_cast(widget->effectiveWinId())->FadeBehindPopup(EFalse); // ### FixMe: Add specialized behaviour for fullscreen modal dialogs widget->effectiveWinId()->SetGloballyCapturing(EFalse); widget->effectiveWinId()->SetPointerCapture(EFalse); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 789d89e..3405bcf 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -73,6 +73,7 @@ #include // CAknTitlePane #include // CAknContextPane #include // CEikStatusPane +#include // MAknFadedComponent and TAknPopupFader #endif QT_BEGIN_NAMESPACE @@ -114,7 +115,7 @@ public: int supportsPremultipliedAlpha : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type static inline void updateScreenSize(); - static inline RWsSession& wsSession(); + static inline RWsSession& wsSession(); static inline RWindowGroup& windowGroup(); static inline CWsScreenDevice* screenDevice(); static inline CCoeAppUi* appUi(); @@ -140,7 +141,11 @@ public: }; class QLongTapTimer; + class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver +#ifdef Q_WS_S60 +, public MAknFadedComponent +#endif { public: DECLARE_TYPE_ID(0x51740000) // Fun fact: the two first values are "Qt" in ASCII. @@ -165,6 +170,17 @@ public: void setFocusSafely(bool focus); +#ifdef Q_WS_S60 + void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); } + +protected: // from MAknFadedComponent + TInt CountFadedComponents() {return 1;} + CCoeControl* FadedComponent(TInt aIndex) {return this;} +#else + #warning No fallback implementation for QSymbianControl::FadeBehindPopup + void FadeBehindPopup(bool /*fade*/){ } +#endif + protected: void Draw(const TRect& aRect) const; void SizeChanged(); @@ -189,6 +205,11 @@ private: bool m_ignoreFocusChanged; QLongTapTimer* m_longTapDetector; bool m_previousEventLongTap; + +#ifdef Q_WS_S60 + // Fader object used to fade everything except this menu and the CBA. + TAknPopupFader popupFader; +#endif }; inline QS60Data::QS60Data() -- cgit v0.12 From 375bbf981fb4fc9a910aa078f6b7caf19c255ae8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 4 Nov 2009 15:08:30 +0100 Subject: Raise the limit for _not_ using multimedia timers to 20ms To achieve 60FPS you need a new frame every 16ms -> this just missed the original threshold of 15ms. This came up in the context of a Snake game written in qml. Reviewed-by: Bradley T. Hughes --- src/corelib/kernel/qeventdispatcher_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index d13e1d1..b608d85 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -550,7 +550,7 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t) Q_Q(QEventDispatcherWin32); int ok = 0; - if (t->interval > 15 || !t->interval || !qtimeSetEvent) { + if (t->interval > 20 || !t->interval || !qtimeSetEvent) { ok = 1; if (!t->interval) // optimization for single-shot-zero-timer QCoreApplication::postEvent(q, new QZeroTimerEvent(t->timerId)); -- cgit v0.12 From 106148704ee1e73c7b71c4a1a2dcb64a1ac52727 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 4 Nov 2009 15:34:29 +0100 Subject: update harfbuzz to the latest version from fd.org This corresponds to commit e8a057fb67a0242e5a125d8cb2c823ad63e01449 in harfbuzz. The changes include fixes for an out of bounds read and QTBUG-5293. Task-Number: QTBUG-5293 Reviewed-by: Eskil --- src/3rdparty/harfbuzz/src/harfbuzz-arabic.c | 2 +- src/3rdparty/harfbuzz/src/harfbuzz-gpos.c | 6 +- src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c | 3 +- src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp | 117 ++++++++++++++++----------- src/3rdparty/harfbuzz/src/harfbuzz-open.c | 2 + src/3rdparty/harfbuzz/src/harfbuzz-shape.h | 2 +- src/3rdparty/harfbuzz/src/harfbuzz-shaper.h | 41 +++++----- src/3rdparty/harfbuzz/tests/shaping/main.cpp | 76 ++++++++++++++--- 8 files changed, 167 insertions(+), 82 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c index 0609232..4d85c19 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c @@ -1009,7 +1009,7 @@ static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok) ++l; ++properties; } - if (f + l < item->stringLength) { + if (f + l + item->item.pos < item->stringLength) { ++l; } getArabicProperties(uc+f, l, props); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c index c932ec2..356dc01 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c @@ -2059,15 +2059,17 @@ static void Free_BaseArray( HB_BaseArray* ba, HB_BaseRecord *br; HB_Anchor *bans; - HB_UNUSED(num_classes); - if ( ba->BaseRecord ) { br = ba->BaseRecord; if ( ba->BaseCount ) { + HB_UShort i, count; + count = num_classes * ba->BaseCount; bans = br[0].BaseAnchor; + for (i = 0; i < count; i++) + Free_Anchor (&bans[i]); FREE( bans ); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c index 533a063..2bda386 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c @@ -56,6 +56,8 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) assert(shaper_item->item.script == HB_Script_Hebrew); + HB_HeuristicSetGlyphAttributes(shaper_item); + #ifndef NO_OPENTYPE if (HB_SelectScript(shaper_item, hebrew_features)) { @@ -64,7 +66,6 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) return FALSE; - HB_HeuristicSetGlyphAttributes(shaper_item); HB_OpenTypeShape(shaper_item, /*properties*/0); return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index 7104d2a..48f4f90 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -419,7 +419,7 @@ static const unsigned char indicForms[0xe00-0x900] = { Matra, Halant, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, - Invalid, Invalid, Invalid, LengthMark, + Invalid, Invalid, Invalid, Matra, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, @@ -1050,62 +1050,59 @@ static const IndicOrdering * const indic_order[] = { // vowel matras that have to be split into two parts. static const unsigned short split_matras[] = { - // matra, split1, split2 + // matra, split1, split2, split3 // bengalis - 0x9cb, 0x9c7, 0x9be, - 0x9cc, 0x9c7, 0x9d7, + 0x9cb, 0x9c7, 0x9be, 0x0, + 0x9cc, 0x9c7, 0x9d7, 0x0, // oriya - 0xb48, 0xb47, 0xb56, - 0xb4b, 0xb47, 0xb3e, - 0xb4c, 0xb47, 0xb57, + 0xb48, 0xb47, 0xb56, 0x0, + 0xb4b, 0xb47, 0xb3e, 0x0, + 0xb4c, 0xb47, 0xb57, 0x0, // tamil - 0xbca, 0xbc6, 0xbbe, - 0xbcb, 0xbc7, 0xbbe, - 0xbcc, 0xbc6, 0xbd7, + 0xbca, 0xbc6, 0xbbe, 0x0, + 0xbcb, 0xbc7, 0xbbe, 0x0, + 0xbcc, 0xbc6, 0xbd7, 0x0, // telugu - 0xc48, 0xc46, 0xc56, + 0xc48, 0xc46, 0xc56, 0x0, // kannada - 0xcc0, 0xcbf, 0xcd5, - 0xcc7, 0xcc6, 0xcd5, - 0xcc8, 0xcc6, 0xcd6, - 0xcca, 0xcc6, 0xcc2, - 0xccb, 0xcca, 0xcd5, + 0xcc0, 0xcbf, 0xcd5, 0x0, + 0xcc7, 0xcc6, 0xcd5, 0x0, + 0xcc8, 0xcc6, 0xcd6, 0x0, + 0xcca, 0xcc6, 0xcc2, 0x0, + 0xccb, 0xcc6, 0xcc2, 0xcd5, // malayalam - 0xd4a, 0xd46, 0xd3e, - 0xd4b, 0xd47, 0xd3e, - 0xd4c, 0xd46, 0xd57, + 0xd4a, 0xd46, 0xd3e, 0x0, + 0xd4b, 0xd47, 0xd3e, 0x0, + 0xd4c, 0xd46, 0xd57, 0x0, // sinhala - 0xdda, 0xdd9, 0xdca, - 0xddc, 0xdd9, 0xdcf, - 0xddd, 0xddc, 0xdca, - 0xdde, 0xdd9, 0xddf, + 0xdda, 0xdd9, 0xdca, 0x0, + 0xddc, 0xdd9, 0xdcf, 0x0, + 0xddd, 0xdd9, 0xdcf, 0xdca, + 0xdde, 0xdd9, 0xddf, 0x0, 0xffff }; -static inline void splitMatra(unsigned short *reordered, int matra, int &len, int &base) +static inline void splitMatra(unsigned short *reordered, int matra, int &len) { unsigned short matra_uc = reordered[matra]; //qDebug("matra=%d, reordered[matra]=%x", matra, reordered[matra]); const unsigned short *split = split_matras; while (split[0] < matra_uc) - split += 3; + split += 4; assert(*split == matra_uc); ++split; - if (indic_position(*split) == Pre) { - reordered[matra] = split[1]; - memmove(reordered + 1, reordered, len*sizeof(unsigned short)); - reordered[0] = split[0]; - base++; - } else { - memmove(reordered + matra + 1, reordered + matra, (len-matra)*sizeof(unsigned short)); - reordered[matra] = split[0]; - reordered[matra+1] = split[1]; - } - len++; + int added_chars = split[2] == 0x0 ? 1 : 2; + + memmove(reordered + matra + added_chars, reordered + matra, (len-matra)*sizeof(unsigned short)); + reordered[matra] = split[0]; + reordered[matra+1] = split[1]; + if(added_chars == 2) + reordered[matra+2] = split[2]; + len += added_chars; } #ifndef NO_OPENTYPE @@ -1130,12 +1127,23 @@ static const HB_OpenTypeFeature indic_features[] = { // #define INDIC_DEBUG #ifdef INDIC_DEBUG -#define IDEBUG qDebug +#define IDEBUG hb_debug +#include + +static void hb_debug(const char *msg, ...) +{ + va_list ap; + va_start(ap, msg); // use variable arg list + vfprintf(stderr, msg, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + #else #define IDEBUG if(0) printf #endif -#ifdef INDIC_DEBUG +#if 0 //def INDIC_DEBUG static QString propertiesToString(int properties) { QString res; @@ -1386,12 +1394,12 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // to be at the beginning of the syllable, so we just move // them there now. if (matra_position == Split) { - splitMatra(uc, matra, len, base); + splitMatra(uc, matra, len); // Handle three-part matras (0xccb in Kannada) matra_position = indic_position(uc[matra]); - if (matra_position == Split) - splitMatra(uc, matra, len, base); - } else if (matra_position == Pre) { + } + + if (matra_position == Pre) { unsigned short m = uc[matra]; while (matra--) uc[matra+1] = uc[matra]; @@ -1609,11 +1617,11 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // halant always applies #ifdef INDIC_DEBUG - { - IDEBUG("OT properties:"); - for (int i = 0; i < len; ++i) - qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data()); - } +// { +// IDEBUG("OT properties:"); +// for (int i = 0; i < len; ++i) +// qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data()); +// } #endif // initialize @@ -1731,6 +1739,11 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int if (script == HB_Script_Bengali && pos == 1 && (uc[0] == 0x0985 || uc[0] == 0x098f)) break; + // Sinhala uses the Halant as a component of certain matras. Allow these, but keep the state on Matra. + if (script == HB_Script_Sinhala && state == Matra) { + ++pos; + continue; + } goto finish; case Nukta: if (state == Consonant) @@ -1741,12 +1754,16 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int break; // fall through case VowelMark: - if (state == Matra || state == IndependentVowel) + if (state == Matra || state == LengthMark || state == IndependentVowel) break; // fall through case Matra: if (state == Consonant || state == Nukta) break; + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } // ### not sure if this is correct. If it is, does it apply only to Bengali or should // it work for all Indic languages? // the combination Independent_A + Vowel Sign AA is allowed. @@ -1762,6 +1779,10 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int goto finish; case LengthMark: + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } case IndependentVowel: case Invalid: case Other: diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c index cde5465..0fe1e4d 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c @@ -1114,6 +1114,8 @@ _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd ) if ( ALLOC_ARRAY( cd->cd.cd1.ClassValueArray, 1, HB_UShort ) ) return error; + cd->loaded = TRUE; + return HB_Err_Ok; } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shape.h b/src/3rdparty/harfbuzz/src/harfbuzz-shape.h index 4f714a3..e4b5f9a 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shape.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shape.h @@ -161,7 +161,7 @@ typedef enum { /* * Buffer for output */ -typedef struct _HB_GlyphBufer HB_GlyphBuffer; +typedef struct _HB_GlyphBuffer HB_GlyphBuffer; struct _HB_GlyphBuffer { int glyph_item_size; int total_glyphs; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h index e8f5513..d2357f43 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h @@ -242,27 +242,30 @@ typedef struct HB_Font_ { void *userData; } HB_FontRec; -typedef struct { - const HB_UChar16 *string; - hb_uint32 stringLength; - HB_ScriptItem item; - HB_Font font; - HB_Face face; - int shaperFlags; /* HB_ShaperFlags */ - - HB_Bool glyphIndicesPresent; /* set to true if the glyph indicies are already setup in the glyphs array */ - hb_uint32 initialGlyphCount; - - hb_uint32 num_glyphs; /* in: available glyphs out: glyphs used/needed */ - HB_Glyph *glyphs; /* out parameter */ - HB_GlyphAttributes *attributes; /* out */ - HB_Fixed *advances; /* out */ - HB_FixedPoint *offsets; /* out */ - unsigned short *log_clusters; /* out */ +typedef struct HB_ShaperItem_ HB_ShaperItem; + +struct HB_ShaperItem_ { + const HB_UChar16 *string; /* input: the Unicode UTF16 text to be shaped */ + hb_uint32 stringLength; /* input: the length of the input in 16-bit words */ + HB_ScriptItem item; /* input: the current run to be shaped: a run of text all in the same script that is a substring of */ + HB_Font font; /* input: the font: scale, units and function pointers supplying glyph indices and metrics */ + HB_Face face; /* input: the shaper state; current script, access to the OpenType tables , etc. */ + int shaperFlags; /* input (unused) should be set to 0; intended to support flags defined in HB_ShaperFlag */ + HB_Bool glyphIndicesPresent; /* input: true if the array contains glyph indices ready to be shaped */ + hb_uint32 initialGlyphCount; /* input: if glyphIndicesPresent is true, the number of glyph indices in the array */ + + hb_uint32 num_glyphs; /* input: capacity of output arrays , , , , and ; */ + /* output: required capacity (may be larger than actual capacity) */ + + HB_Glyph *glyphs; /* output: indices of shaped glyphs */ + HB_GlyphAttributes *attributes; /* output: glyph attributes */ + HB_Fixed *advances; /* output: advances */ + HB_FixedPoint *offsets; /* output: offsets */ + unsigned short *log_clusters; /* output: for each output glyph, the index in the input of the start of its logical cluster */ /* internal */ - HB_Bool kerning_applied; /* out: kerning applied by shaper */ -} HB_ShaperItem; + HB_Bool kerning_applied; /* output: true if kerning was applied by the shaper */ +}; HB_Bool HB_ShapeItem(HB_ShaperItem *item); diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 1a3ef4f..a7ea417 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -178,7 +178,7 @@ private slots: void telugu(); void kannada(); void malayalam(); - // sinhala missing + void sinhala(); void khmer(); void linearB(); @@ -510,6 +510,11 @@ void tst_QScriptEngine::bengali() { 0x151, 0x276, 0x172, 0x143, 0x0 } }, { { 0x9b0, 0x9cd, 0x995, 0x9be, 0x983, 0x0 }, { 0x151, 0x276, 0x172, 0x144, 0x0 } }, + // test decomposed two parts matras + { { 0x995, 0x9c7, 0x9be, 0x0 }, + { 0x179, 0x151, 0x172, 0x0 } }, + { { 0x995, 0x9c7, 0x9d7, 0x0 }, + { 0x179, 0x151, 0x17e, 0x0 } }, { {0}, {0} } }; @@ -638,15 +643,15 @@ void tst_QScriptEngine::bengali() if (face) { const ShapeTable shape_table [] = { { { 0x09a8, 0x09cd, 0x09af, 0x0 }, - { 0x0192, 0x0 } }, + { 0x01ca, 0x0 } }, { { 0x09b8, 0x09cd, 0x09af, 0x0 }, - { 0x01d6, 0x0 } }, + { 0x020e, 0x0 } }, { { 0x09b6, 0x09cd, 0x09af, 0x0 }, - { 0x01bc, 0x0 } }, + { 0x01f4, 0x0 } }, { { 0x09b7, 0x09cd, 0x09af, 0x0 }, - { 0x01c6, 0x0 } }, + { 0x01fe, 0x0 } }, { { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 }, - { 0xd3, 0x12f, 0x0 } }, + { 0x10b, 0x167, 0x0 } }, { {0}, {0} } }; @@ -823,8 +828,9 @@ void tst_QScriptEngine::telugu() { 0xe6, 0xb3, 0x83, 0x0 } }, { { 0xc15, 0xc4d, 0xc30, 0xc48, 0x0 }, { 0xe6, 0xb3, 0x9f, 0x0 } }, - { {0}, {0} } - + { { 0xc15, 0xc46, 0xc56, 0x0 }, + { 0xe6, 0xb3, 0x0 } }, + { {0}, {0} } }; const ShapeTable *s = shape_table; @@ -867,7 +873,6 @@ void tst_QScriptEngine::kannada() { 0x0036, 0x00c1, 0x0 } }, { { 0x0cb0, 0x0ccd, 0x200d, 0x0c95, 0x0 }, { 0x0050, 0x00a7, 0x0 } }, - { {0}, {0} } }; @@ -891,6 +896,17 @@ void tst_QScriptEngine::kannada() { 0x00b0, 0x006c, 0x0 } }, { { 0x0cb7, 0x0ccd, 0x0 }, { 0x0163, 0x0 } }, + { { 0xc95, 0xcbf, 0xcd5, 0x0 }, + { 0x114, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd6, 0x0 }, + { 0x90, 0x6c, 0x74, 0x0 } }, + { { 0xc95, 0xcc6, 0xcc2, 0x0 }, + { 0x90, 0x6c, 0x69, 0x0 } }, + { { 0xc95, 0xcca, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x69, 0x73, 0x0 } }, + { {0}, {0} } }; @@ -943,7 +959,14 @@ void tst_QScriptEngine::malayalam() { 0x009e, 0x0 } }, { { 0x0d30, 0x0d4d, 0x200d, 0x0 }, { 0x009e, 0x0 } }, - + { { 0xd15, 0xd46, 0xd3e, 0x0 }, + { 0x5e, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd47, 0xd3e, 0x0 }, + { 0x5f, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd46, 0xd57, 0x0 }, + { 0x5e, 0x34, 0x65, 0x0 } }, + { { 0xd15, 0xd57, 0x0 }, + { 0x34, 0x65, 0x0 } }, { {0}, {0} } }; @@ -962,6 +985,39 @@ void tst_QScriptEngine::malayalam() } } +void tst_QScriptEngine::sinhala() +{ + { + FT_Face face = loadFace("FM-MalithiUW46.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0xd9a, 0xdd9, 0xdcf, 0x0 }, + { 0x4a, 0x61, 0x42, 0x0 } }, + { { 0xd9a, 0xdd9, 0xddf, 0x0 }, + { 0x4a, 0x61, 0x50, 0x0 } }, + { { 0xd9a, 0xdd9, 0xdca, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddc, 0xdca, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { { 0xd9a, 0xdda, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddd, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { {0}, {0} } + }; + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Sinhala) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find FM-MalithiUW46.ttf", SkipAll); + } + } +} void tst_QScriptEngine::khmer() -- cgit v0.12 From 8734e9643c38970a3b3a4dfc1484a6ec5b9ce9f8 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 4 Nov 2009 15:18:19 +0100 Subject: updates to the test after harfbuzz update Updated the generator code to compile again on 4.6. Added test cases for QTBUG-5293, taken from harfbuzz Reviewed-by: Eskil --- tests/auto/qtextscriptengine/generate/generate.pro | 1 + tests/auto/qtextscriptengine/generate/main.cpp | 4 +- .../qtextscriptengine/tst_qtextscriptengine.cpp | 87 +++++++++++++++++++--- 3 files changed, 78 insertions(+), 14 deletions(-) diff --git a/tests/auto/qtextscriptengine/generate/generate.pro b/tests/auto/qtextscriptengine/generate/generate.pro index 355633d..354e0e5 100644 --- a/tests/auto/qtextscriptengine/generate/generate.pro +++ b/tests/auto/qtextscriptengine/generate/generate.pro @@ -5,6 +5,7 @@ TEMPLATE = app CONFIG -= moc INCLUDEPATH += . /usr/include/freetype2 +INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src # Input SOURCES += main.cpp diff --git a/tests/auto/qtextscriptengine/generate/main.cpp b/tests/auto/qtextscriptengine/generate/main.cpp index 853c726..15fbc47 100644 --- a/tests/auto/qtextscriptengine/generate/main.cpp +++ b/tests/auto/qtextscriptengine/generate/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ -#include +#include #include #include #include @@ -85,7 +85,7 @@ void MyEdit::setText(const QString &str) result += "0x" + QString::number(str.at(i).unicode(), 16) + ", "; result += "0x0 },\n { "; for (int i = 0; i < e->layoutData->items[0].num_glyphs; ++i) - result += "0x" + QString::number(e->layoutData->glyphPtr[i].glyph, 16) + ", "; + result += "0x" + QString::number(e->layoutData->glyphLayout.glyphs[i], 16) + ", "; result += "0x0 } }"; setPlainText(result); diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 226348a..78e0ce6 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -98,7 +98,7 @@ private slots: void telugu(); void kannada(); void malayalam(); - // sinhala missing + void sinhala(); void khmer(); void linearB(); @@ -379,7 +379,11 @@ void tst_QTextScriptEngine::bengali() { 0x151, 0x276, 0x172, 0x143, 0x0 } }, { { 0x9b0, 0x9cd, 0x995, 0x9be, 0x983, 0x0 }, { 0x151, 0x276, 0x172, 0x144, 0x0 } }, - + // test decomposed two parts matras + { { 0x995, 0x9c7, 0x9be, 0x0 }, + { 0x179, 0x151, 0x172, 0x0 } }, + { { 0x995, 0x9c7, 0x9d7, 0x0 }, + { 0x179, 0x151, 0x17e, 0x0 } }, { {0}, {0} } }; @@ -502,16 +506,16 @@ void tst_QTextScriptEngine::bengali() if (QFontDatabase().families(QFontDatabase::Bengali).contains("Likhan")) { QFont f("Likhan"); const ShapeTable shape_table [] = { - { { 0x09a8, 0x09cd, 0x09af, 0x0 }, - { 0x0192, 0x0 } }, + { { 0x9a8, 0x9cd, 0x9af, 0x0 }, + { 0x1ca, 0x0 } }, { { 0x09b8, 0x09cd, 0x09af, 0x0 }, - { 0x01d6, 0x0 } }, + { 0x020e, 0x0 } }, { { 0x09b6, 0x09cd, 0x09af, 0x0 }, - { 0x01bc, 0x0 } }, + { 0x01f4, 0x0 } }, { { 0x09b7, 0x09cd, 0x09af, 0x0 }, - { 0x01c6, 0x0 } }, + { 0x01fe, 0x0 } }, { { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 }, - { 0xd3, 0x12f, 0x0 } }, + { 0x10b, 0x167, 0x0 } }, { {0}, {0} } }; @@ -647,6 +651,12 @@ void tst_QTextScriptEngine::tamil() { 0x0025, 0x0 } }, { { 0x0b83, 0x0b95, 0x0 }, { 0x0025, 0x0031, 0x0 } }, + { { 0xb95, 0xbc6, 0xbbe, 0x0 }, + { 0xa, 0x31, 0x7, 0x0 } }, + { { 0xb95, 0xbc7, 0xbbe, 0x0 }, + { 0xb, 0x31, 0x7, 0x0 } }, + { { 0xb95, 0xbc6, 0xbd7, 0x0 }, + { 0xa, 0x31, 0x40, 0x0 } }, { {0}, {0} } }; @@ -694,7 +704,9 @@ void tst_QTextScriptEngine::telugu() { 0xe6, 0xb3, 0x83, 0x0 } }, { { 0xc15, 0xc4d, 0xc30, 0xc48, 0x0 }, { 0xe6, 0xb3, 0x9f, 0x0 } }, - { {0}, {0} } + { { 0xc15, 0xc46, 0xc56, 0x0 }, + { 0xe6, 0xb3, 0x0 } }, + { {0}, {0} } }; @@ -762,7 +774,16 @@ void tst_QTextScriptEngine::kannada() { 0x00b0, 0x006c, 0x0 } }, { { 0x0cb7, 0x0ccd, 0x0 }, { 0x0163, 0x0 } }, - + { { 0xc95, 0xcbf, 0xcd5, 0x0 }, + { 0x114, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd6, 0x0 }, + { 0x90, 0x6c, 0x74, 0x0 } }, + { { 0xc95, 0xcc6, 0xcc2, 0x0 }, + { 0x90, 0x6c, 0x69, 0x0 } }, + { { 0xc95, 0xcca, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x69, 0x73, 0x0 } }, { {0}, {0} } }; @@ -816,8 +837,14 @@ void tst_QTextScriptEngine::malayalam() { 0x009e, 0x0 } }, { { 0x0d30, 0x0d4d, 0x200d, 0x0 }, { 0x009e, 0x0 } }, - - + { { 0xd15, 0xd46, 0xd3e, 0x0 }, + { 0x5e, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd47, 0xd3e, 0x0 }, + { 0x5f, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd46, 0xd57, 0x0 }, + { 0x5e, 0x34, 0x65, 0x0 } }, + { { 0xd15, 0xd57, 0x0 }, + { 0x34, 0x65, 0x0 } }, { {0}, {0} } }; @@ -836,6 +863,42 @@ void tst_QTextScriptEngine::malayalam() #endif } +void tst_QTextScriptEngine::sinhala() +{ +#if defined(Q_WS_X11) + { + if (QFontDatabase().families(QFontDatabase::Sinhala).contains("Malithi Web")) { + QFont f("Malithi Web"); + const ShapeTable shape_table [] = { + { { 0xd9a, 0xdd9, 0xdcf, 0x0 }, + { 0x4a, 0x61, 0x42, 0x0 } }, + { { 0xd9a, 0xdd9, 0xddf, 0x0 }, + { 0x4a, 0x61, 0x50, 0x0 } }, + { { 0xd9a, 0xdd9, 0xdca, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddc, 0xdca, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { { 0xd9a, 0xdda, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddd, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(f, s) ); + ++s; + } + } else { + QSKIP("couln't find Malithi Web", SkipAll); + } + } +#else + QSKIP("X11 specific test", SkipAll); +#endif +} void tst_QTextScriptEngine::khmer() -- cgit v0.12 From 673973acc20ce4e068d63fa5b0391f5c785be8a3 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 4 Nov 2009 15:37:18 +0100 Subject: Mac: pinch gesture scales to fast and event below zero Make the math correct. Plus, update the imagegesture example. Rev-By: denis --- examples/gestures/imagegestures/imagewidget.cpp | 13 +++++++++---- examples/gestures/imagegestures/imagewidget.h | 1 + src/gui/kernel/qmacgesturerecognizer_mac.mm | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index f615129..df8f56d 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -50,7 +50,8 @@ ImageWidget::ImageWidget(QWidget *parent) horizontalOffset(0), verticalOffset(0), rotationAngle(0), - scaleFactor(1) + scaleFactor(1), + currentStepScaleFactor(1) { setMinimumSize(QSize(100,100)); @@ -85,7 +86,7 @@ void ImageWidget::paintEvent(QPaintEvent*) p.translate(ww/2, wh/2); p.translate(horizontalOffset, verticalOffset); p.rotate(rotationAngle); - p.scale(scaleFactor, scaleFactor); + p.scale(currentStepScaleFactor * scaleFactor, currentStepScaleFactor * scaleFactor); p.translate(-iw/2, -ih/2); p.drawImage(0, 0, currentImage); } @@ -140,8 +141,12 @@ void ImageWidget::pinchTriggered(QPinchGesture *gesture) } if (changeFlags & QPinchGesture::ScaleFactorChanged) { qreal value = gesture->property("scaleFactor").toReal(); - qreal lastValue = gesture->property("lastScaleFactor").toReal(); - scaleFactor += value - lastValue; + if (gesture->state() == Qt::GestureFinished) { + scaleFactor *= currentStepScaleFactor; + currentStepScaleFactor = 1; + } else { + currentStepScaleFactor = value; + } } update(); } diff --git a/examples/gestures/imagegestures/imagewidget.h b/examples/gestures/imagegestures/imagewidget.h index 56e2316..7a68488 100644 --- a/examples/gestures/imagegestures/imagewidget.h +++ b/examples/gestures/imagegestures/imagewidget.h @@ -93,6 +93,7 @@ private: float verticalOffset; float rotationAngle; float scaleFactor; + float currentStepScaleFactor; //! [class definition end] }; //! [class definition end] diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm index d842322..f142d71 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac.mm +++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm @@ -120,7 +120,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e case QNativeGestureEvent::Zoom: g->setLastScaleFactor(g->scaleFactor()); g->setLastRotationAngle(g->rotationAngle()); - g->setScaleFactor(g->scaleFactor() + ev->percentage); + g->setScaleFactor(g->scaleFactor() * (1 + ev->percentage)); g->setChangeFlags(QPinchGesture::ScaleFactorChanged); g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags()); return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; -- cgit v0.12 From 4e5a1a77677540422cc69ec5c2b1341ca4b318f9 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Wed, 4 Nov 2009 15:23:22 +0100 Subject: Add QMacGLCompatTypes to QGLShaderProgram API --- src/opengl/qglshaderprogram.cpp | 50 +++++++++++++++++++++++++++++++++++++++++ src/opengl/qglshaderprogram.h | 11 +++++++++ 2 files changed, 61 insertions(+) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 080c3b2..e28c382 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -2827,4 +2827,54 @@ void QGLShaderProgram::shaderDestroyed() #endif +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS +/*! \internal */ +void QGLShaderProgram::setUniformValue(int location, QMacCompatGLint value) +{ + setUniformValue(location, GLint(value)); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValue(int location, QMacCompatGLuint value) +{ + setUniformValue(location, GLuint(value)); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValue(const char *name, QMacCompatGLint value) +{ + setUniformValue(name, GLint(value)); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValue(const char *name, QMacCompatGLuint value) +{ + setUniformValue(name, GLuint(value)); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValueArray(int location, const QMacCompatGLint *values, int count) +{ + setUniformValueArray(location, (const GLint *)values, count); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValueArray(int location, const QMacCompatGLuint *values, int count) +{ + setUniformValueArray(location, (const GLuint *)values, count); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGLint *values, int count) +{ + setUniformValueArray(name, (const GLint *)values, count); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGLuint *values, int count) +{ + setUniformValueArray(name, (const GLuint *)values, count); +} +#endif + QT_END_NAMESPACE diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index b7bd2d7..49c3364 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -181,6 +181,17 @@ public: int uniformLocation(const QByteArray& name) const; int uniformLocation(const QString& name) const; +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + void setUniformValue(int location, QMacCompatGLint value); + void setUniformValue(int location, QMacCompatGLuint value); + void setUniformValue(const char *name, QMacCompatGLint value); + void setUniformValue(const char *name, QMacCompatGLuint value); + void setUniformValueArray(int location, const QMacCompatGLint *values, int count); + void setUniformValueArray(int location, const QMacCompatGLuint *values, int count); + void setUniformValueArray(const char *name, const QMacCompatGLint *values, int count); + void setUniformValueArray(const char *name, const QMacCompatGLuint *values, int count); +#endif + void setUniformValue(int location, GLfloat value); void setUniformValue(int location, GLint value); void setUniformValue(int location, GLuint value); -- cgit v0.12 From 05eeb454e0fcc83db330ee7df33a800a6998fc30 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 4 Nov 2009 15:39:17 +0100 Subject: eval: add key for the installer to grep for. Reviewed-By: con --- configure | 2 +- configure.exe | Bin 1171968 -> 1172480 bytes tools/configure/configureapp.cpp | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 9c3e417..611f4bf 100755 --- a/configure +++ b/configure @@ -4185,7 +4185,7 @@ fi if [ -n "$EVALKEY" ]; then cat > "$outpath/src/corelib/global/qconfig_eval.cpp" < Date: Wed, 4 Nov 2009 15:40:28 +0100 Subject: Result API review with Jasmin QAbstractAnimation: currentTime returns the "complete" current time currentLoopTime() returns the time inside the current loop add setPaused(bool) for consistency with QTimeLine stateChanged: newState passed as first paramater (before oldState) for consistency with the reset of Qt QAnimationGroup: rename clearAnimations to clear rename insertAnimationAt to insertAnimation rename takeAnimationAt to takeAnimation QSequentialAnimationGroup: rename insertPauseAt to insertPause --- demos/sub-attaq/boat.cpp | 2 +- src/corelib/animation/qabstractanimation.cpp | 46 +- src/corelib/animation/qabstractanimation.h | 10 +- src/corelib/animation/qanimationgroup.cpp | 28 +- src/corelib/animation/qanimationgroup.h | 6 +- src/corelib/animation/qparallelanimationgroup.cpp | 6 +- src/corelib/animation/qparallelanimationgroup.h | 2 +- src/corelib/animation/qpauseanimation.cpp | 2 +- src/corelib/animation/qpropertyanimation.cpp | 6 +- src/corelib/animation/qpropertyanimation.h | 2 +- .../animation/qsequentialanimationgroup.cpp | 22 +- src/corelib/animation/qsequentialanimationgroup.h | 4 +- src/corelib/animation/qvariantanimation.cpp | 4 +- src/corelib/animation/qvariantanimation.h | 2 +- src/gui/itemviews/qtreeview_p.h | 2 +- .../tst_qparallelanimationgroup.cpp | 136 +++--- .../qpropertyanimation/tst_qpropertyanimation.cpp | 20 +- .../tst_qsequentialanimationgroup.cpp | 506 ++++++++++----------- tests/benchmarks/qanimation/rectanimation.cpp | 5 - tests/benchmarks/qanimation/rectanimation.h | 1 - 20 files changed, 416 insertions(+), 396 deletions(-) diff --git a/demos/sub-attaq/boat.cpp b/demos/sub-attaq/boat.cpp index cb40329..0ad31b1 100644 --- a/demos/sub-attaq/boat.cpp +++ b/demos/sub-attaq/boat.cpp @@ -68,7 +68,7 @@ static QAbstractAnimation *setupDestroyAnimation(Boat *boat) QPropertyAnimation *anim = new QPropertyAnimation(step, "opacity"); anim->setEndValue(1); anim->setDuration(100); - group->insertAnimationAt(i-1, anim); + group->insertAnimation(i-1, anim); //and then fade-out QPropertyAnimation *anim2 = new QPropertyAnimation(step, "opacity"); diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 4f93c1e..0cdc40c 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -115,7 +115,7 @@ */ /*! - \fn QAbstractAnimation::stateChanged(QAbstractAnimation::State oldState, QAbstractAnimation::State newState) + \fn QAbstractAnimation::stateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) QAbstractAnimation emits this signal whenever the state of the animation has changed from \a oldState to \a newState. This signal is emitted after the virtual @@ -357,12 +357,12 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) QUnifiedTimer::instance()->unregisterAnimation(q); } - q->updateState(oldState, newState); + q->updateState(newState, oldState); if (!guard || newState != state) //this is to be safe if updateState changes the state return; // Notify state change - emit q->stateChanged(oldState, newState); + emit q->stateChanged(newState, oldState); if (!guard || newState != state) //this is to be safe if updateState changes the state return; @@ -635,6 +635,18 @@ int QAbstractAnimation::totalDuration() const } /*! + Returns the current time inside the current loop. It can go from 0 to duration(). + + \sa duration(), currentTime +*/ + +int QAbstractAnimation::currentLoopTime() const +{ + Q_D(const QAbstractAnimation); + return d->currentTime; +} + +/*! \property QAbstractAnimation::currentTime \brief the current time and progress of the animation @@ -643,17 +655,14 @@ int QAbstractAnimation::totalDuration() const the animation run, setting the current time automatically as the animation progresses. - The animation's current time starts at 0, and ends at duration(). If the - animation's loopCount is larger than 1, the current time will rewind and - start at 0 again for the consecutive loops. If the animation has a pause. - currentTime will also include the duration of the pause. + The animation's current time starts at 0, and ends at totalDuration(). - \sa loopCount + \sa loopCount, currentLoopTime */ int QAbstractAnimation::currentTime() const { Q_D(const QAbstractAnimation); - return d->currentTime; + return d->totalCurrentTime; } void QAbstractAnimation::setCurrentTime(int msecs) { @@ -777,6 +786,21 @@ void QAbstractAnimation::resume() } /*! + If \a paused is true, the animation is paused. + If \a paused is false, the animation is resumed. + + \sa state(), pause(), resume() +*/ +void QAbstractAnimation::setPaused(bool paused) +{ + if (paused) + pause(); + else + resume(); +} + + +/*! \reimp */ bool QAbstractAnimation::event(QEvent *event) @@ -799,8 +823,8 @@ bool QAbstractAnimation::event(QEvent *event) \sa start(), stop(), pause(), resume() */ -void QAbstractAnimation::updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) +void QAbstractAnimation::updateState(QAbstractAnimation::State newState, + QAbstractAnimation::State oldState) { Q_UNUSED(oldState); Q_UNUSED(newState); diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h index 3d608b6..3c6e12f 100644 --- a/src/corelib/animation/qabstractanimation.h +++ b/src/corelib/animation/qabstractanimation.h @@ -95,6 +95,9 @@ public: Direction direction() const; void setDirection(Direction direction); + int currentTime() const; + int currentLoopTime() const; + int loopCount() const; void setLoopCount(int loopCount); int currentLoop() const; @@ -102,11 +105,9 @@ public: virtual int duration() const = 0; int totalDuration() const; - int currentTime() const; - Q_SIGNALS: void finished(); - void stateChanged(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); + void stateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); void currentLoopChanged(int currentLoop); void directionChanged(QAbstractAnimation::Direction); @@ -114,6 +115,7 @@ public Q_SLOTS: void start(QAbstractAnimation::DeletionPolicy policy = KeepWhenStopped); void pause(); void resume(); + void setPaused(bool); void stop(); void setCurrentTime(int msecs); @@ -122,7 +124,7 @@ protected: bool event(QEvent *event); virtual void updateCurrentTime(int currentTime) = 0; - virtual void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); + virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); virtual void updateDirection(QAbstractAnimation::Direction direction); private: diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp index 40f5936..64282ea 100644 --- a/src/corelib/animation/qanimationgroup.cpp +++ b/src/corelib/animation/qanimationgroup.cpp @@ -70,7 +70,7 @@ QAnimationGroup provides methods for adding and retrieving animations. Besides that, you can remove animations by calling remove(), and clear the animation group by calling - clearAnimations(). You may keep track of changes in the group's + clear(). You may keep track of changes in the group's animations by listening to QEvent::ChildAdded and QEvent::ChildRemoved events. @@ -151,7 +151,7 @@ int QAnimationGroup::animationCount() const Returns the index of \a animation. The returned index can be passed to the other functions that take an index as an argument. - \sa insertAnimationAt(), animationAt(), takeAnimationAt() + \sa insertAnimation(), animationAt(), takeAnimation() */ int QAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const { @@ -160,7 +160,7 @@ int QAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const } /*! - Adds \a animation to this group. This will call insertAnimationAt with + Adds \a animation to this group. This will call insertAnimation with index equals to animationCount(). \note The group takes ownership of the animation. @@ -170,7 +170,7 @@ int QAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const void QAnimationGroup::addAnimation(QAbstractAnimation *animation) { Q_D(QAnimationGroup); - insertAnimationAt(d->animations.count(), animation); + insertAnimation(d->animations.count(), animation); } /*! @@ -180,14 +180,14 @@ void QAnimationGroup::addAnimation(QAbstractAnimation *animation) \note The group takes ownership of the animation. - \sa takeAnimationAt(), addAnimation(), indexOfAnimation(), removeAnimation() + \sa takeAnimation(), addAnimation(), indexOfAnimation(), removeAnimation() */ -void QAnimationGroup::insertAnimationAt(int index, QAbstractAnimation *animation) +void QAnimationGroup::insertAnimation(int index, QAbstractAnimation *animation) { Q_D(QAnimationGroup); if (index < 0 || index > d->animations.size()) { - qWarning("QAnimationGroup::insertAnimationAt: index is out of bounds"); + qWarning("QAnimationGroup::insertAnimation: index is out of bounds"); return; } @@ -205,7 +205,7 @@ void QAnimationGroup::insertAnimationAt(int index, QAbstractAnimation *animation Removes \a animation from this group. The ownership of \a animation is transferred to the caller. - \sa takeAnimationAt(), insertAnimationAt(), addAnimation() + \sa takeAnimation(), insertAnimation(), addAnimation() */ void QAnimationGroup::removeAnimation(QAbstractAnimation *animation) { @@ -221,7 +221,7 @@ void QAnimationGroup::removeAnimation(QAbstractAnimation *animation) return; } - takeAnimationAt(index); + takeAnimation(index); } /*! @@ -229,13 +229,13 @@ void QAnimationGroup::removeAnimation(QAbstractAnimation *animation) \note The ownership of the animation is transferred to the caller. - \sa removeAnimation(), addAnimation(), insertAnimationAt(), indexOfAnimation() + \sa removeAnimation(), addAnimation(), insertAnimation(), indexOfAnimation() */ -QAbstractAnimation *QAnimationGroup::takeAnimationAt(int index) +QAbstractAnimation *QAnimationGroup::takeAnimation(int index) { Q_D(QAnimationGroup); if (index < 0 || index >= d->animations.size()) { - qWarning("QAnimationGroup::takeAnimationAt: no animation at index %d", index); + qWarning("QAnimationGroup::takeAnimation: no animation at index %d", index); return 0; } QAbstractAnimation *animation = d->animations.at(index); @@ -254,7 +254,7 @@ QAbstractAnimation *QAnimationGroup::takeAnimationAt(int index) \sa addAnimation(), removeAnimation() */ -void QAnimationGroup::clearAnimations() +void QAnimationGroup::clear() { Q_D(QAnimationGroup); qDeleteAll(d->animations); @@ -279,7 +279,7 @@ bool QAnimationGroup::event(QEvent *event) // case it might be called from the destructor. int index = d->animations.indexOf(a); if (index != -1) - takeAnimationAt(index); + takeAnimation(index); } return QAbstractAnimation::event(event); } diff --git a/src/corelib/animation/qanimationgroup.h b/src/corelib/animation/qanimationgroup.h index 86368a3..416ce3f 100644 --- a/src/corelib/animation/qanimationgroup.h +++ b/src/corelib/animation/qanimationgroup.h @@ -65,10 +65,10 @@ public: int animationCount() const; int indexOfAnimation(QAbstractAnimation *animation) const; void addAnimation(QAbstractAnimation *animation); - void insertAnimationAt(int index, QAbstractAnimation *animation); + void insertAnimation(int index, QAbstractAnimation *animation); void removeAnimation(QAbstractAnimation *animation); - QAbstractAnimation *takeAnimationAt(int index); - void clearAnimations(); + QAbstractAnimation *takeAnimation(int index); + void clear(); protected: QAnimationGroup(QAnimationGroupPrivate &dd, QObject *parent); diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 0a04c14..2d37d10 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -182,11 +182,11 @@ void QParallelAnimationGroup::updateCurrentTime(int currentTime) /*! \reimp */ -void QParallelAnimationGroup::updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) +void QParallelAnimationGroup::updateState(QAbstractAnimation::State newState, + QAbstractAnimation::State oldState) { Q_D(QParallelAnimationGroup); - QAnimationGroup::updateState(oldState, newState); + QAnimationGroup::updateState(newState, oldState); switch (newState) { case Stopped: diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h index 1cab91e..18ec885 100644 --- a/src/corelib/animation/qparallelanimationgroup.h +++ b/src/corelib/animation/qparallelanimationgroup.h @@ -68,7 +68,7 @@ protected: bool event(QEvent *event); void updateCurrentTime(int currentTime); - void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); void updateDirection(QAbstractAnimation::Direction direction); private: diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp index 21e5b08..1b3b654 100644 --- a/src/corelib/animation/qpauseanimation.cpp +++ b/src/corelib/animation/qpauseanimation.cpp @@ -56,7 +56,7 @@ It is not necessary to construct a QPauseAnimation yourself. QSequentialAnimationGroup provides the convenience functions \l{QSequentialAnimationGroup::}{addPause()} and - \l{QSequentialAnimationGroup::}{insertPauseAt()}. These functions + \l{QSequentialAnimationGroup::}{insertPause()}. These functions simply take the number of milliseconds the pause should last. \sa QSequentialAnimationGroup diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 4742e54..3065083 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -250,8 +250,8 @@ void QPropertyAnimation::updateCurrentValue(const QVariant &value) If the startValue is not defined when the state of the animation changes from Stopped to Running, the current property value is used as the initial value for the animation. */ -void QPropertyAnimation::updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) +void QPropertyAnimation::updateState(QAbstractAnimation::State newState, + QAbstractAnimation::State oldState) { Q_D(QPropertyAnimation); @@ -260,7 +260,7 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState, return; } - QVariantAnimation::updateState(oldState, newState); + QVariantAnimation::updateState(newState, oldState); QPropertyAnimation *animToStop = 0; { diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h index 2e2ca3a..61efed9 100644 --- a/src/corelib/animation/qpropertyanimation.h +++ b/src/corelib/animation/qpropertyanimation.h @@ -73,7 +73,7 @@ public: protected: bool event(QEvent *event); void updateCurrentValue(const QVariant &value); - void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); private: Q_DISABLE_COPY(QPropertyAnimation) diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 5ca560a..861e26e 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -50,7 +50,7 @@ another has finished playing. The animations are played in the order they are added to the group (using \l{QAnimationGroup::}{addAnimation()} or - \l{QAnimationGroup::}{insertAnimationAt()}). The animation group + \l{QAnimationGroup::}{insertAnimation()}). The animation group finishes when its last animation has finished. At each moment there is at most one animation that is active in @@ -59,7 +59,7 @@ A sequential animation group can be treated as any other animation, i.e., it can be started, stopped, and added to other - groups. You can also call addPause() or insertPauseAt() to add a + groups. You can also call addPause() or insertPause() to add a pause to a sequential animation group. \code @@ -269,7 +269,7 @@ QSequentialAnimationGroup::~QSequentialAnimationGroup() \l{QAnimationGroup::animationCount()}{animationCount} will be increased by one. - \sa insertPauseAt(), QAnimationGroup::addAnimation() + \sa insertPause(), QAnimationGroup::addAnimation() */ QPauseAnimation *QSequentialAnimationGroup::addPause(int msecs) { @@ -282,19 +282,19 @@ QPauseAnimation *QSequentialAnimationGroup::addPause(int msecs) Inserts a pause of \a msecs milliseconds at \a index in this animation group. - \sa addPause(), QAnimationGroup::insertAnimationAt() + \sa addPause(), QAnimationGroup::insertAnimation() */ -QPauseAnimation *QSequentialAnimationGroup::insertPauseAt(int index, int msecs) +QPauseAnimation *QSequentialAnimationGroup::insertPause(int index, int msecs) { Q_D(const QSequentialAnimationGroup); if (index < 0 || index > d->animations.size()) { - qWarning("QSequentialAnimationGroup::insertPauseAt: index is out of bounds"); + qWarning("QSequentialAnimationGroup::insertPause: index is out of bounds"); return 0; } QPauseAnimation *pause = new QPauseAnimation(msecs); - insertAnimationAt(index, pause); + insertAnimation(index, pause); return pause; } @@ -382,11 +382,11 @@ void QSequentialAnimationGroup::updateCurrentTime(int currentTime) /*! \reimp */ -void QSequentialAnimationGroup::updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) +void QSequentialAnimationGroup::updateState(QAbstractAnimation::State newState, + QAbstractAnimation::State oldState) { Q_D(QSequentialAnimationGroup); - QAnimationGroup::updateState(oldState, newState); + QAnimationGroup::updateState(newState, oldState); if (!d->currentAnimation) return; @@ -532,7 +532,7 @@ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index) currentAnimationIndex = animations.indexOf(currentAnimation); if (index < currentAnimationIndex || currentLoop != 0) { - qWarning("QSequentialGroup::insertAnimationAt only supports to add animations after the current one."); + qWarning("QSequentialGroup::insertAnimation only supports to add animations after the current one."); return; //we're not affected because it is added after the current one } } diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h index f30f851..97e7e01 100644 --- a/src/corelib/animation/qsequentialanimationgroup.h +++ b/src/corelib/animation/qsequentialanimationgroup.h @@ -65,7 +65,7 @@ public: ~QSequentialAnimationGroup(); QPauseAnimation *addPause(int msecs); - QPauseAnimation *insertPauseAt(int index, int msecs); + QPauseAnimation *insertPause(int index, int msecs); QAbstractAnimation *currentAnimation() const; int duration() const; @@ -78,7 +78,7 @@ protected: bool event(QEvent *event); void updateCurrentTime(int); - void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); void updateDirection(QAbstractAnimation::Direction direction); private: diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index de8185b..c735778 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -621,8 +621,8 @@ bool QVariantAnimation::event(QEvent *event) /*! \reimp */ -void QVariantAnimation::updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) +void QVariantAnimation::updateState(QAbstractAnimation::State newState, + QAbstractAnimation::State oldState) { Q_UNUSED(oldState); Q_UNUSED(newState); diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h index bc57b1c..89d9b34 100644 --- a/src/corelib/animation/qvariantanimation.h +++ b/src/corelib/animation/qvariantanimation.h @@ -103,7 +103,7 @@ protected: bool event(QEvent *event); void updateCurrentTime(int); - void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); virtual void updateCurrentValue(const QVariant &value) = 0; virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index aad5837..d58dea3 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -105,7 +105,7 @@ public: int top() const { return startValue().toInt(); } QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; } void updateCurrentValue(const QVariant &) { viewport->update(rect()); } - void updateState(State, State state) { if (state == Stopped) before = after = QPixmap(); } + void updateState(State state, State) { if (state == Stopped) before = after = QPixmap(); } } animatedOperation; void prepareAnimatedOperation(int item, QVariantAnimation::Direction d); void beginAnimatedOperation(); diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index 8d937e9..a26e0eb 100644 --- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -119,8 +119,8 @@ class TestAnimation : public QVariantAnimation Q_OBJECT public: virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)}; - virtual void updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) + virtual void updateState(QAbstractAnimation::State newState, + QAbstractAnimation::State oldState) { Q_UNUSED(oldState) Q_UNUSED(newState) @@ -135,8 +135,8 @@ public: TestAnimation2(int duration, QAbstractAnimation *animation) : QVariantAnimation(animation), m_duration(duration) {} virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)}; - virtual void updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) + virtual void updateState(QAbstractAnimation::State newState, + QAbstractAnimation::State oldState) { Q_UNUSED(oldState) Q_UNUSED(newState) @@ -223,33 +223,33 @@ void tst_QParallelAnimationGroup::setCurrentTime() QCOMPARE(notTimeDriven->state(), QAnimationGroup::Stopped); QCOMPARE(loopsForever->state(), QAnimationGroup::Stopped); - QCOMPARE(group.currentTime(), 1); - QCOMPARE(a1_p_o1->currentTime(), 1); - QCOMPARE(a1_p_o2->currentTime(), 1); - QCOMPARE(a1_p_o3->currentTime(), 1); - QCOMPARE(notTimeDriven->currentTime(), 1); - QCOMPARE(loopsForever->currentTime(), 1); + QCOMPARE(group.currentLoopTime(), 1); + QCOMPARE(a1_p_o1->currentLoopTime(), 1); + QCOMPARE(a1_p_o2->currentLoopTime(), 1); + QCOMPARE(a1_p_o3->currentLoopTime(), 1); + QCOMPARE(notTimeDriven->currentLoopTime(), 1); + QCOMPARE(loopsForever->currentLoopTime(), 1); // Current time = 250 group.setCurrentTime(250); - QCOMPARE(group.currentTime(), 250); - QCOMPARE(a1_p_o1->currentTime(), 250); - QCOMPARE(a1_p_o2->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 250); + QCOMPARE(a1_p_o1->currentLoopTime(), 250); + QCOMPARE(a1_p_o2->currentLoopTime(), 0); QCOMPARE(a1_p_o2->currentLoop(), 1); - QCOMPARE(a1_p_o3->currentTime(), 250); - QCOMPARE(notTimeDriven->currentTime(), 250); - QCOMPARE(loopsForever->currentTime(), 0); + QCOMPARE(a1_p_o3->currentLoopTime(), 250); + QCOMPARE(notTimeDriven->currentLoopTime(), 250); + QCOMPARE(loopsForever->currentLoopTime(), 0); QCOMPARE(loopsForever->currentLoop(), 1); // Current time = 251 group.setCurrentTime(251); - QCOMPARE(group.currentTime(), 251); - QCOMPARE(a1_p_o1->currentTime(), 250); - QCOMPARE(a1_p_o2->currentTime(), 1); + QCOMPARE(group.currentLoopTime(), 251); + QCOMPARE(a1_p_o1->currentLoopTime(), 250); + QCOMPARE(a1_p_o2->currentLoopTime(), 1); QCOMPARE(a1_p_o2->currentLoop(), 1); - QCOMPARE(a1_p_o3->currentTime(), 250); - QCOMPARE(notTimeDriven->currentTime(), 251); - QCOMPARE(loopsForever->currentTime(), 1); + QCOMPARE(a1_p_o3->currentLoopTime(), 250); + QCOMPARE(notTimeDriven->currentLoopTime(), 251); + QCOMPARE(loopsForever->currentLoopTime(), 1); } void tst_QParallelAnimationGroup::stateChanged() @@ -278,18 +278,18 @@ void tst_QParallelAnimationGroup::stateChanged() group.start(); //all the animations should be started QCOMPARE(spy1.count(), 1); - QCOMPARE(qVariantValue(spy1.last().at(1)), TestAnimation::Running); + QCOMPARE(qVariantValue(spy1.last().first()), TestAnimation::Running); QCOMPARE(spy2.count(), 1); - QCOMPARE(qVariantValue(spy2.last().at(1)), TestAnimation::Running); + QCOMPARE(qVariantValue(spy2.last().first()), TestAnimation::Running); QCOMPARE(spy3.count(), 1); - QCOMPARE(qVariantValue(spy3.last().at(1)), TestAnimation::Running); + QCOMPARE(qVariantValue(spy3.last().first()), TestAnimation::Running); QCOMPARE(spy4.count(), 1); - QCOMPARE(qVariantValue(spy4.last().at(1)), TestAnimation::Running); + QCOMPARE(qVariantValue(spy4.last().first()), TestAnimation::Running); group.setCurrentTime(1500); //anim1 should be finished QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(spy1.count(), 2); - QCOMPARE(qVariantValue(spy1.last().at(1)), TestAnimation::Stopped); + QCOMPARE(qVariantValue(spy1.last().first()), TestAnimation::Stopped); QCOMPARE(spy2.count(), 1); //no change QCOMPARE(spy3.count(), 1); //no change QCOMPARE(spy4.count(), 1); //no change @@ -298,7 +298,7 @@ void tst_QParallelAnimationGroup::stateChanged() QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(spy1.count(), 2); //no change QCOMPARE(spy2.count(), 2); - QCOMPARE(qVariantValue(spy2.last().at(1)), TestAnimation::Stopped); + QCOMPARE(qVariantValue(spy2.last().first()), TestAnimation::Stopped); QCOMPARE(spy3.count(), 1); //no change QCOMPARE(spy4.count(), 1); //no change @@ -307,9 +307,9 @@ void tst_QParallelAnimationGroup::stateChanged() QCOMPARE(spy1.count(), 2); //no change QCOMPARE(spy2.count(), 2); //no change QCOMPARE(spy3.count(), 2); - QCOMPARE(qVariantValue(spy3.last().at(1)), TestAnimation::Stopped); + QCOMPARE(qVariantValue(spy3.last().first()), TestAnimation::Stopped); QCOMPARE(spy4.count(), 2); - QCOMPARE(qVariantValue(spy4.last().at(1)), TestAnimation::Stopped); + QCOMPARE(qVariantValue(spy4.last().first()), TestAnimation::Stopped); //cleanup spy1.clear(); @@ -326,22 +326,22 @@ void tst_QParallelAnimationGroup::stateChanged() QCOMPARE(spy1.count(), 0); QCOMPARE(spy2.count(), 0); QCOMPARE(spy3.count(), 1); - QCOMPARE(qVariantValue(spy3.last().at(1)), TestAnimation::Running); + QCOMPARE(qVariantValue(spy3.last().first()), TestAnimation::Running); QCOMPARE(spy4.count(), 1); - QCOMPARE(qVariantValue(spy4.last().at(1)), TestAnimation::Running); + QCOMPARE(qVariantValue(spy4.last().first()), TestAnimation::Running); group.setCurrentTime(1500); //anim2 should be started QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(spy1.count(), 0); //no change QCOMPARE(spy2.count(), 1); - QCOMPARE(qVariantValue(spy2.last().at(1)), TestAnimation::Running); + QCOMPARE(qVariantValue(spy2.last().first()), TestAnimation::Running); QCOMPARE(spy3.count(), 1); //no change QCOMPARE(spy4.count(), 1); //no change group.setCurrentTime(500); //anim1 is finally also started QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(spy1.count(), 1); - QCOMPARE(qVariantValue(spy1.last().at(1)), TestAnimation::Running); + QCOMPARE(qVariantValue(spy1.last().first()), TestAnimation::Running); QCOMPARE(spy2.count(), 1); //no change QCOMPARE(spy3.count(), 1); //no change QCOMPARE(spy4.count(), 1); //no change @@ -349,13 +349,13 @@ void tst_QParallelAnimationGroup::stateChanged() group.setCurrentTime(0); //everything should be stopped QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(spy1.count(), 2); - QCOMPARE(qVariantValue(spy1.last().at(1)), TestAnimation::Stopped); + QCOMPARE(qVariantValue(spy1.last().first()), TestAnimation::Stopped); QCOMPARE(spy2.count(), 2); - QCOMPARE(qVariantValue(spy2.last().at(1)), TestAnimation::Stopped); + QCOMPARE(qVariantValue(spy2.last().first()), TestAnimation::Stopped); QCOMPARE(spy3.count(), 2); - QCOMPARE(qVariantValue(spy3.last().at(1)), TestAnimation::Stopped); + QCOMPARE(qVariantValue(spy3.last().first()), TestAnimation::Stopped); QCOMPARE(spy4.count(), 2); - QCOMPARE(qVariantValue(spy4.last().at(1)), TestAnimation::Stopped); + QCOMPARE(qVariantValue(spy4.last().first()), TestAnimation::Stopped); } void tst_QParallelAnimationGroup::clearGroup() @@ -375,9 +375,9 @@ void tst_QParallelAnimationGroup::clearGroup() children[i] = group.animationAt(i); } - group.clearAnimations(); + group.clear(); QCOMPARE(group.animationCount(), 0); - QCOMPARE(group.currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 0); for (int i = 0; i < animationCount; ++i) QVERIFY(children[i].isNull()); } @@ -460,9 +460,9 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup() QCOMPARE(groupStateChangedSpy.count(), 1); QCOMPARE(childStateChangedSpy.count(), 1); - QCOMPARE(qVariantValue(groupStateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(groupStateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(childStateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(childStateChangedSpy.at(0).first()), QAnimationGroup::Running); // starting directly a running child will not have any effect @@ -501,13 +501,13 @@ void tst_QParallelAnimationGroup::deleteChildrenWithRunningGroup() QCOMPARE(anim1->state(), QAnimationGroup::Running); QTest::qWait(80); - QVERIFY(group.currentTime() > 0); + QVERIFY(group.currentLoopTime() > 0); delete anim1; QVERIFY(group.animationCount() == 0); QCOMPARE(group.duration(), 0); QCOMPARE(group.state(), QAnimationGroup::Stopped); - QCOMPARE(group.currentTime(), 0); //that's the invariant + QCOMPARE(group.currentLoopTime(), 0); //that's the invariant } void tst_QParallelAnimationGroup::startChildrenWithStoppedGroup() @@ -622,11 +622,11 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild() anim2.start(); anim2.pause(); - QCOMPARE(qVariantValue(stateChangedSpy1.at(0).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy1.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(stateChangedSpy2.at(0).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy2.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(stateChangedSpy2.at(1).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy2.at(1).first()), QAnimationGroup::Paused); QCOMPARE(group.state(), QAnimationGroup::Stopped); @@ -636,15 +636,15 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild() group.start(); QCOMPARE(stateChangedSpy1.count(), 3); - QCOMPARE(qVariantValue(stateChangedSpy1.at(1).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy1.at(1).first()), QAnimationGroup::Stopped); - QCOMPARE(qVariantValue(stateChangedSpy1.at(2).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy1.at(2).first()), QAnimationGroup::Running); QCOMPARE(stateChangedSpy2.count(), 4); - QCOMPARE(qVariantValue(stateChangedSpy2.at(2).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy2.at(2).first()), QAnimationGroup::Stopped); - QCOMPARE(qVariantValue(stateChangedSpy2.at(3).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy2.at(3).first()), QAnimationGroup::Running); QCOMPARE(group.state(), QAnimationGroup::Running); @@ -687,19 +687,19 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation() group.start(); QCOMPARE(stateChangedSpy1.count(), 2); QCOMPARE(finishedSpy1.count(), 1); - QCOMPARE(qVariantValue(stateChangedSpy1.at(0).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy1.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(stateChangedSpy1.at(1).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy1.at(1).first()), QAnimationGroup::Stopped); QCOMPARE(stateChangedSpy2.count(), 1); QCOMPARE(finishedSpy2.count(), 0); - QCOMPARE(qVariantValue(stateChangedSpy1.at(0).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy1.at(0).first()), QAnimationGroup::Running); QCOMPARE(stateChangedSpy3.count(), 1); QCOMPARE(finishedSpy3.count(), 0); - QCOMPARE(qVariantValue(stateChangedSpy3.at(0).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy3.at(0).first()), QAnimationGroup::Running); @@ -762,9 +762,9 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations() group.start(); QCOMPARE(stateChangedSpy.count(), 2); - QCOMPARE(qVariantValue(stateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(stateChangedSpy.at(1).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy.at(1).first()), QAnimationGroup::Stopped); QCOMPARE(group.state(), QAnimationGroup::Running); @@ -915,9 +915,9 @@ void tst_QParallelAnimationGroup::loopCount() group.setCurrentTime(currentGroupTime); - QCOMPARE(anim1.currentTime(), expected1.time); - QCOMPARE(anim2.currentTime(), expected2.time); - QCOMPARE(anim3.currentTime(), expected3.time); + QCOMPARE(anim1.currentLoopTime(), expected1.time); + QCOMPARE(anim2.currentLoopTime(), expected2.time); + QCOMPARE(anim3.currentLoopTime(), expected3.time); if (expected1.state >=0) QCOMPARE(int(anim1.state()), expected1.state); @@ -968,22 +968,22 @@ void tst_QParallelAnimationGroup::pauseResume() QCOMPARE(anim->state(), QAnimationGroup::Running); QCOMPARE(spy.count(), 1); spy.clear(); - const int currentTime = group.currentTime(); - QCOMPARE(anim->currentTime(), currentTime); + const int currentTime = group.currentLoopTime(); + QCOMPARE(anim->currentLoopTime(), currentTime); group.pause(); QCOMPARE(group.state(), QAnimationGroup::Paused); - QCOMPARE(group.currentTime(), currentTime); + QCOMPARE(group.currentLoopTime(), currentTime); QCOMPARE(anim->state(), QAnimationGroup::Paused); - QCOMPARE(anim->currentTime(), currentTime); + QCOMPARE(anim->currentLoopTime(), currentTime); QCOMPARE(spy.count(), 1); spy.clear(); group.resume(); QCOMPARE(group.state(), QAnimationGroup::Running); - QCOMPARE(group.currentTime(), currentTime); + QCOMPARE(group.currentLoopTime(), currentTime); QCOMPARE(anim->state(), QAnimationGroup::Running); - QCOMPARE(anim->currentTime(), currentTime); + QCOMPARE(anim->currentLoopTime(), currentTime); QCOMPARE(spy.count(), 1); group.stop(); @@ -991,10 +991,10 @@ void tst_QParallelAnimationGroup::pauseResume() new TestAnimation2(500, &group); group.start(); QCOMPARE(spy.count(), 1); //the animation should have been started - QCOMPARE(qVariantValue(spy.last().at(1)), TestAnimation::Running); + QCOMPARE(qVariantValue(spy.last().first()), TestAnimation::Running); group.setCurrentTime(250); //end of first animation QCOMPARE(spy.count(), 2); //the animation should have been stopped - QCOMPARE(qVariantValue(spy.last().at(1)), TestAnimation::Stopped); + QCOMPARE(qVariantValue(spy.last().first()), TestAnimation::Stopped); group.pause(); QCOMPARE(spy.count(), 2); //this shouldn't have changed group.resume(); diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 56c1ced..f41fff1 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -225,7 +225,7 @@ void tst_QPropertyAnimation::setCurrentTime() animation.setLoopCount(loopCount); animation.setCurrentTime(currentTime); - QCOMPARE(animation.currentTime(), testCurrentTime); + QCOMPARE(animation.currentLoopTime(), testCurrentTime); QCOMPARE(animation.currentLoop(), testCurrentLoop); } @@ -280,7 +280,7 @@ void tst_QPropertyAnimation::statesAndSignals() QCOMPARE(anim->state(), QAnimationGroup::Stopped); QCOMPARE(runningSpy.count(), 1); //anim must have stopped QCOMPARE(finishedSpy.count(), 0); - QCOMPARE(anim->currentTime(), 0); + QCOMPARE(anim->currentLoopTime(), 0); QCOMPARE(anim->currentLoop(), 0); QCOMPARE(currentLoopSpy.count(), 2); runningSpy.clear(); @@ -291,7 +291,7 @@ void tst_QPropertyAnimation::statesAndSignals() QCOMPARE(runningSpy.count(), 2); //started and stopped again runningSpy.clear(); QCOMPARE(finishedSpy.count(), 1); - QCOMPARE(anim->currentTime(), 100); + QCOMPARE(anim->currentLoopTime(), 100); QCOMPARE(anim->currentLoop(), 2); QCOMPARE(currentLoopSpy.count(), 4); @@ -312,7 +312,7 @@ void tst_QPropertyAnimation::statesAndSignals() QCOMPARE(anim->currentLoop(), 2); QCOMPARE(runningSpy.count(), 1); // anim has stopped QCOMPARE(finishedSpy.count(), 2); - QCOMPARE(anim->currentTime(), 100); + QCOMPARE(anim->currentLoopTime(), 100); delete anim; } @@ -864,16 +864,16 @@ void tst_QPropertyAnimation::zeroDurationStart() //let's check the first state change const QVariantList firstChange = spy.first(); //old state - QCOMPARE(qVariantValue(firstChange.first()), QAbstractAnimation::Stopped); + QCOMPARE(qVariantValue(firstChange.last()), QAbstractAnimation::Stopped); //new state - QCOMPARE(qVariantValue(firstChange.last()), QAbstractAnimation::Running); + QCOMPARE(qVariantValue(firstChange.first()), QAbstractAnimation::Running); //let's check the first state change const QVariantList secondChange = spy.last(); //old state - QCOMPARE(qVariantValue(secondChange.first()), QAbstractAnimation::Running); + QCOMPARE(qVariantValue(secondChange.last()), QAbstractAnimation::Running); //new state - QCOMPARE(qVariantValue(secondChange.last()), QAbstractAnimation::Stopped); + QCOMPARE(qVariantValue(secondChange.first()), QAbstractAnimation::Stopped); } #define Pause 1 @@ -1171,9 +1171,9 @@ public: innerAnim->start(); } - void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState) + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { - QPropertyAnimation::updateState(oldState, newState); + QPropertyAnimation::updateState(newState, oldState); if (newState == QAbstractAnimation::Stopped) delete innerAnim; } diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index f6afc5b..28fccac 100644 --- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -87,7 +87,7 @@ private slots: void currentAnimation(); void currentAnimationWithZeroDuration(); void insertAnimation(); - void clearAnimations(); + void clear(); void pauseResume(); }; @@ -134,8 +134,8 @@ class TestAnimation : public QVariantAnimation Q_OBJECT public: virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)}; - virtual void updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) + virtual void updateState(QAbstractAnimation::State newState, + QAbstractAnimation::State oldState) { Q_UNUSED(oldState) Q_UNUSED(newState) @@ -208,119 +208,119 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QCOMPARE(sequence2->state(), QAnimationGroup::Stopped); QCOMPARE(a1_s_o2->state(), QAnimationGroup::Stopped); - QCOMPARE(group.currentTime(), 1); - QCOMPARE(sequence->currentTime(), 1); - QCOMPARE(a1_s_o1->currentTime(), 1); - QCOMPARE(a2_s_o1->currentTime(), 0); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 1); + QCOMPARE(sequence->currentLoopTime(), 1); + QCOMPARE(a1_s_o1->currentLoopTime(), 1); + QCOMPARE(a2_s_o1->currentLoopTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // Current time = 250 group.setCurrentTime(250); - QCOMPARE(group.currentTime(), 250); - QCOMPARE(sequence->currentTime(), 250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 0); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 250); + QCOMPARE(sequence->currentLoopTime(), 250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // Current time = 251 group.setCurrentTime(251); - QCOMPARE(group.currentTime(), 251); - QCOMPARE(sequence->currentTime(), 251); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 1); + QCOMPARE(group.currentLoopTime(), 251); + QCOMPARE(sequence->currentLoopTime(), 251); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 1); QCOMPARE(a2_s_o1->currentLoop(), 0); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(sequence2->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(sequence2->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // Current time = 750 group.setCurrentTime(750); - QCOMPARE(group.currentTime(), 750); - QCOMPARE(sequence->currentTime(), 750); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 750); + QCOMPARE(sequence->currentLoopTime(), 750); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 0); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(sequence2->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(sequence2->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // Current time = 1000 group.setCurrentTime(1000); - QCOMPARE(group.currentTime(), 1000); - QCOMPARE(sequence->currentTime(), 1000); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1000); + QCOMPARE(sequence->currentLoopTime(), 1000); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(sequence2->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(sequence2->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // Current time = 1010 group.setCurrentTime(1010); - QCOMPARE(group.currentTime(), 1010); - QCOMPARE(sequence->currentTime(), 1010); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1010); + QCOMPARE(sequence->currentLoopTime(), 1010); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 10); - QCOMPARE(sequence2->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 10); + QCOMPARE(sequence2->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // Current time = 1250 group.setCurrentTime(1250); - QCOMPARE(group.currentTime(), 1250); - QCOMPARE(sequence->currentTime(), 1250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1250); + QCOMPARE(sequence->currentLoopTime(), 1250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 250); - QCOMPARE(sequence2->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 250); + QCOMPARE(sequence2->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // Current time = 1500 group.setCurrentTime(1500); - QCOMPARE(group.currentTime(), 1500); - QCOMPARE(sequence->currentTime(), 1250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1500); + QCOMPARE(sequence->currentLoopTime(), 1250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 250); - QCOMPARE(sequence2->currentTime(), 250); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 250); + QCOMPARE(sequence2->currentLoopTime(), 250); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // Current time = 1750 group.setCurrentTime(1750); - QCOMPARE(group.currentTime(), 1750); - QCOMPARE(sequence->currentTime(), 1250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1750); + QCOMPARE(sequence->currentLoopTime(), 1250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 250); - QCOMPARE(sequence2->currentTime(), 500); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(a1_s_o3->currentTime(), 250); + QCOMPARE(a3_s_o1->currentLoopTime(), 250); + QCOMPARE(sequence2->currentLoopTime(), 500); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(a1_s_o3->currentLoopTime(), 250); // Current time = 2000 group.setCurrentTime(2000); - QCOMPARE(group.currentTime(), 1750); - QCOMPARE(sequence->currentTime(), 1250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1750); + QCOMPARE(sequence->currentLoopTime(), 1250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 250); - QCOMPARE(sequence2->currentTime(), 500); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(a1_s_o3->currentTime(), 250); + QCOMPARE(a3_s_o1->currentLoopTime(), 250); + QCOMPARE(sequence2->currentLoopTime(), 500); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(a1_s_o3->currentLoopTime(), 250); } void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation() @@ -357,40 +357,40 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation() QCOMPARE(notTimeDriven->state(), QAnimationGroup::Stopped); QCOMPARE(loopsForever->state(), QAnimationGroup::Stopped); - QCOMPARE(group.currentTime(), 1); - QCOMPARE(sequence->currentTime(), 1); - QCOMPARE(a1_s_o1->currentTime(), 1); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(notTimeDriven->currentTime(), 0); - QCOMPARE(loopsForever->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 1); + QCOMPARE(sequence->currentLoopTime(), 1); + QCOMPARE(a1_s_o1->currentLoopTime(), 1); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(notTimeDriven->currentLoopTime(), 0); + QCOMPARE(loopsForever->currentLoopTime(), 0); // Current time = 250 group.setCurrentTime(250); - QCOMPARE(group.currentTime(), 250); - QCOMPARE(sequence->currentTime(), 250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(notTimeDriven->currentTime(), 0); - QCOMPARE(loopsForever->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 250); + QCOMPARE(sequence->currentLoopTime(), 250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(notTimeDriven->currentLoopTime(), 0); + QCOMPARE(loopsForever->currentLoopTime(), 0); // Current time = 500 group.setCurrentTime(500); - QCOMPARE(group.currentTime(), 500); - QCOMPARE(sequence->currentTime(), 500); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(notTimeDriven->currentTime(), 0); - QCOMPARE(loopsForever->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 500); + QCOMPARE(sequence->currentLoopTime(), 500); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(notTimeDriven->currentLoopTime(), 0); + QCOMPARE(loopsForever->currentLoopTime(), 0); QCOMPARE(group.currentAnimation(), notTimeDriven); // Current time = 505 group.setCurrentTime(505); - QCOMPARE(group.currentTime(), 505); - QCOMPARE(sequence->currentTime(), 500); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(notTimeDriven->currentTime(), 5); - QCOMPARE(loopsForever->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 505); + QCOMPARE(sequence->currentLoopTime(), 500); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(notTimeDriven->currentLoopTime(), 5); + QCOMPARE(loopsForever->currentLoopTime(), 0); QCOMPARE(group.currentAnimation(), notTimeDriven); QCOMPARE(sequence->state(), QAnimationGroup::Stopped); QCOMPARE(a1_s_o1->state(), QAnimationGroup::Stopped); @@ -400,12 +400,12 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation() // Current time = 750 (end of notTimeDriven animation) group.setCurrentTime(750); - QCOMPARE(group.currentTime(), 750); - QCOMPARE(sequence->currentTime(), 500); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(notTimeDriven->currentTime(), 250); - QCOMPARE(loopsForever->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 750); + QCOMPARE(sequence->currentLoopTime(), 500); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(notTimeDriven->currentLoopTime(), 250); + QCOMPARE(loopsForever->currentLoopTime(), 0); QCOMPARE(group.currentAnimation(), loopsForever); QCOMPARE(sequence->state(), QAnimationGroup::Stopped); QCOMPARE(a1_s_o1->state(), QAnimationGroup::Stopped); @@ -415,13 +415,13 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation() // Current time = 800 (as notTimeDriven was finished at 750, loopsforever should still run) group.setCurrentTime(800); - QCOMPARE(group.currentTime(), 800); + QCOMPARE(group.currentLoopTime(), 800); QCOMPARE(group.currentAnimation(), loopsForever); - QCOMPARE(sequence->currentTime(), 500); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(notTimeDriven->currentTime(), 250); - QCOMPARE(loopsForever->currentTime(), 50); + QCOMPARE(sequence->currentLoopTime(), 500); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(notTimeDriven->currentLoopTime(), 250); + QCOMPARE(loopsForever->currentLoopTime(), 50); loopsForever->stop(); // this should stop the group @@ -466,26 +466,26 @@ void tst_QSequentialAnimationGroup::seekingForwards() QCOMPARE(a1_s_o2->state(), QAnimationGroup::Stopped); QCOMPARE(a1_s_o3->state(), QAnimationGroup::Stopped); - QCOMPARE(group.currentTime(), 1); - QCOMPARE(sequence->currentTime(), 1); - QCOMPARE(a1_s_o1->currentTime(), 1); - QCOMPARE(a2_s_o1->currentTime(), 0); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(sequence2->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 1); + QCOMPARE(sequence->currentLoopTime(), 1); + QCOMPARE(a1_s_o1->currentLoopTime(), 1); + QCOMPARE(a2_s_o1->currentLoopTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(sequence2->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // Current time = 1500 group.setCurrentTime(1500); - QCOMPARE(group.currentTime(), 1500); - QCOMPARE(sequence->currentTime(), 1250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1500); + QCOMPARE(sequence->currentLoopTime(), 1250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 250); - QCOMPARE(sequence2->currentTime(), 250); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 250); + QCOMPARE(sequence2->currentLoopTime(), 250); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); // this will restart the group group.start(); @@ -499,15 +499,15 @@ void tst_QSequentialAnimationGroup::seekingForwards() // Current time = 1750 group.setCurrentTime(1750); - QCOMPARE(group.currentTime(), 1750); - QCOMPARE(sequence->currentTime(), 1250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1750); + QCOMPARE(sequence->currentLoopTime(), 1250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 250); - QCOMPARE(sequence2->currentTime(), 500); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(a1_s_o3->currentTime(), 250); + QCOMPARE(a3_s_o1->currentLoopTime(), 250); + QCOMPARE(sequence2->currentLoopTime(), 500); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(a1_s_o3->currentLoopTime(), 250); } void tst_QSequentialAnimationGroup::seekingBackwards() @@ -537,15 +537,15 @@ void tst_QSequentialAnimationGroup::seekingBackwards() // Current time = 1600 group.setCurrentTime(1600); - QCOMPARE(group.currentTime(), 1600); - QCOMPARE(sequence->currentTime(), 1250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1600); + QCOMPARE(sequence->currentLoopTime(), 1250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 250); - QCOMPARE(sequence2->currentTime(), 350); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(a1_s_o3->currentTime(), 100); + QCOMPARE(a3_s_o1->currentLoopTime(), 250); + QCOMPARE(sequence2->currentLoopTime(), 350); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(a1_s_o3->currentLoopTime(), 100); QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(sequence->state(), QAnimationGroup::Stopped); @@ -556,22 +556,22 @@ void tst_QSequentialAnimationGroup::seekingBackwards() // Seeking backwards, current time = 1 group.setCurrentTime(1); - QCOMPARE(group.currentTime(), 1); - QCOMPARE(sequence->currentTime(), 1); - QCOMPARE(a1_s_o1->currentTime(), 1); + QCOMPARE(group.currentLoopTime(), 1); + QCOMPARE(sequence->currentLoopTime(), 1); + QCOMPARE(a1_s_o1->currentLoopTime(), 1); QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children," "hence they don't reset from their current animation", Continue); - QCOMPARE(a2_s_o1->currentTime(), 0); + QCOMPARE(a2_s_o1->currentLoopTime(), 0); QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children," "hence they don't reset from their current animation", Continue); QCOMPARE(a2_s_o1->currentLoop(), 0); QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children," "hence they don't reset from their current animation", Continue); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(sequence2->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 0); - QCOMPARE(a1_s_o3->currentTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(sequence2->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 0); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(sequence->state(), QAnimationGroup::Running); @@ -582,15 +582,15 @@ void tst_QSequentialAnimationGroup::seekingBackwards() // Current time = 2000 group.setCurrentTime(2000); - QCOMPARE(group.currentTime(), 1750); - QCOMPARE(sequence->currentTime(), 1250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 1750); + QCOMPARE(sequence->currentLoopTime(), 1250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 2); - QCOMPARE(a3_s_o1->currentTime(), 250); - QCOMPARE(sequence2->currentTime(), 500); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(a1_s_o3->currentTime(), 250); + QCOMPARE(a3_s_o1->currentLoopTime(), 250); + QCOMPARE(sequence2->currentLoopTime(), 500); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(a1_s_o3->currentLoopTime(), 250); QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(sequence->state(), QAnimationGroup::Stopped); @@ -612,7 +612,7 @@ static bool compareStates(const QSignalSpy& spy, const StateList &expectedStates } QList args = spy.at(i); QAbstractAnimation::State st = expectedStates.at(i); - QAbstractAnimation::State actual = qVariantValue(args.value(1)); + QAbstractAnimation::State actual = qVariantValue(args.first()); if (equals && actual != st) { equals = false; break; @@ -672,14 +672,14 @@ void tst_QSequentialAnimationGroup::pauseAndResume() // Current time = 1751 group.setCurrentTime(1751); - QCOMPARE(group.currentTime(), 1751); - QCOMPARE(sequence->currentTime(), 751); + QCOMPARE(group.currentLoopTime(), 1751); + QCOMPARE(sequence->currentLoopTime(), 751); QCOMPARE(sequence->currentLoop(), 1); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 1); QCOMPARE(a3_s_o1->currentLoop(), 0); - QCOMPARE(a3_s_o1->currentTime(), 1); + QCOMPARE(a3_s_o1->currentLoopTime(), 1); QCOMPARE(group.state(), QAnimationGroup::Paused); QCOMPARE(sequence->state(), QAnimationGroup::Paused); @@ -696,20 +696,20 @@ void tst_QSequentialAnimationGroup::pauseAndResume() << QAbstractAnimation::Running << QAbstractAnimation::Stopped))); - QCOMPARE(qVariantValue(a1StateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(a1StateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(a1StateChangedSpy.at(1).at(1)), + QCOMPARE(qVariantValue(a1StateChangedSpy.at(1).first()), QAnimationGroup::Paused); - QCOMPARE(qVariantValue(a1StateChangedSpy.at(2).at(1)), + QCOMPARE(qVariantValue(a1StateChangedSpy.at(2).first()), QAnimationGroup::Stopped); - QCOMPARE(qVariantValue(a1StateChangedSpy.at(3).at(1)), + QCOMPARE(qVariantValue(a1StateChangedSpy.at(3).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(a1StateChangedSpy.at(4).at(1)), + QCOMPARE(qVariantValue(a1StateChangedSpy.at(4).first()), QAnimationGroup::Stopped); - QCOMPARE(qVariantValue(seqStateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(seqStateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(seqStateChangedSpy.at(1).at(1)), + QCOMPARE(qVariantValue(seqStateChangedSpy.at(1).first()), QAnimationGroup::Paused); group.resume(); @@ -720,17 +720,17 @@ void tst_QSequentialAnimationGroup::pauseAndResume() QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped); QCOMPARE(a3_s_o1->state(), QAnimationGroup::Running); - QVERIFY(group.currentTime() >= 1751); - QVERIFY(sequence->currentTime() >= 751); + QVERIFY(group.currentLoopTime() >= 1751); + QVERIFY(sequence->currentLoopTime() >= 751); QCOMPARE(sequence->currentLoop(), 1); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 1); QCOMPARE(a3_s_o1->currentLoop(), 0); - QVERIFY(a3_s_o1->currentTime() >= 1); + QVERIFY(a3_s_o1->currentLoopTime() >= 1); QCOMPARE(seqStateChangedSpy.count(), 3); // Running,Paused,Running - QCOMPARE(qVariantValue(seqStateChangedSpy.at(2).at(1)), + QCOMPARE(qVariantValue(seqStateChangedSpy.at(2).first()), QAnimationGroup::Running); group.pause(); @@ -741,23 +741,23 @@ void tst_QSequentialAnimationGroup::pauseAndResume() QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped); QCOMPARE(a3_s_o1->state(), QAnimationGroup::Paused); - QVERIFY(group.currentTime() >= 1751); - QVERIFY(sequence->currentTime() >= 751); + QVERIFY(group.currentLoopTime() >= 1751); + QVERIFY(sequence->currentLoopTime() >= 751); QCOMPARE(sequence->currentLoop(), 1); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 1); QCOMPARE(a3_s_o1->currentLoop(), 0); - QVERIFY(a3_s_o1->currentTime() >= 1); + QVERIFY(a3_s_o1->currentLoopTime() >= 1); QCOMPARE(seqStateChangedSpy.count(), 4); // Running,Paused,Running,Paused - QCOMPARE(qVariantValue(seqStateChangedSpy.at(3).at(1)), + QCOMPARE(qVariantValue(seqStateChangedSpy.at(3).first()), QAnimationGroup::Paused); group.stop(); QCOMPARE(seqStateChangedSpy.count(), 5); // Running,Paused,Running,Paused,Stopped - QCOMPARE(qVariantValue(seqStateChangedSpy.at(4).at(1)), + QCOMPARE(qVariantValue(seqStateChangedSpy.at(4).first()), QAnimationGroup::Stopped); } @@ -797,20 +797,20 @@ void tst_QSequentialAnimationGroup::restart() for (int i = 0; i < 3; i++) { QCOMPARE(animsStateChanged[i]->count(), 4); - QCOMPARE(qVariantValue(animsStateChanged[i]->at(0).at(1)), + QCOMPARE(qVariantValue(animsStateChanged[i]->at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(animsStateChanged[i]->at(1).at(1)), + QCOMPARE(qVariantValue(animsStateChanged[i]->at(1).first()), QAnimationGroup::Stopped); - QCOMPARE(qVariantValue(animsStateChanged[i]->at(2).at(1)), + QCOMPARE(qVariantValue(animsStateChanged[i]->at(2).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(animsStateChanged[i]->at(3).at(1)), + QCOMPARE(qVariantValue(animsStateChanged[i]->at(3).first()), QAnimationGroup::Stopped); } QCOMPARE(seqStateChangedSpy.count(), 2); - QCOMPARE(qVariantValue(seqStateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(seqStateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(seqStateChangedSpy.at(1).at(1)), + QCOMPARE(qVariantValue(seqStateChangedSpy.at(1).first()), QAnimationGroup::Stopped); QCOMPARE(seqCurrentAnimChangedSpy.count(), 6); @@ -855,15 +855,15 @@ void tst_QSequentialAnimationGroup::looping() // Current time = 1750 group.setCurrentTime(1750); - QCOMPARE(group.currentTime(), 1750); - QCOMPARE(sequence->currentTime(), 750); + QCOMPARE(group.currentLoopTime(), 1750); + QCOMPARE(sequence->currentLoopTime(), 750); QCOMPARE(sequence->currentLoop(), 1); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 1); // this animation is at the beginning because it is the current one inside sequence QCOMPARE(a3_s_o1->currentLoop(), 0); - QCOMPARE(a3_s_o1->currentTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); QCOMPARE(sequence->currentAnimation(), a3_s_o1); QCOMPARE(group.state(), QAnimationGroup::Paused); @@ -890,16 +890,16 @@ void tst_QSequentialAnimationGroup::looping() // Looping, current time = duration + 1 group.setCurrentTime(group.duration() + 1); - QCOMPARE(group.currentTime(), 1); + QCOMPARE(group.currentLoopTime(), 1); QCOMPARE(group.currentLoop(), 1); - QCOMPARE(sequence->currentTime(), 1); + QCOMPARE(sequence->currentLoopTime(), 1); QCOMPARE(sequence->currentLoop(), 0); - QCOMPARE(a1_s_o1->currentTime(), 1); - QCOMPARE(a2_s_o1->currentTime(), 250); + QCOMPARE(a1_s_o1->currentLoopTime(), 1); + QCOMPARE(a2_s_o1->currentLoopTime(), 250); QCOMPARE(a2_s_o1->currentLoop(), 1); // this animation is at the end because it was run on the previous loop QCOMPARE(a3_s_o1->currentLoop(), 0); - QCOMPARE(a3_s_o1->currentTime(), 250); + QCOMPARE(a3_s_o1->currentLoopTime(), 250); QCOMPARE(group.state(), QAnimationGroup::Paused); QCOMPARE(sequence->state(), QAnimationGroup::Paused); @@ -934,7 +934,7 @@ void tst_QSequentialAnimationGroup::startDelay() QTest::qWait(500); - QVERIFY(group.currentTime() == 375); + QVERIFY(group.currentLoopTime() == 375); QCOMPARE(group.state(), QAnimationGroup::Stopped); } @@ -958,9 +958,9 @@ void tst_QSequentialAnimationGroup::clearGroup() children[i] = group.animationAt(i); } - group.clearAnimations(); + group.clear(); QCOMPARE(group.animationCount(), 0); - QCOMPARE(group.currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 0); for (int i = 0; i < animationCount; ++i) QVERIFY(children[i].isNull()); } @@ -1130,9 +1130,9 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup() QCOMPARE(groupStateChangedSpy.count(), 1); QCOMPARE(childStateChangedSpy.count(), 1); - QCOMPARE(qVariantValue(groupStateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(groupStateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(childStateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(childStateChangedSpy.at(0).first()), QAnimationGroup::Running); // starting directly a running child will not have any effect @@ -1171,13 +1171,13 @@ void tst_QSequentialAnimationGroup::deleteChildrenWithRunningGroup() QCOMPARE(anim1->state(), QAnimationGroup::Running); QTest::qWait(100); - QVERIFY(group.currentTime() > 0); + QVERIFY(group.currentLoopTime() > 0); delete anim1; QCOMPARE(group.animationCount(), 0); QCOMPARE(group.duration(), 0); QCOMPARE(group.state(), QAnimationGroup::Stopped); - QCOMPARE(group.currentTime(), 0); //that's the invariant + QCOMPARE(group.currentLoopTime(), 0); //that's the invariant } void tst_QSequentialAnimationGroup::startChildrenWithStoppedGroup() @@ -1320,9 +1320,9 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild() QCOMPARE(anim2->state(), QAnimationGroup::Running); QCOMPARE(stateChangedSpy2.count(), 4); - QCOMPARE(qVariantValue(stateChangedSpy2.at(2).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy2.at(2).first()), QAnimationGroup::Stopped); - QCOMPARE(qVariantValue(stateChangedSpy2.at(3).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy2.at(3).first()), QAnimationGroup::Running); group.stop(); @@ -1359,9 +1359,9 @@ void tst_QSequentialAnimationGroup::zeroDurationAnimation() group.start(); QCOMPARE(stateChangedSpy.count(), 2); - QCOMPARE(qVariantValue(stateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(stateChangedSpy.at(1).at(1)), + QCOMPARE(qVariantValue(stateChangedSpy.at(1).first()), QAnimationGroup::Stopped); QCOMPARE(anim1->state(), QAnimationGroup::Stopped); @@ -1426,14 +1426,14 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation() group.start(); QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(notTimeDriven.state(), QAnimationGroup::Running); - QCOMPARE(group.currentTime(), 0); - QCOMPARE(notTimeDriven.currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 0); + QCOMPARE(notTimeDriven.currentLoopTime(), 0); QTest::qWait(300); //wait for the end of notTimeDriven QCOMPARE(notTimeDriven.state(), QAnimationGroup::Stopped); - const int actualDuration = notTimeDriven.currentTime(); + const int actualDuration = notTimeDriven.currentLoopTime(); QCOMPARE(group.state(), QAnimationGroup::Stopped); - QCOMPARE(group.currentTime(), actualDuration); + QCOMPARE(group.currentLoopTime(), actualDuration); QCOMPARE(spy.count(), 1); //2nd case: @@ -1444,7 +1444,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation() group.setCurrentTime(300); QCOMPARE(group.state(), QAnimationGroup::Stopped); - QCOMPARE(notTimeDriven.currentTime(), actualDuration); + QCOMPARE(notTimeDriven.currentLoopTime(), actualDuration); QCOMPARE(group.currentAnimation(), static_cast(&anim)); //3rd case: @@ -1453,8 +1453,8 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation() group.start(); QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(notTimeDriven.state(), QAnimationGroup::Running); - QCOMPARE(group.currentTime(), 0); - QCOMPARE(notTimeDriven.currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 0); + QCOMPARE(notTimeDriven.currentLoopTime(), 0); QCOMPARE(animStateChangedSpy.count(), 0); @@ -1467,12 +1467,12 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation() QTest::qWait(300); //wait for the end of anim QCOMPARE(anim.state(), QAnimationGroup::Stopped); - QCOMPARE(anim.currentTime(), anim.duration()); + QCOMPARE(anim.currentLoopTime(), anim.duration()); //we should simply be at the end QCOMPARE(spy.count(), 1); QCOMPARE(animStateChangedSpy.count(), 2); - QCOMPARE(group.currentTime(), notTimeDriven.currentTime() + anim.currentTime()); + QCOMPARE(group.currentLoopTime(), notTimeDriven.currentLoopTime() + anim.currentLoopTime()); } void tst_QSequentialAnimationGroup::addRemoveAnimation() @@ -1481,48 +1481,48 @@ void tst_QSequentialAnimationGroup::addRemoveAnimation() QSequentialAnimationGroup group; QCOMPARE(group.duration(), 0); - QCOMPARE(group.currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 0); QAbstractAnimation *anim1 = new QPropertyAnimation; group.addAnimation(anim1); QCOMPARE(group.duration(), 250); - QCOMPARE(group.currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 0); QCOMPARE(group.currentAnimation(), anim1); //let's append an animation QAbstractAnimation *anim2 = new QPropertyAnimation; group.addAnimation(anim2); QCOMPARE(group.duration(), 500); - QCOMPARE(group.currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 0); QCOMPARE(group.currentAnimation(), anim1); //let's prepend an animation QAbstractAnimation *anim0 = new QPropertyAnimation; - group.insertAnimationAt(0, anim0); + group.insertAnimation(0, anim0); QCOMPARE(group.duration(), 750); - QCOMPARE(group.currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 0); QCOMPARE(group.currentAnimation(), anim0); //anim0 has become the new currentAnimation group.setCurrentTime(300); //anim0 | anim1 | anim2 - QCOMPARE(group.currentTime(), 300); + QCOMPARE(group.currentLoopTime(), 300); QCOMPARE(group.currentAnimation(), anim1); - QCOMPARE(anim1->currentTime(), 50); + QCOMPARE(anim1->currentLoopTime(), 50); group.removeAnimation(anim0); //anim1 | anim2 - QCOMPARE(group.currentTime(), 50); + QCOMPARE(group.currentLoopTime(), 50); QCOMPARE(group.currentAnimation(), anim1); - QCOMPARE(anim1->currentTime(), 50); + QCOMPARE(anim1->currentLoopTime(), 50); group.setCurrentTime(0); - group.insertAnimationAt(0, anim0); //anim0 | anim1 | anim2 + group.insertAnimation(0, anim0); //anim0 | anim1 | anim2 group.setCurrentTime(300); - QCOMPARE(group.currentTime(), 300); + QCOMPARE(group.currentLoopTime(), 300); QCOMPARE(group.currentAnimation(), anim1); - QCOMPARE(anim1->currentTime(), 50); + QCOMPARE(anim1->currentLoopTime(), 50); group.removeAnimation(anim1); //anim0 | anim2 - QCOMPARE(group.currentTime(), 250); + QCOMPARE(group.currentLoopTime(), 250); QCOMPARE(group.currentAnimation(), anim2); - QCOMPARE(anim0->currentTime(), 250); + QCOMPARE(anim0->currentLoopTime(), 250); } void tst_QSequentialAnimationGroup::currentAnimation() @@ -1595,15 +1595,15 @@ class SequentialAnimationGroup : public QSequentialAnimationGroup { Q_OBJECT public slots: - void clearAnimations() + void clear() { - QSequentialAnimationGroup::clearAnimations(); + QSequentialAnimationGroup::clear(); } void refill() { stop(); - clearAnimations(); + clear(); new DummyPropertyAnimation(this); start(); } @@ -1611,11 +1611,11 @@ public slots: }; -void tst_QSequentialAnimationGroup::clearAnimations() +void tst_QSequentialAnimationGroup::clear() { SequentialAnimationGroup group; QPointer anim1 = new DummyPropertyAnimation(&group); - group.connect(anim1, SIGNAL(finished()), SLOT(clearAnimations())); + group.connect(anim1, SIGNAL(finished()), SLOT(clear())); new DummyPropertyAnimation(&group); QCOMPARE(group.animationCount(), 2); @@ -1623,7 +1623,7 @@ void tst_QSequentialAnimationGroup::clearAnimations() QTest::qWait(anim1->duration() + 100); QCOMPARE(group.animationCount(), 0); QCOMPARE(group.state(), QAbstractAnimation::Stopped); - QCOMPARE(group.currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 0); anim1 = new DummyPropertyAnimation(&group); group.connect(anim1, SIGNAL(finished()), SLOT(refill())); @@ -1649,22 +1649,22 @@ void tst_QSequentialAnimationGroup::pauseResume() QCOMPARE(anim->state(), QAnimationGroup::Running); QCOMPARE(spy.count(), 1); spy.clear(); - const int currentTime = group.currentTime(); - QCOMPARE(anim->currentTime(), currentTime); + const int currentTime = group.currentLoopTime(); + QCOMPARE(anim->currentLoopTime(), currentTime); group.pause(); QCOMPARE(group.state(), QAnimationGroup::Paused); - QCOMPARE(group.currentTime(), currentTime); + QCOMPARE(group.currentLoopTime(), currentTime); QCOMPARE(anim->state(), QAnimationGroup::Paused); - QCOMPARE(anim->currentTime(), currentTime); + QCOMPARE(anim->currentLoopTime(), currentTime); QCOMPARE(spy.count(), 1); spy.clear(); group.resume(); QCOMPARE(group.state(), QAnimationGroup::Running); - QCOMPARE(group.currentTime(), currentTime); + QCOMPARE(group.currentLoopTime(), currentTime); QCOMPARE(anim->state(), QAnimationGroup::Running); - QCOMPARE(anim->currentTime(), currentTime); + QCOMPARE(anim->currentLoopTime(), currentTime); QCOMPARE(spy.count(), 1); } diff --git a/tests/benchmarks/qanimation/rectanimation.cpp b/tests/benchmarks/qanimation/rectanimation.cpp index ab381f4..88eec4d 100644 --- a/tests/benchmarks/qanimation/rectanimation.cpp +++ b/tests/benchmarks/qanimation/rectanimation.cpp @@ -92,8 +92,3 @@ void RectAnimation::updateCurrentTime(int currentTime) if (m_object) m_object->setRect(m_current); } - -void RectAnimation::updateState(QAbstractAnimation::State state) -{ - Q_UNUSED(state); -} diff --git a/tests/benchmarks/qanimation/rectanimation.h b/tests/benchmarks/qanimation/rectanimation.h index ea1f804..38a6f48 100644 --- a/tests/benchmarks/qanimation/rectanimation.h +++ b/tests/benchmarks/qanimation/rectanimation.h @@ -59,7 +59,6 @@ public: int duration() const; virtual void updateCurrentTime(int currentTime); - virtual void updateState(QAbstractAnimation::State state); private: DummyObject *m_object; -- cgit v0.12 From 90b26c211bca82e252dcd31ffa1ef6834bbb6060 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 4 Nov 2009 14:10:47 +0100 Subject: Make QStringBuilder respect codecForCStrings Now, it's a real drop-in replacement, with no known feature regressions :) Reviewed-By: hjk --- src/corelib/tools/qstring.h | 1 + src/corelib/tools/qstringbuilder.cpp | 24 ++++++++++++ src/corelib/tools/qstringbuilder.h | 58 ++++++++++++++++++---------- tests/auto/qstringbuilder1/stringbuilder.cpp | 26 +++++++++++++ 4 files changed, 88 insertions(+), 21 deletions(-) diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 6c9a3ca..be95211 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -631,6 +631,7 @@ private: friend class QCharRef; friend class QTextCodec; friend class QStringRef; + friend class QAbstractConcatenable; friend inline bool qStringComparisonHelper(const QString &s1, const char *s2); friend inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2); public: diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index 0a13218..4a16488 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -41,6 +41,8 @@ #include "qstringbuilder.h" +QT_BEGIN_NAMESPACE + /*! \class QLatin1Literal \internal @@ -143,3 +145,25 @@ Converts the \c QLatin1Literal into a \c QString object. */ + +/*! \internal */ +void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out) +{ +#ifndef QT_NO_TEXTCODEC + if (QString::codecForCStrings) { + QString tmp = QString::fromAscii(a); + memcpy(out, reinterpret_cast(tmp.constData()), sizeof(QChar) * tmp.size()); + out += tmp.length(); + return; + } +#endif + if (len == -1) { + while (*a) + *out++ = QLatin1Char(*a++); + } else { + for (int i = 0; i < len - 1; ++i) + *out++ = QLatin1Char(a[i]); + } +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index efa39b5..798d097 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -66,7 +66,7 @@ public: const char *data() const { return m_data; } template - QLatin1Literal(const char (&str)[N]) + QLatin1Literal(const char (&str)[N]) : m_size(N - 1), m_data(str) {} private: @@ -74,6 +74,21 @@ private: const char *m_data; }; +struct Q_CORE_EXPORT QAbstractConcatenable +{ +protected: + static void convertFromAscii(const char *a, int len, QChar *&out); + + static inline void convertFromAscii(char a, QChar *&out) + { +#ifndef QT_NO_TEXTCODEC + if (QString::codecForCStrings) + *out++ = QChar::fromAscii(a); + else +#endif + *out++ = QLatin1Char(a); + } +}; template struct QConcatenable {}; @@ -87,9 +102,12 @@ public: { QString s(QConcatenable< QStringBuilder >::size(*this), Qt::Uninitialized); - + QChar *d = s.data(); QConcatenable< QStringBuilder >::appendTo(*this, d); + // this resize is necessary since we allocate a bit too much + // when dealing with variable sized 8-bit encodings + s.resize(d - s.data()); return s; } QByteArray toLatin1() const { return QString(*this).toLatin1(); } @@ -99,13 +117,13 @@ public: }; -template <> struct QConcatenable +template <> struct QConcatenable : private QAbstractConcatenable { typedef char type; static int size(const char) { return 1; } static inline void appendTo(const char c, QChar *&out) { - *out++ = QLatin1Char(c); + QAbstractConcatenable::convertFromAscii(c, out); } }; @@ -170,7 +188,7 @@ template <> struct QConcatenable { const int n = a.size(); memcpy(out, reinterpret_cast(a.constData()), sizeof(QChar) * n); - out += n; + out += n; } }; @@ -182,53 +200,51 @@ template <> struct QConcatenable { const int n = a.size(); memcpy(out, reinterpret_cast(a.constData()), sizeof(QChar) * n); - out += n; + out += n; } }; #ifndef QT_NO_CAST_FROM_ASCII -template struct QConcatenable +template struct QConcatenable : private QAbstractConcatenable { typedef char type[N]; - static int size(const char[N]) { return N - 1; } + static int size(const char[N]) + { + return N - 1; + } static inline void appendTo(const char a[N], QChar *&out) { - for (int i = 0; i < N - 1; ++i) - *out++ = QLatin1Char(a[i]); + QAbstractConcatenable::convertFromAscii(a, N, out); } }; -template struct QConcatenable +template struct QConcatenable : private QAbstractConcatenable { typedef const char type[N]; static int size(const char[N]) { return N - 1; } static inline void appendTo(const char a[N], QChar *&out) { - for (int i = 0; i < N - 1; ++i) - *out++ = QLatin1Char(a[i]); + QAbstractConcatenable::convertFromAscii(a, N, out); } }; -template <> struct QConcatenable +template <> struct QConcatenable : private QAbstractConcatenable { typedef char const *type; static int size(const char *a) { return qstrlen(a); } static inline void appendTo(const char *a, QChar *&out) { - while (*a) - *out++ = QLatin1Char(*a++); + QAbstractConcatenable::convertFromAscii(a, -1, out); } }; -template <> struct QConcatenable +template <> struct QConcatenable : private QAbstractConcatenable { typedef QByteArray type; static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); } static inline void appendTo(const QByteArray &ba, QChar *&out) { - const char *data = ba.constData(); - while (*data) - *out++ = QLatin1Char(*data++); + QAbstractConcatenable::convertFromAscii(ba.constData(), -1, out); } }; #endif @@ -237,7 +253,7 @@ template struct QConcatenable< QStringBuilder > { typedef QStringBuilder type; - static int size(const type &p) + static int size(const type &p) { return QConcatenable::size(p.a) + QConcatenable::size(p.b); } diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp index f35d4d2..9dc467e 100644 --- a/tests/auto/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/qstringbuilder1/stringbuilder.cpp @@ -41,8 +41,15 @@ #define LITERAL "some literal" +// "some literal", but replacing all vocals by their umlauted UTF-8 string :) +#define UTF8_LITERAL "s\xc3\xb6m\xc3\xab l\xc3\xaft\xc3\xabr\xc3\xa4l" + void runScenario() { + // set codec for C strings to 0, enforcing Latin1 + QTextCodec::setCodecForCStrings(0); + QVERIFY(!QTextCodec::codecForCStrings()); + QLatin1Literal l1literal(LITERAL); QLatin1String l1string(LITERAL); QString string(l1string); @@ -75,5 +82,24 @@ void runScenario() QCOMPARE(r, r2); r = string P ba; QCOMPARE(r, r2); + + // now test with codec for C strings set + QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + QVERIFY(QTextCodec::codecForCStrings()); + QCOMPARE(QTextCodec::codecForCStrings()->name(), QByteArray("UTF-8")); + + string = QString::fromUtf8(UTF8_LITERAL); + r2 = QString::fromUtf8(UTF8_LITERAL UTF8_LITERAL); + ba = UTF8_LITERAL; + + r = string P UTF8_LITERAL; + QCOMPARE(r.size(), r2.size()); + QCOMPARE(r, r2); + r = UTF8_LITERAL P string; + QCOMPARE(r, r2); + r = ba P string; + QCOMPARE(r, r2); + r = string P ba; + QCOMPARE(r, r2); #endif } -- cgit v0.12 From de2e9b75c3e71906322ffae1eaa4219a662266c2 Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 4 Nov 2009 16:44:14 +0100 Subject: Fix Assistant to never access the network. Task-number: QT-1684 Reviewed-by: ck --- tools/assistant/tools/assistant/helpviewer.cpp | 32 ++++++++++++-------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index 53f3822..c888a5f 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -137,24 +137,22 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData) { const QString& scheme = request.url().scheme(); - if (scheme == QLatin1String("qthelp") || scheme == QLatin1String("about")) { - const QUrl& url = request.url(); - QString mimeType = url.toString(); - if (mimeType.endsWith(QLatin1String(".svg")) - || mimeType.endsWith(QLatin1String(".svgz"))) { - mimeType = QLatin1String("image/svg+xml"); - } - else if (mimeType.endsWith(QLatin1String(".css"))) { - mimeType = QLatin1String("text/css"); - } - else if (mimeType.endsWith(QLatin1String(".js"))) { - mimeType = QLatin1String("text/javascript"); - } else { - mimeType = QLatin1String("text/html"); - } - return new HelpNetworkReply(request, helpEngine->fileData(url), mimeType); + const QUrl& url = request.url(); + QString mimeType = url.toString(); + if (mimeType.endsWith(QLatin1String(".svg")) + || mimeType.endsWith(QLatin1String(".svgz"))) { + mimeType = QLatin1String("image/svg+xml"); } - return QNetworkAccessManager::createRequest(op, request, outgoingData); + else if (mimeType.endsWith(QLatin1String(".css"))) { + mimeType = QLatin1String("text/css"); + } + else if (mimeType.endsWith(QLatin1String(".js"))) { + mimeType = QLatin1String("text/javascript"); + } else { + mimeType = QLatin1String("text/html"); + } + + return new HelpNetworkReply(request, helpEngine->fileData(url), mimeType); } class HelpPage : public QWebPage -- cgit v0.12 From 5f9187991c25c3bbe812b788251678f0ab1116a3 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 4 Nov 2009 16:09:27 +0100 Subject: Wrong styling of checkable menu items. When using style sheets, the fallback for the menu item is QWindowsStyle. However, QWindowsStyle doesn't draw anything when the item is not checked. We now mimick what QWindowsStyle would draw in QStyleSheetStyle::drawControl(). The "static const int windows*" variables in qwindowsstyle.cpp have been moved into QWindowsStylePrivate to make them accessible to QStyleSheetStyle. Reviewed-by: Olivier Task-number: QTBUG-2218 Task-number: QTBUG-2217 Task-number: QTBUG-3479 --- src/gui/styles/qstylesheetstyle.cpp | 21 +++++++++++++++++++++ src/gui/styles/qwindowsstyle.cpp | 37 ++++++++++++++++--------------------- src/gui/styles/qwindowsstyle_p.h | 10 ++++++++++ 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index e61658b..ce73fd8 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3606,6 +3606,27 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q } } else if (hasStyleRule(w, PseudoElement_MenuCheckMark) || hasStyleRule(w, PseudoElement_MenuRightArrow)) { QWindowsStyle::drawControl(ce, &mi, p, w); + if (mi.checkType != QStyleOptionMenuItem::NotCheckable && !mi.checked) { + // We have a style defined, but QWindowsStyle won't draw anything if not checked. + // So we mimick what QWindowsStyle would do. + int checkcol = qMax(mi.maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth); + QRect vCheckRect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x(), mi.rect.y(), checkcol, mi.rect.height())); + if (mi.state.testFlag(State_Enabled) && mi.state.testFlag(State_Selected)) { + qDrawShadePanel(p, vCheckRect, mi.palette, true, 1, &mi.palette.brush(QPalette::Button)); + } else { + QBrush fill(mi.palette.light().color(), Qt::Dense4Pattern); + qDrawShadePanel(p, vCheckRect, mi.palette, true, 1, &fill); + } + QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark); + if (subSubRule.hasDrawable()) { + QStyleOptionMenuItem newMi(mi); + newMi.rect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x() + QWindowsStylePrivate::windowsItemFrame, + mi.rect.y() + QWindowsStylePrivate::windowsItemFrame, + checkcol - 2 * QWindowsStylePrivate::windowsItemFrame, + mi.rect.height() - 2 * QWindowsStylePrivate::windowsItemFrame)); + drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, w); + } + } } else { if (rule.hasDrawable() && !subRule.hasDrawable() && !(opt->state & QStyle::State_Selected)) { mi.palette.setColor(QPalette::Window, Qt::transparent); diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index abce4d2..f894b82 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -115,14 +115,6 @@ QT_BEGIN_INCLUDE_NAMESPACE #include QT_END_INCLUDE_NAMESPACE -static const int windowsItemFrame = 2; // menu item frame width -static const int windowsSepHeight = 9; // separator item height -static const int windowsItemHMargin = 3; // menu item hor text margin -static const int windowsItemVMargin = 2; // menu item ver text margin -static const int windowsArrowHMargin = 6; // arrow horizontal margin -static const int windowsRightBorder = 15; // right border on windows -static const int windowsCheckMarkWidth = 12; // checkmarks width on windows - enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight }; /* @@ -1847,7 +1839,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai bool act = menuitem->state & State_Selected; // windows always has a check column, regardless whether we have an icon or not - int checkcol = qMax(menuitem->maxIconWidth, windowsCheckMarkWidth); + int checkcol = qMax(menuitem->maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth); QBrush fill = menuitem->palette.brush(act ? QPalette::Highlight : QPalette::Button); p->fillRect(menuitem->rect.adjusted(0, 0, -1, 0), fill); @@ -1903,8 +1895,10 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai newMi.state |= State_Enabled; if (act) newMi.state |= State_On; - newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + windowsItemFrame, menuitem->rect.y() + windowsItemFrame, - checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame)); + newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + QWindowsStylePrivate::windowsItemFrame, + menuitem->rect.y() + QWindowsStylePrivate::windowsItemFrame, + checkcol - 2 * QWindowsStylePrivate::windowsItemFrame, + menuitem->rect.height() - 2 * QWindowsStylePrivate::windowsItemFrame)); proxy()->drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget); } p->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color()); @@ -1915,9 +1909,10 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->setPen(discol); } - int xm = windowsItemFrame + checkcol + windowsItemHMargin; + int xm = QWindowsStylePrivate::windowsItemFrame + checkcol + QWindowsStylePrivate::windowsItemHMargin; int xpos = menuitem->rect.x() + xm; - QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin); + QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin, + w - xm - QWindowsStylePrivate::windowsRightBorder - tab + 1, h - 2 * QWindowsStylePrivate::windowsItemVMargin); QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect); QString s = menuitem->text; if (!s.isEmpty()) { // draw text @@ -1951,10 +1946,10 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->restore(); } if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow - int dim = (h - 2 * windowsItemFrame) / 2; + int dim = (h - 2 * QWindowsStylePrivate::windowsItemFrame) / 2; PrimitiveElement arrow; arrow = (opt->direction == Qt::RightToLeft) ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight; - xpos = x + w - windowsArrowHMargin - windowsItemFrame - dim; + xpos = x + w - QWindowsStylePrivate::windowsArrowHMargin - QWindowsStylePrivate::windowsItemFrame - dim; QRect vSubMenuRect = visualRect(opt->direction, menuitem->rect, QRect(xpos, y + h / 2 - dim / 2, dim, dim)); QStyleOptionMenuItem newMI = *menuitem; newMI.rect = vSubMenuRect; @@ -3193,7 +3188,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); if (mi->menuItemType == QStyleOptionMenuItem::Separator) { - sz = QSize(10, windowsSepHeight); + sz = QSize(10, QWindowsStylePrivate::windowsSepHeight); } else if (mi->icon.isNull()) { sz.setHeight(sz.height() - 2); @@ -3204,14 +3199,14 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); sz.setHeight(qMax(sz.height(), mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() - + 2 * windowsItemFrame)); + + 2 * QWindowsStylePrivate::windowsItemFrame)); } int maxpmw = mi->maxIconWidth; int tabSpacing = 20; if (mi->text.contains(QLatin1Char('\t'))) w += tabSpacing; else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu) - w += 2 * windowsArrowHMargin; + w += 2 * QWindowsStylePrivate::windowsArrowHMargin; else if (mi->menuItemType == QStyleOptionMenuItem::DefaultItem) { // adjust the font and add the difference in size. // it would be better if the font could be adjusted in the initStyleOption qmenu func!! @@ -3222,9 +3217,9 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, w += fmBold.width(mi->text) - fm.width(mi->text); } - int checkcol = qMax(maxpmw, windowsCheckMarkWidth); // Windows always shows a check column + int checkcol = qMax(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column w += checkcol; - w += windowsRightBorder + 10; + w += QWindowsStylePrivate::windowsRightBorder + 10; sz.setWidth(w); } break; @@ -3232,7 +3227,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, #ifndef QT_NO_MENUBAR case CT_MenuBarItem: if (!sz.isEmpty()) - sz += QSize(windowsItemHMargin * 4, windowsItemVMargin * 2); + sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2); break; #endif // Otherwise, fall through diff --git a/src/gui/styles/qwindowsstyle_p.h b/src/gui/styles/qwindowsstyle_p.h index fb84dce..d81c82b 100644 --- a/src/gui/styles/qwindowsstyle_p.h +++ b/src/gui/styles/qwindowsstyle_p.h @@ -87,7 +87,17 @@ public: QColor activeGradientCaptionColor; QColor inactiveCaptionColor; QColor inactiveGradientCaptionColor; + + enum { + windowsItemFrame = 2, // menu item frame width + windowsSepHeight = 9, // separator item height + windowsItemHMargin = 3, // menu item hor text margin + windowsItemVMargin = 2, // menu item ver text margin + windowsArrowHMargin = 6, // arrow horizontal margin + windowsRightBorder = 15, // right border on windows + windowsCheckMarkWidth = 12 // checkmarks width on windows }; +}; QT_END_NAMESPACE -- cgit v0.12 From f97c1d1b60a31b1738a8c19a1dd69255b794615f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 4 Nov 2009 16:05:46 +0100 Subject: Add QT_NO_GRAPHICSEFFECT It depends on QT_NO_GRAPHICSVIEW for now, but it is possible to remove this dependency. Reviewed-by: paul --- src/corelib/global/qfeatures.h | 5 +++++ src/corelib/global/qfeatures.txt | 7 +++++++ src/gui/effects/qgraphicseffect.cpp | 2 ++ src/gui/effects/qgraphicseffect.h | 2 ++ src/gui/effects/qgraphicseffect_p.h | 2 ++ src/gui/image/qpixmapfilter.cpp | 3 +++ src/gui/image/qpixmapfilter_p.h | 2 ++ src/gui/kernel/qwidget.cpp | 19 ++++++++++++++++++- src/gui/kernel/qwidget.h | 2 ++ src/gui/kernel/qwidget_p.h | 6 ++++++ src/gui/painting/qbackingstore.cpp | 8 ++++++++ src/gui/painting/qbackingstore_p.h | 2 ++ 12 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 9b3e817..77785e8 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -632,6 +632,11 @@ #define QT_NO_COLORDIALOG #endif +// QGraphicsEffect +#if !defined(QT_NO_GRAPHICSEFFECT) && (defined(QT_NO_GRAPHICSVIEW)) +#define QT_NO_GRAPHICSEFFECT +#endif + // The Model/View Framework #if !defined(QT_NO_ITEMVIEWS) && (defined(QT_NO_RUBBERBAND) || defined(QT_NO_SCROLLAREA)) #define QT_NO_ITEMVIEWS diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index ff34006..ec4945f 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -491,6 +491,13 @@ Requires: SCROLLAREA Name: QGraphicsView SeeAlso: ??? +Feature: GRAPHICSEFFECT +Description: Supports the graphicseffect classes. +Section: Widgets +Requires: GRAPHICSVIEW +Name: QGraphicsEffect +SeeAlso: ??? + Feature: SPINWIDGET Description: Supports spinbox control widgets. Section: Widgets diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 83f4f79..d7e838e 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -108,6 +108,7 @@ #include #include +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE /*! @@ -1128,3 +1129,4 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour QT_END_NAMESPACE +#endif //QT_NO_GRAPHICSEFFECT diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index 7335a25..5c73f4b 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -48,6 +48,7 @@ #include #include +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -302,6 +303,7 @@ private: QT_END_NAMESPACE QT_END_HEADER +#endif //QT_NO_GRAPHICSEFFECT #endif // QGRAPHICSEFFECT_H diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 0ff5794..9a46a24 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -60,6 +60,7 @@ #include #include +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE class QGraphicsEffectSourcePrivate : public QObjectPrivate @@ -179,5 +180,6 @@ public: QT_END_NAMESPACE +#endif //QT_NO_GRAPHICSEFFECT #endif // QGRAPHICSEFFECT_P_H diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index e50cc8b..d83ef2c 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -53,6 +53,7 @@ #include "private/qpaintengineex_p.h" #include "private/qpaintengine_raster_p.h" +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE class QPixmapFilterPrivate : public QObjectPrivate @@ -1107,3 +1108,5 @@ void QPixmapDropShadowFilter::draw(QPainter *p, } QT_END_NAMESPACE + +#endif //QT_NO_GRAPHICSEFFECT diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h index 6a96676..2573fc7 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/gui/image/qpixmapfilter_p.h @@ -57,6 +57,7 @@ #include #include +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -191,4 +192,5 @@ QT_END_NAMESPACE QT_END_HEADER +#endif //QT_NO_GRAPHICSEFFECT #endif // QPIXMAPFILTER_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 6a72cfa..386bf71 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -230,7 +230,9 @@ QWidgetPrivate::~QWidgetPrivate() if (extra) deleteExtra(); +#ifndef QT_NO_GRAPHICSEFFECT delete graphicsEffect; +#endif //QT_NO_GRAPHICSEFFECT } QWindowSurface *QWidgetPrivate::createDefaultWindowSurface() @@ -1793,6 +1795,7 @@ QRegion QWidgetPrivate::clipRegion() const return r; } +#ifndef QT_NO_GRAPHICSEFFECT void QWidgetPrivate::invalidateGraphicsEffectsRecursively() { Q_Q(QWidget); @@ -1807,6 +1810,7 @@ void QWidgetPrivate::invalidateGraphicsEffectsRecursively() w = w->parentWidget(); } while (w); } +#endif //QT_NO_GRAPHICSEFFECT void QWidgetPrivate::setDirtyOpaqueRegion() { @@ -1814,7 +1818,9 @@ void QWidgetPrivate::setDirtyOpaqueRegion() dirtyOpaqueChildren = true; +#ifndef QT_NO_GRAPHICSEFFECT invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT if (q->isWindow()) return; @@ -1963,10 +1969,12 @@ void QWidgetPrivate::clipToEffectiveMask(QRegion ®ion) const const QWidget *w = q; QPoint offset; +#ifndef QT_NO_GRAPHICSEFFECT if (graphicsEffect) { w = q->parentWidget(); offset -= data.crect.topLeft(); } +#endif //QT_NO_GRAPHICSEFFECT while (w) { const QWidgetPrivate *wd = w->d_func(); @@ -2001,11 +2009,13 @@ void QWidgetPrivate::updateIsOpaque() // hw: todo: only needed if opacity actually changed setDirtyOpaqueRegion(); +#ifndef QT_NO_GRAPHICSEFFECT if (graphicsEffect) { // ### We should probably add QGraphicsEffect::isOpaque at some point. setOpaque(false); return; } +#endif //QT_NO_GRAPHICSEFFECT Q_Q(QWidget); #ifdef Q_WS_X11 @@ -5013,11 +5023,13 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, \sa setGraphicsEffect() */ +#ifndef QT_NO_GRAPHICSEFFECT QGraphicsEffect *QWidget::graphicsEffect() const { Q_D(const QWidget); return d->graphicsEffect; } +#endif //QT_NO_GRAPHICSEFFECT /*! @@ -5036,6 +5048,7 @@ QGraphicsEffect *QWidget::graphicsEffect() const \sa graphicsEffect() */ +#ifndef QT_NO_GRAPHICSEFFECT void QWidget::setGraphicsEffect(QGraphicsEffect *effect) { Q_D(QWidget); @@ -5065,6 +5078,7 @@ void QWidget::setGraphicsEffect(QGraphicsEffect *effect) d->updateIsOpaque(); update(); } +#endif //QT_NO_GRAPHICSEFFECT bool QWidgetPrivate::isAboutToShow() const { @@ -5211,6 +5225,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP return; Q_Q(QWidget); +#ifndef QT_NO_GRAPHICSEFFECT if (graphicsEffect && graphicsEffect->isEnabled()) { QGraphicsEffectSource *source = graphicsEffect->d_func()->source; QWidgetEffectSourcePrivate *sourced = static_cast @@ -5241,6 +5256,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP return; } } +#endif //QT_NO_GRAFFICSEFFECT const bool asRoot = flags & DrawAsRoot; const bool alsoOnScreen = flags & DrawPaintOnScreen; @@ -5395,7 +5411,6 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis QWidgetPrivate *wd = w->d_func(); const QPoint widgetPos(w->data->crect.topLeft()); const bool hasMask = wd->extra && wd->extra->hasMask && !wd->graphicsEffect; - if (index > 0) { QRegion wr(rgn); if (wd->isOpaque) @@ -5421,6 +5436,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis } } +#ifndef QT_NO_GRAPHICSEFFECT QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const { if (system != Qt::DeviceCoordinates) @@ -5521,6 +5537,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint * m_widget->render(&pixmap, pixmapOffset); return pixmap; } +#endif //QT_NO_GRAPHICSEFFECT #ifndef QT_NO_GRAPHICSVIEW /*! diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 05f0069..b7c55f9 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -351,8 +351,10 @@ public: const QRegion &sourceRegion = QRegion(), RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren)); +#ifndef QT_NO_GRAPHICSEFFECT QGraphicsEffect *graphicsEffect() const; void setGraphicsEffect(QGraphicsEffect *effect); +#endif //QT_NO_GRAPHICSEFFECT void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); void ungrabGesture(Qt::GestureType type); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 8b03a85..151b90a 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -384,7 +384,9 @@ public: void setOpaque(bool opaque); void updateIsTranslucent(); bool paintOnScreen() const; +#ifndef QT_NO_GRAPHICSEFFECT void invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT const QRegion &getOpaqueChildren() const; void setDirtyOpaqueRegion(); @@ -530,8 +532,10 @@ public: inline QRect effectiveRectFor(const QRect &rect) const { +#ifndef QT_NO_GRAPHICSEFFECT if (graphicsEffect && graphicsEffect->isEnabled()) return graphicsEffect->boundingRectFor(rect).toAlignedRect(); +#endif //QT_NO_GRAPHICSEFFECT return rect; } @@ -774,6 +778,7 @@ struct QWidgetPaintContext QPainter *painter; }; +#ifndef QT_NO_GRAPHICSEFFECT class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: @@ -826,6 +831,7 @@ public: QTransform lastEffectTransform; bool updateDueToGraphicsEffect; }; +#endif //QT_NO_GRAPHICSEFFECT inline QWExtra *QWidgetPrivate::extraData() const { diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index f36470a..8226797 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -529,7 +529,9 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up Q_ASSERT(widget->window() == tlw); Q_ASSERT(!rgn.isEmpty()); +#ifndef QT_NO_GRAPHICSEFFECT widget->d_func()->invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { @@ -559,9 +561,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up if (invalidateBuffer) { const bool eventAlreadyPosted = !dirty.isEmpty(); +#ifndef QT_NO_GRAPHICSEFFECT if (widget->d_func()->graphicsEffect) dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset); else +#endif //QT_NO_GRAPHICSEFFECT dirty += rgn.translated(offset); if (!eventAlreadyPosted || updateImmediately) sendUpdateRequest(tlw, updateImmediately); @@ -576,9 +580,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up if (widget->d_func()->inDirtyList) { if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) { +#ifndef QT_NO_GRAPHICSEFFECT if (widget->d_func()->graphicsEffect) widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()); else +#endif //QT_NO_GRAPHICSEFFECT widget->d_func()->dirty += rgn; } } else { @@ -606,7 +612,9 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd Q_ASSERT(widget->window() == tlw); Q_ASSERT(!rect.isEmpty()); +#ifndef QT_NO_GRAPHICSEFFECT widget->d_func()->invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h index 3288dae..fbef980 100644 --- a/src/gui/painting/qbackingstore_p.h +++ b/src/gui/painting/qbackingstore_p.h @@ -146,9 +146,11 @@ private: { if (widget && !widget->d_func()->inDirtyList && !widget->data->in_destructor) { QWidgetPrivate *widgetPrivate = widget->d_func(); +#ifndef QT_NO_GRAPHICSEFFECT if (widgetPrivate->graphicsEffect) widgetPrivate->dirty = widgetPrivate->effectiveRectFor(rgn.boundingRect()); else +#endif //QT_NO_GRAPHICSEFFECT widgetPrivate->dirty = rgn; dirtyWidgets.append(widget); widgetPrivate->inDirtyList = true; -- cgit v0.12 From 7f29368eccc9a06a4b817608887371225b0f2347 Mon Sep 17 00:00:00 2001 From: mae Date: Wed, 4 Nov 2009 17:06:11 +0100 Subject: QPlainTextEdit redraw issue in QTextControl There is an optimization in QTextControl, that it only requests updates for single blocks if only a single block was changed. This update was requested with the block's bounding rectangle. In the case of disabled line wrapping in combination with a very long line, a block change can result in a narrower block bounding rectangle. This then resulted in pixel on the screen not being redrawn properly. The fix enlarges the requested update rectangle horizontally. The bug was discovered during inhouse Qt Creator testing. Reviewed-by: Oswald Buddenhagen --- src/gui/text/qtextcontrol.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 3f6545c..f5579b9 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1296,7 +1296,9 @@ QVariant QTextControl::loadResource(int type, const QUrl &name) void QTextControlPrivate::_q_updateBlock(const QTextBlock &block) { Q_Q(QTextControl); - emit q->updateRequest(q->blockBoundingRect(block)); + QRectF br = q->blockBoundingRect(block); + br.setRight(qreal(INT_MAX)); // the block might have shrunk + emit q->updateRequest(br); } QRectF QTextControlPrivate::rectForPosition(int position) const -- cgit v0.12 From 7a0b728452c099934dbe7860c3614dfdc4373a9c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 3 Nov 2009 17:09:12 +0100 Subject: namespaces can have parents, too --- tools/linguist/lupdate/cpp.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 4d89156..02e87a0 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -135,6 +135,11 @@ struct Namespace { // Nested classes may be forward-declared inside a definition, and defined in another file. // The latter will detach the class' child list, so clones need a backlink to the original // definition (either one in case of multiple definitions). + // Namespaces can have tr() functions as well, so we need to track parent definitions for + // them as well. The complication is that we may have to deal with a forrest instead of + // a tree - in that case the parent will be arbitrary. However, it seem likely that + // Q_DECLARE_TR_FUNCTIONS would be used either in "class-like" namespaces with a central + // header or only locally in a file. Namespace *classDef; QString trQualification; @@ -1635,7 +1640,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) break; NamespaceList nsl; if (fullyQualify(namespaces, fullName, false, &nsl, 0)) - modifyNamespace(&namespaces, false)->aliases[ns] = nsl; + modifyNamespace(&namespaces)->aliases[ns] = nsl; } } else if (yyTok == Tok_LeftBrace) { // Anonymous namespace @@ -1661,7 +1666,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } NamespaceList nsl; if (fullyQualify(namespaces, fullName, false, &nsl, 0)) - modifyNamespace(&namespaces, false)->usings << HashStringList(nsl); + modifyNamespace(&namespaces)->usings << HashStringList(nsl); } else { QList fullName; if (yyTok == Tok_ColonColon) @@ -1678,7 +1683,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) break; NamespaceList nsl; if (fullyQualify(namespaces, fullName, false, &nsl, 0)) - modifyNamespace(&namespaces, true)->aliases[nsl.last()] = nsl; + modifyNamespace(&namespaces)->aliases[nsl.last()] = nsl; } break; case Tok_tr: @@ -1875,7 +1880,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) break; case Tok_Q_DECLARE_TR_FUNCTIONS: if (getMacroArgs()) { - Namespace *ns = modifyNamespace(&namespaces, true); + Namespace *ns = modifyNamespace(&namespaces); ns->hasTrFunctions = true; ns->trQualification = yyWord; ns->trQualification.detach(); @@ -1883,7 +1888,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) yyTok = getToken(); break; case Tok_Q_OBJECT: - modifyNamespace(&namespaces, true)->hasTrFunctions = true; + modifyNamespace(&namespaces)->hasTrFunctions = true; yyTok = getToken(); break; case Tok_Ident: -- cgit v0.12 From df12ef0e1fa327103b09e9a817d83b8c8d3035d7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 3 Nov 2009 17:08:08 +0100 Subject: fix bogus "Class '' lacks Q_OBJECT macro" the optimization not to look for parent definitions if we already knew that there would be none did not consider that we only know that the leaf node is missing, not any intermediate nodes. --- .../lupdate/testdata/good/parsecpp2/main.cpp | 30 +++++++++++++ .../lupdate/testdata/good/parsecpp2/main.h | 51 ++++++++++++++++++++++ .../testdata/good/parsecpp2/project.ts.result | 16 +++++++ tools/linguist/lupdate/cpp.cpp | 6 +-- 4 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp index eaa271a..d720b8f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp @@ -63,3 +63,33 @@ line c++ comment } (with brace) #define This is another // comment in } define \ something } comment } // complain here + + + +// Nested class in same file +class TopLevel { + Q_OBJECT + + class Nested; +}; + +class TopLevel::Nested { + void foo(); +}; + +TopLevel::Nested::foo() +{ + TopLevel::tr("TopLevel"); +} + +// Nested class in other file +#include "main.h" + +class TopLevel2::Nested { + void foo(); +}; + +TopLevel2::Nested::foo() +{ + TopLevel2::tr("TopLevel2"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h new file mode 100644 index 0000000..54a76ab --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h @@ -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 QtCore 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$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +class TopLevel2 { + Q_OBJECT + + class Nested; +}; + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result index 07a7469..ef5adb2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result @@ -1,4 +1,20 @@ + + TopLevel + + + TopLevel + + + + + TopLevel2 + + + TopLevel2 + + + diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 02e87a0..5ef7099 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -271,7 +271,7 @@ private: const Namespace *findNamespace(const NamespaceList &namespaces, int nsCount = -1) const; void enterNamespace(NamespaceList *namespaces, const HashString &name); void truncateNamespaces(NamespaceList *namespaces, int lenght); - Namespace *modifyNamespace(NamespaceList *namespaces, bool tryOrigin = true); + Namespace *modifyNamespace(NamespaceList *namespaces, bool haveLast = true); enum { Tok_Eof, Tok_class, Tok_friend, Tok_namespace, Tok_using, Tok_return, @@ -963,7 +963,7 @@ void CppParser::loadState(const SavedState *state) pendingContext = state->pendingContext; } -Namespace *CppParser::modifyNamespace(NamespaceList *namespaces, bool tryOrigin) +Namespace *CppParser::modifyNamespace(NamespaceList *namespaces, bool haveLast) { Namespace *pns, *ns = &results->rootNamespace; for (int i = 1; i < namespaces->count(); ++i) { @@ -971,7 +971,7 @@ Namespace *CppParser::modifyNamespace(NamespaceList *namespaces, bool tryOrigin) if (!(ns = pns->children.value(namespaces->at(i)))) { do { ns = new Namespace; - if (tryOrigin) + if (haveLast || i < namespaces->count() - 1) if (const Namespace *ons = findNamespace(*namespaces, i + 1)) ns->classDef = ons->classDef; pns->children.insert(namespaces->at(i), ns); -- cgit v0.12 From 21f0f9157802f011bb02b96fd79057084039ae2b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 4 Nov 2009 10:48:20 +0100 Subject: introduce delayed resolution of aliases this has two effects: - using-declarations which use forward-declared classes work without collecting the forward declarations, as the resolution happens at a place where the class definition must have been encountered already - it should be a bit faster --- .../lupdate/testdata/good/parsecpp2/main.cpp | 19 ++++++++ .../testdata/good/parsecpp2/project.ts.result | 8 +++ tools/linguist/lupdate/cpp.cpp | 57 ++++++++++++++++------ 3 files changed, 68 insertions(+), 16 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp index d720b8f..7ddb68f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp @@ -93,3 +93,22 @@ TopLevel2::Nested::foo() { TopLevel2::tr("TopLevel2"); } + + + +namespace NameSpace { +class ToBeUsed; +} + +// using statement before class definition +using NameSpace::ToBeUsed; + +class NameSpace::ToBeUsed { + Q_OBJECT + void caller(); +}; + +void ToBeUsed::caller() +{ + tr("NameSpace::ToBeUsed"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result index ef5adb2..6f48e27 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result @@ -2,6 +2,14 @@ + NameSpace::ToBeUsed + + + NameSpace::ToBeUsed + + + + TopLevel diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 5ef7099..beaf246 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -261,11 +261,14 @@ private: bool qualifyOneCallbackUsing(const Namespace *ns, void *context) const; bool qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, NamespaceList *resolved) const; - bool fullyQualify(const NamespaceList &namespaces, const QList &segments, - bool isDeclaration, + bool fullyQualify(const NamespaceList &namespaces, int nsCnt, + const QList &segments, bool isDeclaration, NamespaceList *resolved, QStringList *unresolved) const; - bool fullyQualify(const NamespaceList &namespaces, const QString &segments, - bool isDeclaration, + bool fullyQualify(const NamespaceList &namespaces, + const QList &segments, bool isDeclaration, + NamespaceList *resolved, QStringList *unresolved) const; + bool fullyQualify(const NamespaceList &namespaces, + const QString &segments, bool isDeclaration, NamespaceList *resolved, QStringList *unresolved) const; bool findNamespaceCallback(const Namespace *ns, void *context) const; const Namespace *findNamespace(const NamespaceList &namespaces, int nsCount = -1) const; @@ -1057,7 +1060,18 @@ bool CppParser::qualifyOneCallbackOwn(const Namespace *ns, void *context) const } QHash::ConstIterator nsai = ns->aliases.constFind(data->segment); if (nsai != ns->aliases.constEnd()) { - *data->resolved = *nsai; + const NamespaceList &nsl = *nsai; + if (nsl.last().value().isEmpty()) { // Delayed alias resolution + NamespaceList &nslIn = *const_cast(&nsl); + nslIn.removeLast(); + NamespaceList nslOut; + if (!fullyQualify(data->namespaces, data->nsCount, nslIn, false, &nslOut, 0)) { + const_cast(ns)->aliases.remove(data->segment); + return false; + } + nslIn = nslOut; + } + *data->resolved = nsl; return true; } return false; @@ -1086,8 +1100,8 @@ bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsCnt, const Has return visitNamespace(namespaces, nsCnt, &CppParser::qualifyOneCallbackUsing, &data); } -bool CppParser::fullyQualify(const NamespaceList &namespaces, const QList &segments, - bool isDeclaration, +bool CppParser::fullyQualify(const NamespaceList &namespaces, int nsCnt, + const QList &segments, bool isDeclaration, NamespaceList *resolved, QStringList *unresolved) const { int nsIdx; @@ -1104,7 +1118,7 @@ bool CppParser::fullyQualify(const NamespaceList &namespaces, const QList &segments, bool isDeclaration, + NamespaceList *resolved, QStringList *unresolved) const +{ + return fullyQualify(namespaces, namespaces.count(), + segments, isDeclaration, resolved, unresolved); +} + +bool CppParser::fullyQualify(const NamespaceList &namespaces, + const QString &quali, bool isDeclaration, NamespaceList *resolved, QStringList *unresolved) const { static QString strColons(QLatin1String("::")); @@ -1638,9 +1660,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } if (fullName.isEmpty()) break; - NamespaceList nsl; - if (fullyQualify(namespaces, fullName, false, &nsl, 0)) - modifyNamespace(&namespaces)->aliases[ns] = nsl; + fullName.append(HashString(QString())); // Mark as unresolved + modifyNamespace(&namespaces)->aliases[ns] = fullName; } } else if (yyTok == Tok_LeftBrace) { // Anonymous namespace @@ -1681,9 +1702,13 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } if (fullName.isEmpty()) break; - NamespaceList nsl; - if (fullyQualify(namespaces, fullName, false, &nsl, 0)) - modifyNamespace(&namespaces)->aliases[nsl.last()] = nsl; + // using-declarations cannot rename classes, so the last element of + // fullName is already the resolved name we actually want. + // As we do no resolution here, we'll collect useless usings of data + // members and methods as well. This is no big deal. + HashString &ns = fullName.last(); + fullName.append(HashString(QString())); // Mark as unresolved + modifyNamespace(&namespaces)->aliases[ns] = fullName; } break; case Tok_tr: -- cgit v0.12 From 2030779f5c222b96489ad458225931b167687307 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 4 Nov 2009 10:48:55 +0100 Subject: don't break on unterminated C comments --- tools/linguist/lupdate/cpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index beaf246..fb95a95 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -788,7 +788,7 @@ uint CppParser::getToken() if (yyCh == EOF) { qWarning("%s:%d: Unterminated C++ comment\n", qPrintable(yyFileName), yyLineNo); - return Tok_Comment; + break; } *ptr++ = yyCh; -- cgit v0.12 From e9803f49668361ce4fd96b82d5e54ad6b5896550 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 4 Nov 2009 11:51:58 +0100 Subject: construct ConversionData earlier to avoid the insane number of function arguments in a few places --- tools/linguist/lrelease/main.cpp | 52 ++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 2867849..db15506 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -100,15 +100,14 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo } static bool releaseTranslator(Translator &tor, const QString &qmFileName, - bool verbose, bool ignoreUnfinished, - bool removeIdentical, bool idBased, TranslatorSaveMode mode) + ConversionData &cd, bool removeIdentical) { - Translator::reportDuplicates(tor.resolveDuplicates(), qmFileName, verbose); + Translator::reportDuplicates(tor.resolveDuplicates(), qmFileName, cd.isVerbose()); - if (verbose) + if (cd.isVerbose()) printOut(QCoreApplication::tr( "Updating '%1'...\n").arg(qmFileName)); if (removeIdentical) { - if ( verbose ) + if (cd.isVerbose()) printOut(QCoreApplication::tr( "Removing translations equal to source text in '%1'...\n").arg(qmFileName)); tor.stripIdenticalSourceTranslations(); } @@ -120,12 +119,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, return false; } - ConversionData cd; tor.normalizeTranslations(cd); - cd.m_verbose = verbose; - cd.m_ignoreUnfinished = ignoreUnfinished; - cd.m_idBased = idBased; - cd.m_saveMode = mode; bool ok = tor.release(&file, cd); file.close(); @@ -139,11 +133,11 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, return true; } -static bool releaseTsFile(const QString& tsFileName, bool verbose, - bool ignoreUnfinished, bool removeIdentical, bool idBased, TranslatorSaveMode mode) +static bool releaseTsFile(const QString& tsFileName, + ConversionData &cd, bool removeIdentical) { Translator tor; - if (!loadTsFile(tor, tsFileName, verbose)) + if (!loadTsFile(tor, tsFileName, cd.isVerbose())) return false; QString qmFileName = tsFileName; @@ -155,7 +149,7 @@ static bool releaseTsFile(const QString& tsFileName, bool verbose, } qmFileName += QLatin1String(".qm"); - return releaseTranslator(tor, qmFileName, verbose, ignoreUnfinished, removeIdentical, idBased, mode); + return releaseTranslator(tor, qmFileName, cd, removeIdentical); } int main(int argc, char **argv) @@ -166,11 +160,8 @@ int main(int argc, char **argv) if (translator.load(QLatin1String("lrelease_") + QLocale::system().name())) app.installTranslator(&translator); - bool verbose = true; // the default is true starting with Qt 4.2 - bool ignoreUnfinished = false; - bool idBased = false; - // the default mode is SaveEverything starting with Qt 4.2 - TranslatorSaveMode mode = SaveEverything; + ConversionData cd; + cd.m_verbose = true; // the default is true starting with Qt 4.2 bool removeIdentical = false; Translator tor; QString outputFile; @@ -178,25 +169,25 @@ int main(int argc, char **argv) for (int i = 1; i < argc; ++i) { if (args[i] == QLatin1String("-compress")) { - mode = SaveStripped; + cd.m_saveMode = SaveStripped; continue; } else if (args[i] == QLatin1String("-idbased")) { - idBased = true; + cd.m_idBased = true; continue; } else if (args[i] == QLatin1String("-nocompress")) { - mode = SaveEverything; + cd.m_saveMode = SaveEverything; continue; } else if (args[i] == QLatin1String("-removeidentical")) { removeIdentical = true; continue; } else if (args[i] == QLatin1String("-nounfinished")) { - ignoreUnfinished = true; + cd.m_ignoreUnfinished = true; continue; } else if (args[i] == QLatin1String("-silent")) { - verbose = false; + cd.m_verbose = false; continue; } else if (args[i] == QLatin1String("-verbose")) { - verbose = true; + cd.m_verbose = true; continue; } else if (args[i] == QLatin1String("-version")) { printOut(QCoreApplication::tr( "lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)) ); @@ -231,7 +222,7 @@ int main(int argc, char **argv) if (args[i].endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) || args[i].endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) { QHash varMap; - bool ok = evaluateProFile(args[i], verbose, &varMap ); + bool ok = evaluateProFile(args[i], cd.isVerbose(), &varMap); if (ok) { QStringList translations = varMap.value("TRANSLATIONS"); if (translations.isEmpty()) { @@ -240,7 +231,7 @@ int main(int argc, char **argv) qPrintable(args[i])); } else { foreach (const QString &trans, translations) - if (!releaseTsFile(trans, verbose, ignoreUnfinished, removeIdentical, idBased, mode)) + if (!releaseTsFile(trans, cd, removeIdentical)) return 1; } } else { @@ -251,18 +242,17 @@ int main(int argc, char **argv) } } else { if (outputFile.isEmpty()) { - if (!releaseTsFile(args[i], verbose, ignoreUnfinished, removeIdentical, idBased, mode)) + if (!releaseTsFile(args[i], cd, removeIdentical)) return 1; } else { - if (!loadTsFile(tor, args[i], verbose)) + if (!loadTsFile(tor, args[i], cd.isVerbose())) return 1; } } } if (!outputFile.isEmpty()) - return releaseTranslator(tor, outputFile, verbose, ignoreUnfinished, - removeIdentical, idBased, mode) ? 0 : 1; + return releaseTranslator(tor, outputFile, cd, removeIdentical) ? 0 : 1; return 0; } -- cgit v0.12 From ca03a94ed93e4baa71adf9dacb3fddf9590040ef Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 4 Nov 2009 13:19:42 +0100 Subject: Fixed input panel detection on post-5.0 S60 SDKs. Task: QT-2418 RevBy: Shane Kearns --- src/gui/inputmethod/qcoefepinputcontext_p.h | 1 + src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 43 +++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 1531036..6aef5d4 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -97,6 +97,7 @@ private: void applyHints(Qt::InputMethodHints hints); void applyFormat(QList *attributes); void queueInputCapabilitiesChanged(); + bool needsInputPanel(); private Q_SLOTS: void ensureInputCapabilitiesChanged(); diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 3f21bc3..25b2313 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -47,6 +47,7 @@ #include #include +#include #include // You only find these enumerations on SDK 5 onwards, so we need to provide our own @@ -153,6 +154,44 @@ QString QCoeFepInputContext::language() } } +bool QCoeFepInputContext::needsInputPanel() +{ + switch (QSysInfo::s60Version()) { + case QSysInfo::SV_S60_3_1: + case QSysInfo::SV_S60_3_2: + // There are no touch phones for pre-5.0 SDKs. + return false; +#ifdef Q_CC_NOKIAX86 + default: + // For emulator we assume that we need an input panel, since we can't + // separate between phone types. + return true; +#else + case QSysInfo::SV_S60_5_0: { + // For SDK == 5.0, we need phone specific detection, since the HAL API + // is no good on most phones. However, all phones at the time of writing use the + // input panel, except N97 in landscape mode, but in this mode it refuses to bring + // up the panel anyway, so we don't have to care. + return true; + } + default: + // For unknown/newer types, we try to use the HAL API. + int keyboardEnabled; + int keyboardType; + int err[2]; + err[0] = HAL::Get(HAL::EKeyboard, keyboardType); + err[1] = HAL::Get(HAL::EKeyboardState, keyboardEnabled); + if (err[0] == KErrNone && err[1] == KErrNone + && keyboardType != 0 && keyboardEnabled) + // Means that we have some sort of keyboard. + return false; + + // Fall back to using the input panel. + return true; +#endif // !Q_CC_NOKIAX86 + } +} + bool QCoeFepInputContext::filterEvent(const QEvent *event) { // The CloseSoftwareInputPanel event is not handled here, because the VK will automatically @@ -174,10 +213,8 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) } } - // For pre-5.0 SDKs, we don't launch the keyboard. - if (QSysInfo::s60Version() != QSysInfo::SV_S60_5_0) { + if (!needsInputPanel()) return false; - } if (event->type() == QEvent::RequestSoftwareInputPanel) { // Notify S60 that we want the virtual keyboard to show up. -- cgit v0.12 From e8e40214a29dbec18db5cf1e65aa8bd3f4d7468f Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 4 Nov 2009 14:39:03 +0100 Subject: Unexported a class that doesn't need to be exported. RevBy: Iain --- src/gui/inputmethod/qcoefepinputcontext_p.h | 8 +- src/s60installs/bwins/QtGuiu.def | 90 ++++++++++----------- src/s60installs/eabi/QtGuiu.def | 118 ++++++++++++++-------------- 3 files changed, 108 insertions(+), 108 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 6aef5d4..452aa75 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -65,10 +65,10 @@ QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QCoeFepInputContext : public QInputContext, - public MCoeFepAwareTextEditor, - public MCoeFepAwareTextEditor_Extension1, - public MObjectProvider +class QCoeFepInputContext : public QInputContext, + public MCoeFepAwareTextEditor, + public MCoeFepAwareTextEditor_Extension1, + public MObjectProvider { Q_OBJECT diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 89b6d48..69a95f0 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -297,7 +297,7 @@ EXPORTS ?standardPixmap@QWindowsStyle@@UBE?AVQPixmap@@W4StandardPixmap@QStyle@@PBVQStyleOption@@PBVQWidget@@@Z @ 296 NONAME ; class QPixmap QWindowsStyle::standardPixmap(enum QStyle::StandardPixmap, class QStyleOption const *, class QWidget const *) const ?setStyleSheet@QApplication@@QAEXABVQString@@@Z @ 297 NONAME ; void QApplication::setStyleSheet(class QString const &) ?minLeftBearing@QFontMetrics@@QBEHXZ @ 298 NONAME ; int QFontMetrics::minLeftBearing(void) const - ?isComposing@QCoeFepInputContext@@UBE_NXZ @ 299 NONAME ; bool QCoeFepInputContext::isComposing(void) const + ?isComposing@QCoeFepInputContext@@UBE_NXZ @ 299 NONAME ABSENT ; bool QCoeFepInputContext::isComposing(void) const ??8iterator@QTextFrame@@QBE_NABV01@@Z @ 300 NONAME ; bool QTextFrame::iterator::operator==(class QTextFrame::iterator const &) const ?toolBarArea@QMainWindow@@QBE?AW4ToolBarArea@Qt@@PAVQToolBar@@@Z @ 301 NONAME ; enum Qt::ToolBarArea QMainWindow::toolBarArea(class QToolBar *) const ?mode@QColormap@@QBE?AW4Mode@1@XZ @ 302 NONAME ; enum QColormap::Mode QColormap::mode(void) const @@ -657,7 +657,7 @@ EXPORTS ?stack@QUndoView@@QBEPAVQUndoStack@@XZ @ 656 NONAME ; class QUndoStack * QUndoView::stack(void) const ?squareToQuad@QTransform@@SA_NABVQPolygonF@@AAV1@@Z @ 657 NONAME ; bool QTransform::squareToQuad(class QPolygonF const &, class QTransform &) ?controlPointRect@QPainterPath@@QBE?AVQRectF@@XZ @ 658 NONAME ; class QRectF QPainterPath::controlPointRect(void) const - ?language@QCoeFepInputContext@@UAE?AVQString@@XZ @ 659 NONAME ; class QString QCoeFepInputContext::language(void) + ?language@QCoeFepInputContext@@UAE?AVQString@@XZ @ 659 NONAME ABSENT ; class QString QCoeFepInputContext::language(void) ?horizontalScrollbarAction@QTableView@@MAEXH@Z @ 660 NONAME ; void QTableView::horizontalScrollbarAction(int) ?qt_metacall@QGraphicsView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 661 NONAME ; int QGraphicsView::qt_metacall(enum QMetaObject::Call, int, void * *) ?itemPrototype@QStandardItemModel@@QBEPBVQStandardItem@@XZ @ 662 NONAME ; class QStandardItem const * QStandardItemModel::itemPrototype(void) const @@ -1646,7 +1646,7 @@ EXPORTS ?anchorClicked@QTextBrowser@@IAEXABVQUrl@@@Z @ 1645 NONAME ; void QTextBrowser::anchorClicked(class QUrl const &) ?childEvent@QMdiSubWindow@@MAEXPAVQChildEvent@@@Z @ 1646 NONAME ; void QMdiSubWindow::childEvent(class QChildEvent *) ?enterEvent@QMenu@@MAEXPAVQEvent@@@Z @ 1647 NONAME ; void QMenu::enterEvent(class QEvent *) - ?ensureInputCapabilitiesChanged@QCoeFepInputContext@@AAEXXZ @ 1648 NONAME ; void QCoeFepInputContext::ensureInputCapabilitiesChanged(void) + ?ensureInputCapabilitiesChanged@QCoeFepInputContext@@AAEXXZ @ 1648 NONAME ABSENT ; void QCoeFepInputContext::ensureInputCapabilitiesChanged(void) ?tr@QSwipeGesture@@SA?AVQString@@PBD0@Z @ 1649 NONAME ; class QString QSwipeGesture::tr(char const *, char const *) ?d_func@QGraphicsPixelizeEffect@@AAEPAVQGraphicsPixelizeEffectPrivate@@XZ @ 1650 NONAME ABSENT ; class QGraphicsPixelizeEffectPrivate * QGraphicsPixelizeEffect::d_func(void) ?completer@QComboBox@@QBEPAVQCompleter@@XZ @ 1651 NONAME ; class QCompleter * QComboBox::completer(void) const @@ -2165,7 +2165,7 @@ EXPORTS ?linkHovered@QLabel@@IAEXABVQString@@@Z @ 2164 NONAME ; void QLabel::linkHovered(class QString const &) ?isCornerButtonEnabled@QTableView@@QBE_NXZ @ 2165 NONAME ; bool QTableView::isCornerButtonEnabled(void) const ?setFilterRegExp@QSortFilterProxyModel@@QAEXABVQRegExp@@@Z @ 2166 NONAME ; void QSortFilterProxyModel::setFilterRegExp(class QRegExp const &) - ?qt_metacall@QCoeFepInputContext@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 2167 NONAME ; int QCoeFepInputContext::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacall@QCoeFepInputContext@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 2167 NONAME ABSENT ; int QCoeFepInputContext::qt_metacall(enum QMetaObject::Call, int, void * *) ?combinedMatrix@QPainter@@QBE?AVQMatrix@@XZ @ 2168 NONAME ; class QMatrix QPainter::combinedMatrix(void) const ?d_func@QTextEdit@@AAEPAVQTextEditPrivate@@XZ @ 2169 NONAME ; class QTextEditPrivate * QTextEdit::d_func(void) ?qDrawBorderPixmap@@YAXPAVQPainter@@ABVQRect@@ABVQMargins@@ABVQPixmap@@12ABUQTileRules@@V?$QFlags@W4DrawingHint@QDrawBorderPixmap@@@@@Z @ 2170 NONAME ; void qDrawBorderPixmap(class QPainter *, class QRect const &, class QMargins const &, class QPixmap const &, class QRect const &, class QMargins const &, struct QTileRules const &, class QFlags) @@ -2306,7 +2306,7 @@ EXPORTS ?setMenuWidget@QMainWindow@@QAEXPAVQWidget@@@Z @ 2305 NONAME ; void QMainWindow::setMenuWidget(class QWidget *) ?setCurrentIndex@QItemSelectionModel@@QAEXABVQModelIndex@@V?$QFlags@W4SelectionFlag@QItemSelectionModel@@@@@Z @ 2306 NONAME ; void QItemSelectionModel::setCurrentIndex(class QModelIndex const &, class QFlags) ?grabShortcut@QWidget@@QAEHABVQKeySequence@@W4ShortcutContext@Qt@@@Z @ 2307 NONAME ; int QWidget::grabShortcut(class QKeySequence const &, enum Qt::ShortcutContext) - ?UpdateFepInlineTextL@QCoeFepInputContext@@UAEXABVTDesC16@@H@Z @ 2308 NONAME ; void QCoeFepInputContext::UpdateFepInlineTextL(class TDesC16 const &, int) + ?UpdateFepInlineTextL@QCoeFepInputContext@@UAEXABVTDesC16@@H@Z @ 2308 NONAME ABSENT ; void QCoeFepInputContext::UpdateFepInlineTextL(class TDesC16 const &, int) ?draw@QPixmapDropShadowFilter@@UBEXPAVQPainter@@ABVQPointF@@ABVQPixmap@@ABVQRectF@@@Z @ 2309 NONAME ; void QPixmapDropShadowFilter::draw(class QPainter *, class QPointF const &, class QPixmap const &, class QRectF const &) const ?mouseMoveEvent@QMdiSubWindow@@MAEXPAVQMouseEvent@@@Z @ 2310 NONAME ; void QMdiSubWindow::mouseMoveEvent(class QMouseEvent *) ?hoverMoveEvent@QGraphicsItem@@MAEXPAVQGraphicsSceneHoverEvent@@@Z @ 2311 NONAME ; void QGraphicsItem::hoverMoveEvent(class QGraphicsSceneHoverEvent *) @@ -2537,7 +2537,7 @@ EXPORTS ?text@QImage@@QBE?AVQString@@ABV2@@Z @ 2536 NONAME ; class QString QImage::text(class QString const &) const ?showMessage@QSplashScreen@@QAEXABVQString@@HABVQColor@@@Z @ 2537 NONAME ; void QSplashScreen::showMessage(class QString const &, int, class QColor const &) ?setActiveSubWindow@QMdiArea@@QAEXPAVQMdiSubWindow@@@Z @ 2538 NONAME ; void QMdiArea::setActiveSubWindow(class QMdiSubWindow *) - ?metaObject@QCoeFepInputContext@@UBEPBUQMetaObject@@XZ @ 2539 NONAME ; struct QMetaObject const * QCoeFepInputContext::metaObject(void) const + ?metaObject@QCoeFepInputContext@@UBEPBUQMetaObject@@XZ @ 2539 NONAME ABSENT ; struct QMetaObject const * QCoeFepInputContext::metaObject(void) const ?showEvent@QGraphicsProxyWidget@@MAEXPAVQShowEvent@@@Z @ 2540 NONAME ; void QGraphicsProxyWidget::showEvent(class QShowEvent *) ?bitmap@QCursor@@QBEPBVQBitmap@@XZ @ 2541 NONAME ; class QBitmap const * QCursor::bitmap(void) const ?trUtf8@QMenuBar@@SA?AVQString@@PBD0H@Z @ 2542 NONAME ; class QString QMenuBar::trUtf8(char const *, char const *, int) @@ -3288,7 +3288,7 @@ EXPORTS ?notation@QDoubleValidator@@QBE?AW4Notation@1@XZ @ 3287 NONAME ; enum QDoubleValidator::Notation QDoubleValidator::notation(void) const ?maximumTime@QDateTimeEdit@@QBE?AVQTime@@XZ @ 3288 NONAME ; class QTime QDateTimeEdit::maximumTime(void) const ?drawControl@QS60Style@@UBEXW4ControlElement@QStyle@@PBVQStyleOption@@PAVQPainter@@PBVQWidget@@@Z @ 3289 NONAME ; void QS60Style::drawControl(enum QStyle::ControlElement, class QStyleOption const *, class QPainter *, class QWidget const *) const - ??_EQCoeFepInputContext@@UAE@I@Z @ 3290 NONAME ; QCoeFepInputContext::~QCoeFepInputContext(unsigned int) + ??_EQCoeFepInputContext@@UAE@I@Z @ 3290 NONAME ABSENT ; QCoeFepInputContext::~QCoeFepInputContext(unsigned int) ?setAttribute@QWidget@@QAEXW4WidgetAttribute@Qt@@_N@Z @ 3291 NONAME ; void QWidget::setAttribute(enum Qt::WidgetAttribute, bool) ??1QImageIOPlugin@@UAE@XZ @ 3292 NONAME ; QImageIOPlugin::~QImageIOPlugin(void) ??1QTessellator@@UAE@XZ @ 3293 NONAME ; QTessellator::~QTessellator(void) @@ -3433,9 +3433,9 @@ EXPORTS ?setVisible@QWidget@@UAEX_N@Z @ 3432 NONAME ; void QWidget::setVisible(bool) ?quitOnLastWindowClosed@QApplicationPrivate@@2_NA @ 3433 NONAME ; bool QApplicationPrivate::quitOnLastWindowClosed ?rowsInserted@QColumnView@@MAEXABVQModelIndex@@HH@Z @ 3434 NONAME ; void QColumnView::rowsInserted(class QModelIndex const &, int, int) - ?qt_metacast@QCoeFepInputContext@@UAEPAXPBD@Z @ 3435 NONAME ; void * QCoeFepInputContext::qt_metacast(char const *) + ?qt_metacast@QCoeFepInputContext@@UAEPAXPBD@Z @ 3435 NONAME ABSENT ; void * QCoeFepInputContext::qt_metacast(char const *) ?map@QMatrix@@QBE?AVQPoint@@ABV2@@Z @ 3436 NONAME ; class QPoint QMatrix::map(class QPoint const &) const - ?MopSupplyObject@QCoeFepInputContext@@UAE?AVPtr@TTypeUid@@V3@@Z @ 3437 NONAME ; class TTypeUid::Ptr QCoeFepInputContext::MopSupplyObject(class TTypeUid) + ?MopSupplyObject@QCoeFepInputContext@@UAE?AVPtr@TTypeUid@@V3@@Z @ 3437 NONAME ABSENT ; class TTypeUid::Ptr QCoeFepInputContext::MopSupplyObject(class TTypeUid) ?styleName@QGuiPlatformPlugin@@UAE?AVQString@@XZ @ 3438 NONAME ; class QString QGuiPlatformPlugin::styleName(void) ?rowsInserted@QAbstractItemView@@MAEXABVQModelIndex@@HH@Z @ 3439 NONAME ; void QAbstractItemView::rowsInserted(class QModelIndex const &, int, int) ?setBlurHint@QGraphicsBloomEffect@@QAEXW4RenderHint@Qt@@@Z @ 3440 NONAME ABSENT ; void QGraphicsBloomEffect::setBlurHint(enum Qt::RenderHint) @@ -3585,7 +3585,7 @@ EXPORTS ?setUniformRowHeights@QTreeView@@QAEX_N@Z @ 3584 NONAME ; void QTreeView::setUniformRowHeights(bool) ??MQImageTextKeyLang@@QBE_NABV0@@Z @ 3585 NONAME ; bool QImageTextKeyLang::operator<(class QImageTextKeyLang const &) const ?paste@QLineEdit@@QAEXXZ @ 3586 NONAME ; void QLineEdit::paste(void) - ?identifierName@QCoeFepInputContext@@UAE?AVQString@@XZ @ 3587 NONAME ; class QString QCoeFepInputContext::identifierName(void) + ?identifierName@QCoeFepInputContext@@UAE?AVQString@@XZ @ 3587 NONAME ABSENT ; class QString QCoeFepInputContext::identifierName(void) ??_EQMouseEvent@@UAE@I@Z @ 3588 NONAME ; QMouseEvent::~QMouseEvent(unsigned int) ?setForegroundBrush@QGraphicsView@@QAEXABVQBrush@@@Z @ 3589 NONAME ; void QGraphicsView::setForegroundBrush(class QBrush const &) ?setDocumentMode@QTabWidget@@QAEX_N@Z @ 3590 NONAME ; void QTabWidget::setDocumentMode(bool) @@ -3809,7 +3809,7 @@ EXPORTS ?load@QPixmap@@QAE_NABVQString@@PBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 3808 NONAME ; bool QPixmap::load(class QString const &, char const *, class QFlags) ??0QStyleOptionToolBar@@IAE@H@Z @ 3809 NONAME ; QStyleOptionToolBar::QStyleOptionToolBar(int) ?setForegroundRole@QWidget@@QAEXW4ColorRole@QPalette@@@Z @ 3810 NONAME ; void QWidget::setForegroundRole(enum QPalette::ColorRole) - ?applyHints@QCoeFepInputContext@@AAEXV?$QFlags@W4InputMethodHint@Qt@@@@@Z @ 3811 NONAME ; void QCoeFepInputContext::applyHints(class QFlags) + ?applyHints@QCoeFepInputContext@@AAEXV?$QFlags@W4InputMethodHint@Qt@@@@@Z @ 3811 NONAME ABSENT ; void QCoeFepInputContext::applyHints(class QFlags) ?visualAlignment@QStyle@@SA?AV?$QFlags@W4AlignmentFlag@Qt@@@@W4LayoutDirection@Qt@@V2@@Z @ 3812 NONAME ; class QFlags QStyle::visualAlignment(enum Qt::LayoutDirection, class QFlags) ?scrollContentsBy@QScrollArea@@MAEXHH@Z @ 3813 NONAME ; void QScrollArea::scrollContentsBy(int, int) ?itemsExpandable@QTreeView@@QBE_NXZ @ 3814 NONAME ; bool QTreeView::itemsExpandable(void) const @@ -4247,7 +4247,7 @@ EXPORTS ?qt_metacast@QActionGroup@@UAEPAXPBD@Z @ 4246 NONAME ; void * QActionGroup::qt_metacast(char const *) ?inputMethodQuery@QTextEdit@@MBE?AVQVariant@@W4InputMethodQuery@Qt@@@Z @ 4247 NONAME ; class QVariant QTextEdit::inputMethodQuery(enum Qt::InputMethodQuery) const ?paint@QGraphicsRectItem@@UAEXPAVQPainter@@PBVQStyleOptionGraphicsItem@@PAVQWidget@@@Z @ 4248 NONAME ; void QGraphicsRectItem::paint(class QPainter *, class QStyleOptionGraphicsItem const *, class QWidget *) - ?getStaticMetaObject@QCoeFepInputContext@@SAABUQMetaObject@@XZ @ 4249 NONAME ; struct QMetaObject const & QCoeFepInputContext::getStaticMetaObject(void) + ?getStaticMetaObject@QCoeFepInputContext@@SAABUQMetaObject@@XZ @ 4249 NONAME ABSENT ; struct QMetaObject const & QCoeFepInputContext::getStaticMetaObject(void) ?d_func@QStyle@@AAEPAVQStylePrivate@@XZ @ 4250 NONAME ; class QStylePrivate * QStyle::d_func(void) ?hasAlphaChannel@QRasterPixmapData@@UBE_NXZ @ 4251 NONAME ; bool QRasterPixmapData::hasAlphaChannel(void) const ??1QAbstractScrollArea@@UAE@XZ @ 4252 NONAME ; QAbstractScrollArea::~QAbstractScrollArea(void) @@ -4298,7 +4298,7 @@ EXPORTS ?fontWeight@QTextCharFormat@@QBEHXZ @ 4297 NONAME ; int QTextCharFormat::fontWeight(void) const ?staticMetaObject@QTextList@@2UQMetaObject@@B @ 4298 NONAME ; struct QMetaObject const QTextList::staticMetaObject ?setBlurRadius@QPixmapDropShadowFilter@@QAEXH@Z @ 4299 NONAME ABSENT ; void QPixmapDropShadowFilter::setBlurRadius(int) - ?GetEditorContentForFep@QCoeFepInputContext@@UBEXAAVTDes16@@HH@Z @ 4300 NONAME ; void QCoeFepInputContext::GetEditorContentForFep(class TDes16 &, int, int) const + ?GetEditorContentForFep@QCoeFepInputContext@@UBEXAAVTDes16@@HH@Z @ 4300 NONAME ABSENT ; void QCoeFepInputContext::GetEditorContentForFep(class TDes16 &, int, int) const ?trUtf8@QGraphicsWidget@@SA?AVQString@@PBD0H@Z @ 4301 NONAME ; class QString QGraphicsWidget::trUtf8(char const *, char const *, int) ?extraItemCache@QGraphicsItemPrivate@@QBEPAVQGraphicsItemCache@@XZ @ 4302 NONAME ; class QGraphicsItemCache * QGraphicsItemPrivate::extraItemCache(void) const ?metaObject@QTableWidget@@UBEPBUQMetaObject@@XZ @ 4303 NONAME ; struct QMetaObject const * QTableWidget::metaObject(void) const @@ -4429,7 +4429,7 @@ EXPORTS ?beginNewFrame@QPaintBuffer@@QAEXXZ @ 4428 NONAME ; void QPaintBuffer::beginNewFrame(void) ?boundingRect@QPainterPath@@QBE?AVQRectF@@XZ @ 4429 NONAME ; class QRectF QPainterPath::boundingRect(void) const ?eventFilter@QCompleter@@MAE_NPAVQObject@@PAVQEvent@@@Z @ 4430 NONAME ; bool QCompleter::eventFilter(class QObject *, class QEvent *) - ??0QCoeFepInputContext@@QAE@PAVQObject@@@Z @ 4431 NONAME ; QCoeFepInputContext::QCoeFepInputContext(class QObject *) + ??0QCoeFepInputContext@@QAE@PAVQObject@@@Z @ 4431 NONAME ABSENT ; QCoeFepInputContext::QCoeFepInputContext(class QObject *) ?clear@QTextDocument@@UAEXXZ @ 4432 NONAME ; void QTextDocument::clear(void) ?tr@QKeyEventTransition@@SA?AVQString@@PBD0@Z @ 4433 NONAME ; class QString QKeyEventTransition::tr(char const *, char const *) ?drawPicture@QPainter@@QAEXABVQPoint@@ABVQPicture@@@Z @ 4434 NONAME ; void QPainter::drawPicture(class QPoint const &, class QPicture const &) @@ -5180,7 +5180,7 @@ EXPORTS ?setPoint@QPolygon@@QAEXHHH@Z @ 5179 NONAME ; void QPolygon::setPoint(int, int, int) ?getStaticMetaObject@QIconEnginePluginV2@@SAABUQMetaObject@@XZ @ 5180 NONAME ; struct QMetaObject const & QIconEnginePluginV2::getStaticMetaObject(void) ?tr@QGraphicsTransform@@SA?AVQString@@PBD0H@Z @ 5181 NONAME ; class QString QGraphicsTransform::tr(char const *, char const *, int) - ?ReportAknEdStateEvent@QCoeFepInputContext@@AAEXW4EAknEdwinStateEvent@MAknEdStateObserver@@@Z @ 5182 NONAME ; void QCoeFepInputContext::ReportAknEdStateEvent(enum MAknEdStateObserver::EAknEdwinStateEvent) + ?ReportAknEdStateEvent@QCoeFepInputContext@@AAEXW4EAknEdwinStateEvent@MAknEdStateObserver@@@Z @ 5182 NONAME ABSENT ; void QCoeFepInputContext::ReportAknEdStateEvent(enum MAknEdStateObserver::EAknEdwinStateEvent) ?getStaticMetaObject@QUndoStack@@SAABUQMetaObject@@XZ @ 5183 NONAME ; struct QMetaObject const & QUndoStack::getStaticMetaObject(void) ?focusInEvent@QDateTimeEdit@@MAEXPAVQFocusEvent@@@Z @ 5184 NONAME ; void QDateTimeEdit::focusInEvent(class QFocusEvent *) ?isNull@QIcon@@QBE_NXZ @ 5185 NONAME ; bool QIcon::isNull(void) const @@ -5505,7 +5505,7 @@ EXPORTS ?hasFormats@QTextEngine@@QBE_NXZ @ 5504 NONAME ; bool QTextEngine::hasFormats(void) const ?setNumColumns@QTextLine@@QAEXHM@Z @ 5505 NONAME ; void QTextLine::setNumColumns(int, float) ?trUtf8@QPixmapConvolutionFilter@@SA?AVQString@@PBD0H@Z @ 5506 NONAME ; class QString QPixmapConvolutionFilter::trUtf8(char const *, char const *, int) - ?GetScreenCoordinatesForFepL@QCoeFepInputContext@@UBEXAAVTPoint@@AAH1H@Z @ 5507 NONAME ; void QCoeFepInputContext::GetScreenCoordinatesForFepL(class TPoint &, int &, int &, int) const + ?GetScreenCoordinatesForFepL@QCoeFepInputContext@@UBEXAAVTPoint@@AAH1H@Z @ 5507 NONAME ABSENT ; void QCoeFepInputContext::GetScreenCoordinatesForFepL(class TPoint &, int &, int &, int) const ?visualRect@QHeaderView@@MBE?AVQRect@@ABVQModelIndex@@@Z @ 5508 NONAME ; class QRect QHeaderView::visualRect(class QModelIndex const &) const ?minimumSize@QStackedLayout@@UBE?AVQSize@@XZ @ 5509 NONAME ; class QSize QStackedLayout::minimumSize(void) const ?keyPressEvent@QGraphicsView@@MAEXPAVQKeyEvent@@@Z @ 5510 NONAME ; void QGraphicsView::keyPressEvent(class QKeyEvent *) @@ -5806,7 +5806,7 @@ EXPORTS ?reset@QMatrix@@QAEXXZ @ 5805 NONAME ; void QMatrix::reset(void) ?qt_metacast@QTabWidget@@UAEPAXPBD@Z @ 5806 NONAME ; void * QTabWidget::qt_metacast(char const *) ?acceptsHoverEvents@QGraphicsItem@@QBE_NXZ @ 5807 NONAME ; bool QGraphicsItem::acceptsHoverEvents(void) const - ?commitCurrentString@QCoeFepInputContext@@AAEX_N@Z @ 5808 NONAME ; void QCoeFepInputContext::commitCurrentString(bool) + ?commitCurrentString@QCoeFepInputContext@@AAEX_N@Z @ 5808 NONAME ABSENT ; void QCoeFepInputContext::commitCurrentString(bool) ?validate@QIntValidator@@UBE?AW4State@QValidator@@AAVQString@@AAH@Z @ 5809 NONAME ; enum QValidator::State QIntValidator::validate(class QString &, int &) const ?itemChange@QGraphicsWidget@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 5810 NONAME ; class QVariant QGraphicsWidget::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &) ?windowFrameEvent@QGraphicsWidget@@MAE_NPAVQEvent@@@Z @ 5811 NONAME ; bool QGraphicsWidget::windowFrameEvent(class QEvent *) @@ -5827,7 +5827,7 @@ EXPORTS ??0QStyleOptionSizeGrip@@IAE@H@Z @ 5826 NONAME ; QStyleOptionSizeGrip::QStyleOptionSizeGrip(int) ?unsetWindowFrameMargins@QGraphicsWidget@@QAEXXZ @ 5827 NONAME ; void QGraphicsWidget::unsetWindowFrameMargins(void) ?inputMask@QLineEdit@@QBE?AVQString@@XZ @ 5828 NONAME ; class QString QLineEdit::inputMask(void) const - ?inputCapabilities@QCoeFepInputContext@@QAE?AVTCoeInputCapabilities@@XZ @ 5829 NONAME ; class TCoeInputCapabilities QCoeFepInputContext::inputCapabilities(void) + ?inputCapabilities@QCoeFepInputContext@@QAE?AVTCoeInputCapabilities@@XZ @ 5829 NONAME ABSENT ; class TCoeInputCapabilities QCoeFepInputContext::inputCapabilities(void) ?rawValue@QTextLength@@QBEMXZ @ 5830 NONAME ; float QTextLength::rawValue(void) const ?horizontalOffset@QListView@@MBEHXZ @ 5831 NONAME ; int QListView::horizontalOffset(void) const ?tr@QPixmapBlurFilter@@SA?AVQString@@PBD0H@Z @ 5832 NONAME ; class QString QPixmapBlurFilter::tr(char const *, char const *, int) @@ -6608,7 +6608,7 @@ EXPORTS ?quality@QPictureIO@@QBEHXZ @ 6607 NONAME ; int QPictureIO::quality(void) const ?tr@QLineControl@@SA?AVQString@@PBD0@Z @ 6608 NONAME ; class QString QLineControl::tr(char const *, char const *) ?selectedFont@QFontDialog@@QBE?AVQFont@@XZ @ 6609 NONAME ; class QFont QFontDialog::selectedFont(void) const - ??1QCoeFepInputContext@@UAE@XZ @ 6610 NONAME ; QCoeFepInputContext::~QCoeFepInputContext(void) + ??1QCoeFepInputContext@@UAE@XZ @ 6610 NONAME ABSENT ; QCoeFepInputContext::~QCoeFepInputContext(void) ?q_func@QPaintEngineExPrivate@@AAEPAVQPaintEngineEx@@XZ @ 6611 NONAME ; class QPaintEngineEx * QPaintEngineExPrivate::q_func(void) ?setMatrixEnabled@QPainter@@QAEX_N@Z @ 6612 NONAME ; void QPainter::setMatrixEnabled(bool) ?dateTime@QDateTimeEdit@@QBE?AVQDateTime@@XZ @ 6613 NONAME ; class QDateTime QDateTimeEdit::dateTime(void) const @@ -6850,7 +6850,7 @@ EXPORTS ?changeEvent@QSplitter@@MAEXPAVQEvent@@@Z @ 6849 NONAME ; void QSplitter::changeEvent(class QEvent *) ?letterSpacing@QFont@@QBEMXZ @ 6850 NONAME ; float QFont::letterSpacing(void) const ?backgroundMode@QPaintEngineState@@QBE?AW4BGMode@Qt@@XZ @ 6851 NONAME ; enum Qt::BGMode QPaintEngineState::backgroundMode(void) const - ?staticMetaObject@QCoeFepInputContext@@2UQMetaObject@@B @ 6852 NONAME ; struct QMetaObject const QCoeFepInputContext::staticMetaObject + ?staticMetaObject@QCoeFepInputContext@@2UQMetaObject@@B @ 6852 NONAME ABSENT ; struct QMetaObject const QCoeFepInputContext::staticMetaObject ?enterWhatsThisMode@QWhatsThis@@SAXXZ @ 6853 NONAME ; void QWhatsThis::enterWhatsThisMode(void) ?textInteractionFlags@QPlainTextEdit@@QBE?AV?$QFlags@W4TextInteractionFlag@Qt@@@@XZ @ 6854 NONAME ; class QFlags QPlainTextEdit::textInteractionFlags(void) const ?addToolBar@QMainWindow@@QAEXPAVQToolBar@@@Z @ 6855 NONAME ; void QMainWindow::addToolBar(class QToolBar *) @@ -7402,7 +7402,7 @@ EXPORTS ?setAutoRepeat@QShortcut@@QAEX_N@Z @ 7401 NONAME ; void QShortcut::setAutoRepeat(bool) ?clearLineData@QTextEngine@@QAEXXZ @ 7402 NONAME ; void QTextEngine::clearLineData(void) ?devType@QPixmap@@UBEHXZ @ 7403 NONAME ; int QPixmap::devType(void) const - ?update@QCoeFepInputContext@@UAEXXZ @ 7404 NONAME ; void QCoeFepInputContext::update(void) + ?update@QCoeFepInputContext@@UAEXXZ @ 7404 NONAME ABSENT ; void QCoeFepInputContext::update(void) ?showSection@QHeaderView@@QAEXH@Z @ 7405 NONAME ; void QHeaderView::showSection(int) ?setDirection@QBoxLayout@@QAEXW4Direction@1@@Z @ 7406 NONAME ; void QBoxLayout::setDirection(enum QBoxLayout::Direction) ?items@QGraphicsScene@@QBE?AV?$QList@PAVQGraphicsItem@@@@ABVQPolygonF@@W4ItemSelectionMode@Qt@@@Z @ 7407 NONAME ; class QList QGraphicsScene::items(class QPolygonF const &, enum Qt::ItemSelectionMode) const @@ -7923,8 +7923,8 @@ EXPORTS ?resizeContents@QListView@@IAEXHH@Z @ 7922 NONAME ; void QListView::resizeContents(int, int) ?setStrength@QPixmapColorizeFilter@@QAEXM@Z @ 7923 NONAME ; void QPixmapColorizeFilter::setStrength(float) ??0QStyleOptionTabV3@@QAE@XZ @ 7924 NONAME ; QStyleOptionTabV3::QStyleOptionTabV3(void) - ?updateHints@QCoeFepInputContext@@AAEX_N@Z @ 7925 NONAME ; void QCoeFepInputContext::updateHints(bool) - ?StartFepInlineEditL@QCoeFepInputContext@@UAEXABVTDesC16@@HHPBVMFormCustomDraw@@AAVMFepInlineTextFormatRetriever@@AAVMFepPointerEventHandlerDuringInlineEdit@@@Z @ 7926 NONAME ; void QCoeFepInputContext::StartFepInlineEditL(class TDesC16 const &, int, int, class MFormCustomDraw const *, class MFepInlineTextFormatRetriever &, class MFepPointerEventHandlerDuringInlineEdit &) + ?updateHints@QCoeFepInputContext@@AAEX_N@Z @ 7925 NONAME ABSENT ; void QCoeFepInputContext::updateHints(bool) + ?StartFepInlineEditL@QCoeFepInputContext@@UAEXABVTDesC16@@HHPBVMFormCustomDraw@@AAVMFepInlineTextFormatRetriever@@AAVMFepPointerEventHandlerDuringInlineEdit@@@Z @ 7926 NONAME ABSENT ; void QCoeFepInputContext::StartFepInlineEditL(class TDesC16 const &, int, int, class MFormCustomDraw const *, class MFepInlineTextFormatRetriever &, class MFepPointerEventHandlerDuringInlineEdit &) ?childEvent@QWorkspace@@MAEXPAVQChildEvent@@@Z @ 7927 NONAME ; void QWorkspace::childEvent(class QChildEvent *) ?setMovable@QHeaderView@@QAEX_N@Z @ 7928 NONAME ; void QHeaderView::setMovable(bool) ?trUtf8@QTextList@@SA?AVQString@@PBD0H@Z @ 7929 NONAME ; class QString QTextList::trUtf8(char const *, char const *, int) @@ -8218,7 +8218,7 @@ EXPORTS ?isRightToLeft@QWidget@@QBE_NXZ @ 8217 NONAME ; bool QWidget::isRightToLeft(void) const ?updateNeeded@QLineControl@@IAEXABVQRect@@@Z @ 8218 NONAME ; void QLineControl::updateNeeded(class QRect const &) ?trUtf8@QSplitter@@SA?AVQString@@PBD0H@Z @ 8219 NONAME ; class QString QSplitter::trUtf8(char const *, char const *, int) - ?mouseHandler@QCoeFepInputContext@@UAEXHPAVQMouseEvent@@@Z @ 8220 NONAME ; void QCoeFepInputContext::mouseHandler(int, class QMouseEvent *) + ?mouseHandler@QCoeFepInputContext@@UAEXHPAVQMouseEvent@@@Z @ 8220 NONAME ABSENT ; void QCoeFepInputContext::mouseHandler(int, class QMouseEvent *) ??0QGraphicsPathItem@@QAE@PAVQGraphicsItem@@PAVQGraphicsScene@@@Z @ 8221 NONAME ; QGraphicsPathItem::QGraphicsPathItem(class QGraphicsItem *, class QGraphicsScene *) ?d_func@QAbstractSpinBox@@AAEPAVQAbstractSpinBoxPrivate@@XZ @ 8222 NONAME ; class QAbstractSpinBoxPrivate * QAbstractSpinBox::d_func(void) ??6@YA?AVQDebug@@V0@PAVQGraphicsObject@@@Z @ 8223 NONAME ; class QDebug operator<<(class QDebug, class QGraphicsObject *) @@ -8250,7 +8250,7 @@ EXPORTS ?stacks@QUndoGroup@@QBE?AV?$QList@PAVQUndoStack@@@@XZ @ 8249 NONAME ; class QList QUndoGroup::stacks(void) const ?naturalTextWidth@QTextLine@@QBEMXZ @ 8250 NONAME ; float QTextLine::naturalTextWidth(void) const ?atSpace@QTextEngine@@QBE_NH@Z @ 8251 NONAME ; bool QTextEngine::atSpace(int) const - ?CancelFepInlineEdit@QCoeFepInputContext@@UAEXXZ @ 8252 NONAME ; void QCoeFepInputContext::CancelFepInlineEdit(void) + ?CancelFepInlineEdit@QCoeFepInputContext@@UAEXXZ @ 8252 NONAME ABSENT ; void QCoeFepInputContext::CancelFepInlineEdit(void) ?syncBackingStore@QWidgetPrivate@@QAEXXZ @ 8253 NONAME ; void QWidgetPrivate::syncBackingStore(void) ?setHorizontalPolicy@QSizePolicy@@QAEXW4Policy@1@@Z @ 8254 NONAME ; void QSizePolicy::setHorizontalPolicy(enum QSizePolicy::Policy) ?filter@QDirModel@@QBE?AV?$QFlags@W4Filter@QDir@@@@XZ @ 8255 NONAME ; class QFlags QDirModel::filter(void) const @@ -8270,7 +8270,7 @@ EXPORTS ?setTransform@QGraphicsItem@@QAEXABVQTransform@@_N@Z @ 8269 NONAME ; void QGraphicsItem::setTransform(class QTransform const &, bool) ?expand@QTreeView@@QAEXABVQModelIndex@@@Z @ 8270 NONAME ; void QTreeView::expand(class QModelIndex const &) ?setParentItem@QGraphicsItem@@QAEXPAV1@@Z @ 8271 NONAME ; void QGraphicsItem::setParentItem(class QGraphicsItem *) - ?GetFormatForFep@QCoeFepInputContext@@UBEXAAVTCharFormat@@H@Z @ 8272 NONAME ; void QCoeFepInputContext::GetFormatForFep(class TCharFormat &, int) const + ?GetFormatForFep@QCoeFepInputContext@@UBEXAAVTCharFormat@@H@Z @ 8272 NONAME ABSENT ; void QCoeFepInputContext::GetFormatForFep(class TCharFormat &, int) const ?setSizeConstraint@QLayout@@QAEXW4SizeConstraint@1@@Z @ 8273 NONAME ; void QLayout::setSizeConstraint(enum QLayout::SizeConstraint) ??5@YAAAVQDataStream@@AAV0@AAVQPicture@@@Z @ 8274 NONAME ; class QDataStream & operator>>(class QDataStream &, class QPicture &) ?atEnd@QTextCursor@@QBE_NXZ @ 8275 NONAME ; bool QTextCursor::atEnd(void) const @@ -8599,7 +8599,7 @@ EXPORTS ?isResize@QWidgetResizeHandler@@ABE_NXZ @ 8598 NONAME ; bool QWidgetResizeHandler::isResize(void) const ?setWrapping@QListView@@QAEX_N@Z @ 8599 NONAME ; void QListView::setWrapping(bool) ??0QTextTableCellFormat@@IAE@ABVQTextFormat@@@Z @ 8600 NONAME ; QTextTableCellFormat::QTextTableCellFormat(class QTextFormat const &) - ?queueInputCapabilitiesChanged@QCoeFepInputContext@@AAEXXZ @ 8601 NONAME ; void QCoeFepInputContext::queueInputCapabilitiesChanged(void) + ?queueInputCapabilitiesChanged@QCoeFepInputContext@@AAEXXZ @ 8601 NONAME ABSENT ; void QCoeFepInputContext::queueInputCapabilitiesChanged(void) ??4QPixmap@@QAEAAV0@ABV0@@Z @ 8602 NONAME ; class QPixmap & QPixmap::operator=(class QPixmap const &) ??0QTextCursor@@QAE@PAVQTextDocumentPrivate@@H@Z @ 8603 NONAME ; QTextCursor::QTextCursor(class QTextDocumentPrivate *, int) ??0QStyleOptionRubberBand@@QAE@XZ @ 8604 NONAME ; QStyleOptionRubberBand::QStyleOptionRubberBand(void) @@ -9273,7 +9273,7 @@ EXPORTS ??1QPixmapFilter@@UAE@XZ @ 9272 NONAME ; QPixmapFilter::~QPixmapFilter(void) ?setTabWhatsThis@QTabWidget@@QAEXHABVQString@@@Z @ 9273 NONAME ; void QTabWidget::setTabWhatsThis(int, class QString const &) ?setTitleBarWidget@QDockWidget@@QAEXPAVQWidget@@@Z @ 9274 NONAME ; void QDockWidget::setTitleBarWidget(class QWidget *) - ?DocumentMaximumLengthForFep@QCoeFepInputContext@@UBEHXZ @ 9275 NONAME ; int QCoeFepInputContext::DocumentMaximumLengthForFep(void) const + ?DocumentMaximumLengthForFep@QCoeFepInputContext@@UBEHXZ @ 9275 NONAME ABSENT ; int QCoeFepInputContext::DocumentMaximumLengthForFep(void) const ?decideFormatFromContent@QImageReader@@QBE_NXZ @ 9276 NONAME ; bool QImageReader::decideFormatFromContent(void) const ?trUtf8@QPixmapColorizeFilter@@SA?AVQString@@PBD0@Z @ 9277 NONAME ; class QString QPixmapColorizeFilter::trUtf8(char const *, char const *) ?removeFromGroup@QGraphicsItemGroup@@QAEXPAVQGraphicsItem@@@Z @ 9278 NONAME ; void QGraphicsItemGroup::removeFromGroup(class QGraphicsItem *) @@ -9357,7 +9357,7 @@ EXPORTS ?toVector2D@QVector3D@@QBE?AVQVector2D@@XZ @ 9356 NONAME ; class QVector2D QVector3D::toVector2D(void) const ?stackBefore@QGraphicsItem@@QAEXPBV1@@Z @ 9357 NONAME ; void QGraphicsItem::stackBefore(class QGraphicsItem const *) ?sizeHintForColumn@QTreeView@@MBEHH@Z @ 9358 NONAME ; int QTreeView::sizeHintForColumn(int) const - ?widgetDestroyed@QCoeFepInputContext@@UAEXPAVQWidget@@@Z @ 9359 NONAME ; void QCoeFepInputContext::widgetDestroyed(class QWidget *) + ?widgetDestroyed@QCoeFepInputContext@@UAEXPAVQWidget@@@Z @ 9359 NONAME ABSENT ; void QCoeFepInputContext::widgetDestroyed(class QWidget *) ?staticMetaObject@QPushButton@@2UQMetaObject@@B @ 9360 NONAME ; struct QMetaObject const QPushButton::staticMetaObject ?xHeight@QFontEngine@@UBE?AUQFixed@@XZ @ 9361 NONAME ; struct QFixed QFontEngine::xHeight(void) const ?setItemIcon@QToolBox@@QAEXHABVQIcon@@@Z @ 9362 NONAME ; void QToolBox::setItemIcon(int, class QIcon const &) @@ -9606,7 +9606,7 @@ EXPORTS ?textDirection@QProgressBar@@QAE?AW4Direction@1@XZ @ 9605 NONAME ; enum QProgressBar::Direction QProgressBar::textDirection(void) ?unpolish@QStyle@@UAEXPAVQApplication@@@Z @ 9606 NONAME ; void QStyle::unpolish(class QApplication *) ?redo@QPlainTextEdit@@QAEXXZ @ 9607 NONAME ; void QPlainTextEdit::redo(void) - ?SetInlineEditingCursorVisibilityL@QCoeFepInputContext@@UAEXH@Z @ 9608 NONAME ; void QCoeFepInputContext::SetInlineEditingCursorVisibilityL(int) + ?SetInlineEditingCursorVisibilityL@QCoeFepInputContext@@UAEXH@Z @ 9608 NONAME ABSENT ; void QCoeFepInputContext::SetInlineEditingCursorVisibilityL(int) ??6@YA?AVQDebug@@V0@V?$QFlags@W4StateFlag@QStyle@@@@@Z @ 9609 NONAME ; class QDebug operator<<(class QDebug, class QFlags) ?test@Parser@QCss@@QAE_NW4TokenType@2@@Z @ 9610 NONAME ; bool QCss::Parser::test(enum QCss::TokenType) ?alignment@QTextBlockFormat@@QBE?AV?$QFlags@W4AlignmentFlag@Qt@@@@XZ @ 9611 NONAME ; class QFlags QTextBlockFormat::alignment(void) const @@ -9712,7 +9712,7 @@ EXPORTS ?d_func@QListWidget@@AAEPAVQListWidgetPrivate@@XZ @ 9711 NONAME ; class QListWidgetPrivate * QListWidget::d_func(void) ??1QMessageBox@@UAE@XZ @ 9712 NONAME ; QMessageBox::~QMessageBox(void) ?paintOnScreen@QWidgetPrivate@@QBE_NXZ @ 9713 NONAME ; bool QWidgetPrivate::paintOnScreen(void) const - ?trUtf8@QCoeFepInputContext@@SA?AVQString@@PBD0H@Z @ 9714 NONAME ; class QString QCoeFepInputContext::trUtf8(char const *, char const *, int) + ?trUtf8@QCoeFepInputContext@@SA?AVQString@@PBD0H@Z @ 9714 NONAME ABSENT ; class QString QCoeFepInputContext::trUtf8(char const *, char const *, int) ?setCorrectionMode@QAbstractSpinBox@@QAEXW4CorrectionMode@1@@Z @ 9715 NONAME ; void QAbstractSpinBox::setCorrectionMode(enum QAbstractSpinBox::CorrectionMode) ?translate@QPolygon@@QAEXABVQPoint@@@Z @ 9716 NONAME ; void QPolygon::translate(class QPoint const &) ??0QTextBrowser@@QAE@PAVQWidget@@@Z @ 9717 NONAME ; QTextBrowser::QTextBrowser(class QWidget *) @@ -9807,7 +9807,7 @@ EXPORTS ?widthF@QPen@@QBEMXZ @ 9806 NONAME ; float QPen::widthF(void) const ?mouseMoveEvent@QAbstractItemView@@MAEXPAVQMouseEvent@@@Z @ 9807 NONAME ; void QAbstractItemView::mouseMoveEvent(class QMouseEvent *) ?styleHint@QWindowsStyle@@UBEHW4StyleHint@QStyle@@PBVQStyleOption@@PBVQWidget@@PAVQStyleHintReturn@@@Z @ 9808 NONAME ; int QWindowsStyle::styleHint(enum QStyle::StyleHint, class QStyleOption const *, class QWidget const *, class QStyleHintReturn *) const - ?SetCursorSelectionForFepL@QCoeFepInputContext@@UAEXABVTCursorSelection@@@Z @ 9809 NONAME ; void QCoeFepInputContext::SetCursorSelectionForFepL(class TCursorSelection const &) + ?SetCursorSelectionForFepL@QCoeFepInputContext@@UAEXABVTCursorSelection@@@Z @ 9809 NONAME ABSENT ; void QCoeFepInputContext::SetCursorSelectionForFepL(class TCursorSelection const &) ??1QClipboardEvent@@UAE@XZ @ 9810 NONAME ; QClipboardEvent::~QClipboardEvent(void) ?textLanguages@QImage@@QBE?AVQStringList@@XZ @ 9811 NONAME ; class QStringList QImage::textLanguages(void) const ?page@QWizard@@QBEPAVQWizardPage@@H@Z @ 9812 NONAME ; class QWizardPage * QWizard::page(int) const @@ -9958,14 +9958,14 @@ EXPORTS ?valuePropertyName@QItemEditorFactory@@UBE?AVQByteArray@@W4Type@QVariant@@@Z @ 9957 NONAME ; class QByteArray QItemEditorFactory::valuePropertyName(enum QVariant::Type) const ?focusInEvent@QLabel@@MAEXPAVQFocusEvent@@@Z @ 9958 NONAME ; void QLabel::focusInEvent(class QFocusEvent *) ?toString@Value@QCss@@QBE?AVQString@@XZ @ 9959 NONAME ; class QString QCss::Value::toString(void) const - ?GetCursorSelectionForFep@QCoeFepInputContext@@UBEXAAVTCursorSelection@@@Z @ 9960 NONAME ; void QCoeFepInputContext::GetCursorSelectionForFep(class TCursorSelection &) const + ?GetCursorSelectionForFep@QCoeFepInputContext@@UBEXAAVTCursorSelection@@@Z @ 9960 NONAME ABSENT ; void QCoeFepInputContext::GetCursorSelectionForFep(class TCursorSelection &) const ??0QTransform@@QAE@ABVQMatrix@@@Z @ 9961 NONAME ; QTransform::QTransform(class QMatrix const &) ?setViewMode@QFileDialog@@QAEXW4ViewMode@1@@Z @ 9962 NONAME ; void QFileDialog::setViewMode(enum QFileDialog::ViewMode) ?setCurrentCharFormat@QTextControl@@QAEXABVQTextCharFormat@@@Z @ 9963 NONAME ; void QTextControl::setCurrentCharFormat(class QTextCharFormat const &) ??6@YAAAVQDataStream@@AAV0@ABVQPalette@@@Z @ 9964 NONAME ; class QDataStream & operator<<(class QDataStream &, class QPalette const &) ??_EQHelpEvent@@UAE@I@Z @ 9965 NONAME ; QHelpEvent::~QHelpEvent(unsigned int) ?verticalScaleAt@QGraphicsItemAnimation@@QBEMM@Z @ 9966 NONAME ; float QGraphicsItemAnimation::verticalScaleAt(float) const - ?State@QCoeFepInputContext@@UAEPAVCState@MCoeFepAwareTextEditor_Extension1@@VTUid@@@Z @ 9967 NONAME ; class MCoeFepAwareTextEditor_Extension1::CState * QCoeFepInputContext::State(class TUid) + ?State@QCoeFepInputContext@@UAEPAVCState@MCoeFepAwareTextEditor_Extension1@@VTUid@@@Z @ 9967 NONAME ABSENT ; class MCoeFepAwareTextEditor_Extension1::CState * QCoeFepInputContext::State(class TUid) ?q_func@QGraphicsEffectPrivate@@AAEPAVQGraphicsEffect@@XZ @ 9968 NONAME ; class QGraphicsEffect * QGraphicsEffectPrivate::q_func(void) ?trUtf8@QRadioButton@@SA?AVQString@@PBD0@Z @ 9969 NONAME ; class QString QRadioButton::trUtf8(char const *, char const *) ?setVerticalHeaderFormat@QCalendarWidget@@QAEXW4VerticalHeaderFormat@1@@Z @ 9970 NONAME ; void QCalendarWidget::setVerticalHeaderFormat(enum QCalendarWidget::VerticalHeaderFormat) @@ -10291,7 +10291,7 @@ EXPORTS ?tr@QInputDialog@@SA?AVQString@@PBD0@Z @ 10290 NONAME ; class QString QInputDialog::tr(char const *, char const *) ?tabSizeHint@QTabBar@@MBE?AVQSize@@H@Z @ 10291 NONAME ; class QSize QTabBar::tabSizeHint(int) const ?tr@QDateEdit@@SA?AVQString@@PBD0@Z @ 10292 NONAME ; class QString QDateEdit::tr(char const *, char const *) - ?tr@QCoeFepInputContext@@SA?AVQString@@PBD0H@Z @ 10293 NONAME ; class QString QCoeFepInputContext::tr(char const *, char const *, int) + ?tr@QCoeFepInputContext@@SA?AVQString@@PBD0H@Z @ 10293 NONAME ABSENT ; class QString QCoeFepInputContext::tr(char const *, char const *, int) ?origin@QGraphicsScale@@QBE?AVQVector3D@@XZ @ 10294 NONAME ; class QVector3D QGraphicsScale::origin(void) const ?subElementRect@QCommonStyle@@UBE?AVQRect@@W4SubElement@QStyle@@PBVQStyleOption@@PBVQWidget@@@Z @ 10295 NONAME ; class QRect QCommonStyle::subElementRect(enum QStyle::SubElement, class QStyleOption const *, class QWidget const *) const ?sizeHint@QRadioButton@@UBE?AVQSize@@XZ @ 10296 NONAME ; class QSize QRadioButton::sizeHint(void) const @@ -10597,7 +10597,7 @@ EXPORTS ?menuBar@QLayout@@QBEPAVQWidget@@XZ @ 10596 NONAME ; class QWidget * QLayout::menuBar(void) const ?items@QGraphicsScene@@QBE?AV?$QList@PAVQGraphicsItem@@@@ABVQPolygonF@@W4ItemSelectionMode@Qt@@W4SortOrder@5@ABVQTransform@@@Z @ 10597 NONAME ; class QList QGraphicsScene::items(class QPolygonF const &, enum Qt::ItemSelectionMode, enum Qt::SortOrder, class QTransform const &) const ?substitutions@QFont@@SA?AVQStringList@@XZ @ 10598 NONAME ; class QStringList QFont::substitutions(void) - ?DoCommitFepInlineEditL@QCoeFepInputContext@@EAEXXZ @ 10599 NONAME ; void QCoeFepInputContext::DoCommitFepInlineEditL(void) + ?DoCommitFepInlineEditL@QCoeFepInputContext@@EAEXXZ @ 10599 NONAME ABSENT ; void QCoeFepInputContext::DoCommitFepInlineEditL(void) ?rootPath@QFileSystemModel@@QBE?AVQString@@XZ @ 10600 NONAME ; class QString QFileSystemModel::rootPath(void) const ?documentSizeChanged@QTextControl@@IAEXABVQSizeF@@@Z @ 10601 NONAME ; void QTextControl::documentSizeChanged(class QSizeF const &) ??1QScrollArea@@UAE@XZ @ 10602 NONAME ; QScrollArea::~QScrollArea(void) @@ -10616,7 +10616,7 @@ EXPORTS ?reason@QFocusEvent@@QBE?AW4FocusReason@Qt@@XZ @ 10615 NONAME ; enum Qt::FocusReason QFocusEvent::reason(void) const ?undo@QTextControl@@QAEXXZ @ 10616 NONAME ; void QTextControl::undo(void) ?fromHsv@QColor@@SA?AV1@HHHH@Z @ 10617 NONAME ; class QColor QColor::fromHsv(int, int, int, int) - ?reset@QCoeFepInputContext@@UAEXXZ @ 10618 NONAME ; void QCoeFepInputContext::reset(void) + ?reset@QCoeFepInputContext@@UAEXXZ @ 10618 NONAME ABSENT ; void QCoeFepInputContext::reset(void) ?load@QImage@@QAE_NABVQString@@PBD@Z @ 10619 NONAME ; bool QImage::load(class QString const &, char const *) ?staticMetaObject@QProxyStyle@@2UQMetaObject@@B @ 10620 NONAME ; struct QMetaObject const QProxyStyle::staticMetaObject ?translate@QMatrix4x4@@QAEAAV1@MMM@Z @ 10621 NONAME ; class QMatrix4x4 & QMatrix4x4::translate(float, float, float) @@ -10690,7 +10690,7 @@ EXPORTS ?controlTypes@QLayoutItem@@QBE?AV?$QFlags@W4ControlType@QSizePolicy@@@@XZ @ 10689 NONAME ; class QFlags QLayoutItem::controlTypes(void) const ?options@QWizard@@QBE?AV?$QFlags@W4WizardOption@QWizard@@@@XZ @ 10690 NONAME ; class QFlags QWizard::options(void) const ?visualRegionForSelection@QTableView@@MBE?AVQRegion@@ABVQItemSelection@@@Z @ 10691 NONAME ; class QRegion QTableView::visualRegionForSelection(class QItemSelection const &) const - ?applyFormat@QCoeFepInputContext@@AAEXPAV?$QList@VAttribute@QInputMethodEvent@@@@@Z @ 10692 NONAME ; void QCoeFepInputContext::applyFormat(class QList *) + ?applyFormat@QCoeFepInputContext@@AAEXPAV?$QList@VAttribute@QInputMethodEvent@@@@@Z @ 10692 NONAME ABSENT ; void QCoeFepInputContext::applyFormat(class QList *) ??1QFontMetrics@@QAE@XZ @ 10693 NONAME ; QFontMetrics::~QFontMetrics(void) ?setWindowRole@QWidget@@QAEXABVQString@@@Z @ 10694 NONAME ; void QWidget::setWindowRole(class QString const &) ??0QTextTable@@QAE@PAVQTextDocument@@@Z @ 10695 NONAME ; QTextTable::QTextTable(class QTextDocument *) @@ -10867,7 +10867,7 @@ EXPORTS ?setNameFilterDisables@QFileSystemModel@@QAEX_N@Z @ 10866 NONAME ; void QFileSystemModel::setNameFilterDisables(bool) ?resizeAnchor@QGraphicsView@@QBE?AW4ViewportAnchor@1@XZ @ 10867 NONAME ; enum QGraphicsView::ViewportAnchor QGraphicsView::resizeAnchor(void) const ?scale@QMatrix4x4@@QAEAAV1@M@Z @ 10868 NONAME ; class QMatrix4x4 & QMatrix4x4::scale(float) - ?SetStateTransferingOwnershipL@QCoeFepInputContext@@UAEXPAVCState@MCoeFepAwareTextEditor_Extension1@@VTUid@@@Z @ 10869 NONAME ; void QCoeFepInputContext::SetStateTransferingOwnershipL(class MCoeFepAwareTextEditor_Extension1::CState *, class TUid) + ?SetStateTransferingOwnershipL@QCoeFepInputContext@@UAEXPAVCState@MCoeFepAwareTextEditor_Extension1@@VTUid@@@Z @ 10869 NONAME ABSENT ; void QCoeFepInputContext::SetStateTransferingOwnershipL(class MCoeFepAwareTextEditor_Extension1::CState *, class TUid) ??0QStyle@@QAE@XZ @ 10870 NONAME ; QStyle::QStyle(void) ?mouseDoubleClickEvent@QHeaderView@@MAEXPAVQMouseEvent@@@Z @ 10871 NONAME ; void QHeaderView::mouseDoubleClickEvent(class QMouseEvent *) ?addPermanentWidget@QStatusBar@@QAEXPAVQWidget@@H@Z @ 10872 NONAME ; void QStatusBar::addPermanentWidget(class QWidget *, int) @@ -11545,7 +11545,7 @@ EXPORTS ?keyReleaseEvent@QWidget@@MAEXPAVQKeyEvent@@@Z @ 11544 NONAME ; void QWidget::keyReleaseEvent(class QKeyEvent *) ??0QCursor@@QAE@ABV0@@Z @ 11545 NONAME ; QCursor::QCursor(class QCursor const &) ?keyReleaseEvent@QGraphicsScene@@MAEXPAVQKeyEvent@@@Z @ 11546 NONAME ; void QGraphicsScene::keyReleaseEvent(class QKeyEvent *) - ?tr@QCoeFepInputContext@@SA?AVQString@@PBD0@Z @ 11547 NONAME ; class QString QCoeFepInputContext::tr(char const *, char const *) + ?tr@QCoeFepInputContext@@SA?AVQString@@PBD0@Z @ 11547 NONAME ABSENT ; class QString QCoeFepInputContext::tr(char const *, char const *) ?pos@QContextMenuEvent@@QBEABVQPoint@@XZ @ 11548 NONAME ; class QPoint const & QContextMenuEvent::pos(void) const ??5@YAAAVQDataStream@@AAV0@AAVQCursor@@@Z @ 11549 NONAME ; class QDataStream & operator>>(class QDataStream &, class QCursor &) ??_EQTextObject@@UAE@I@Z @ 11550 NONAME ; QTextObject::~QTextObject(unsigned int) @@ -11787,7 +11787,7 @@ EXPORTS ?focusOutEvent@QPlainTextEdit@@MAEXPAVQFocusEvent@@@Z @ 11786 NONAME ; void QPlainTextEdit::focusOutEvent(class QFocusEvent *) ??_EQItemEditorCreatorBase@@UAE@I@Z @ 11787 NONAME ; QItemEditorCreatorBase::~QItemEditorCreatorBase(unsigned int) ?capStyleMode@QStroker@@QBE?AW4LineJoinMode@1@XZ @ 11788 NONAME ; enum QStroker::LineJoinMode QStroker::capStyleMode(void) const - ?filterEvent@QCoeFepInputContext@@UAE_NPBVQEvent@@@Z @ 11789 NONAME ; bool QCoeFepInputContext::filterEvent(class QEvent const *) + ?filterEvent@QCoeFepInputContext@@UAE_NPBVQEvent@@@Z @ 11789 NONAME ABSENT ; bool QCoeFepInputContext::filterEvent(class QEvent const *) ??HQRegion@@QBE?BV0@ABV0@@Z @ 11790 NONAME ; class QRegion const QRegion::operator+(class QRegion const &) const ?revert@QAbstractProxyModel@@UAEXXZ @ 11791 NONAME ; void QAbstractProxyModel::revert(void) ??0QPainterState@@QAE@PBV0@@Z @ 11792 NONAME ; QPainterState::QPainterState(class QPainterState const *) @@ -11880,7 +11880,7 @@ EXPORTS ?updateState@QPaintEngineEx@@UAEXABVQPaintEngineState@@@Z @ 11879 NONAME ; void QPaintEngineEx::updateState(class QPaintEngineState const &) ?qt_metacall@QTextFrame@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 11880 NONAME ; int QTextFrame::qt_metacall(enum QMetaObject::Call, int, void * *) ?getStaticMetaObject@QImageIOPlugin@@SAABUQMetaObject@@XZ @ 11881 NONAME ; struct QMetaObject const & QImageIOPlugin::getStaticMetaObject(void) - ?trUtf8@QCoeFepInputContext@@SA?AVQString@@PBD0@Z @ 11882 NONAME ; class QString QCoeFepInputContext::trUtf8(char const *, char const *) + ?trUtf8@QCoeFepInputContext@@SA?AVQString@@PBD0@Z @ 11882 NONAME ABSENT ; class QString QCoeFepInputContext::trUtf8(char const *, char const *) ?autoExclusive@QAbstractButton@@QBE_NXZ @ 11883 NONAME ; bool QAbstractButton::autoExclusive(void) const ??1QGraphicsEffectSource@@UAE@XZ @ 11884 NONAME ; QGraphicsEffectSource::~QGraphicsEffectSource(void) ?mapRectToScene@QGraphicsItem@@QBE?AVQRectF@@MMMM@Z @ 11885 NONAME ; class QRectF QGraphicsItem::mapRectToScene(float, float, float, float) const @@ -12050,7 +12050,7 @@ EXPORTS ?addRoundedRect@QPainterPath@@QAEXMMMMMMW4SizeMode@Qt@@@Z @ 12049 NONAME ; void QPainterPath::addRoundedRect(float, float, float, float, float, float, enum Qt::SizeMode) ?lastCursorPosition@QTextTableCell@@QBE?AVQTextCursor@@XZ @ 12050 NONAME ; class QTextCursor QTextTableCell::lastCursorPosition(void) const ?toTableCellFormat@QTextFormat@@QBE?AVQTextTableCellFormat@@XZ @ 12051 NONAME ; class QTextTableCellFormat QTextFormat::toTableCellFormat(void) const - ?setFocusWidget@QCoeFepInputContext@@UAEXPAVQWidget@@@Z @ 12052 NONAME ; void QCoeFepInputContext::setFocusWidget(class QWidget *) + ?setFocusWidget@QCoeFepInputContext@@UAEXPAVQWidget@@@Z @ 12052 NONAME ABSENT ; void QCoeFepInputContext::setFocusWidget(class QWidget *) ?stretch@QBoxLayout@@QBEHH@Z @ 12053 NONAME ; int QBoxLayout::stretch(int) const ?setColumnHidden@QTableView@@QAEXH_N@Z @ 12054 NONAME ; void QTableView::setColumnHidden(int, bool) ??Eiterator@QTextBlock@@QAE?AV01@H@Z @ 12055 NONAME ; class QTextBlock::iterator QTextBlock::iterator::operator++(int) @@ -12405,7 +12405,7 @@ EXPORTS ??6@YAAAVQDataStream@@AAV0@ABVQTextFormat@@@Z @ 12404 NONAME ; class QDataStream & operator<<(class QDataStream &, class QTextFormat const &) ?setBlockCharFormat@QTextCursor@@QAEXABVQTextCharFormat@@@Z @ 12405 NONAME ; void QTextCursor::setBlockCharFormat(class QTextCharFormat const &) ??6@YA?AVQDebug@@V0@ABVQRegion@@@Z @ 12406 NONAME ; class QDebug operator<<(class QDebug, class QRegion const &) - ?Extension1@QCoeFepInputContext@@EAEPAVMCoeFepAwareTextEditor_Extension1@@AAH@Z @ 12407 NONAME ; class MCoeFepAwareTextEditor_Extension1 * QCoeFepInputContext::Extension1(int &) + ?Extension1@QCoeFepInputContext@@EAEPAVMCoeFepAwareTextEditor_Extension1@@AAH@Z @ 12407 NONAME ABSENT ; class MCoeFepAwareTextEditor_Extension1 * QCoeFepInputContext::Extension1(int &) ?tr@QUndoView@@SA?AVQString@@PBD0H@Z @ 12408 NONAME ; class QString QUndoView::tr(char const *, char const *, int) ?sortByColumn@QTableView@@QAEXH@Z @ 12409 NONAME ; void QTableView::sortByColumn(int) ?supportedDropActions@QStringListModel@@UBE?AV?$QFlags@W4DropAction@Qt@@@@XZ @ 12410 NONAME ; class QFlags QStringListModel::supportedDropActions(void) const @@ -12540,7 +12540,7 @@ EXPORTS ?loadResource@QTextEdit@@UAE?AVQVariant@@HABVQUrl@@@Z @ 12539 NONAME ; class QVariant QTextEdit::loadResource(int, class QUrl const &) ??0QStyleOptionDockWidgetV2@@IAE@H@Z @ 12540 NONAME ; QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(int) ??0QSplitter@@QAE@PAVQWidget@@@Z @ 12541 NONAME ; QSplitter::QSplitter(class QWidget *) - ?DocumentLengthForFep@QCoeFepInputContext@@UBEHXZ @ 12542 NONAME ; int QCoeFepInputContext::DocumentLengthForFep(void) const + ?DocumentLengthForFep@QCoeFepInputContext@@UBEHXZ @ 12542 NONAME ABSENT ; int QCoeFepInputContext::DocumentLengthForFep(void) const ??0QShowEvent@@QAE@XZ @ 12543 NONAME ; QShowEvent::QShowEvent(void) ?fontEngine@QTextEngine@@QBEPAVQFontEngine@@ABUQScriptItem@@PAUQFixed@@11@Z @ 12544 NONAME ; class QFontEngine * QTextEngine::fontEngine(struct QScriptItem const &, struct QFixed *, struct QFixed *, struct QFixed *) const ?leading@QTextLine@@QBEMXZ @ 12545 NONAME ; float QTextLine::leading(void) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index bf1908a..5d66fb7 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4361,40 +4361,40 @@ EXPORTS _ZN19QApplicationPrivateD0Ev @ 4360 NONAME _ZN19QApplicationPrivateD1Ev @ 4361 NONAME _ZN19QApplicationPrivateD2Ev @ 4362 NONAME - _ZN19QCoeFepInputContext10Extension1ERi @ 4363 NONAME - _ZN19QCoeFepInputContext10applyHintsE6QFlagsIN2Qt15InputMethodHintEE @ 4364 NONAME - _ZN19QCoeFepInputContext11applyFormatEP5QListIN17QInputMethodEvent9AttributeEE @ 4365 NONAME - _ZN19QCoeFepInputContext11filterEventEPK6QEvent @ 4366 NONAME - _ZN19QCoeFepInputContext11qt_metacallEN11QMetaObject4CallEiPPv @ 4367 NONAME - _ZN19QCoeFepInputContext11qt_metacastEPKc @ 4368 NONAME - _ZN19QCoeFepInputContext11updateHintsEb @ 4369 NONAME - _ZN19QCoeFepInputContext12mouseHandlerEiP11QMouseEvent @ 4370 NONAME - _ZN19QCoeFepInputContext14setFocusWidgetEP7QWidget @ 4371 NONAME - _ZN19QCoeFepInputContext15MopSupplyObjectE8TTypeUid @ 4372 NONAME - _ZN19QCoeFepInputContext15widgetDestroyedEP7QWidget @ 4373 NONAME - _ZN19QCoeFepInputContext16staticMetaObjectE @ 4374 NONAME DATA 16 - _ZN19QCoeFepInputContext17inputCapabilitiesEv @ 4375 NONAME - _ZN19QCoeFepInputContext19CancelFepInlineEditEv @ 4376 NONAME - _ZN19QCoeFepInputContext19StartFepInlineEditLERK7TDesC16iiPK15MFormCustomDrawR29MFepInlineTextFormatRetrieverR39MFepPointerEventHandlerDuringInlineEdit @ 4377 NONAME - _ZN19QCoeFepInputContext19commitCurrentStringEb @ 4378 NONAME - _ZN19QCoeFepInputContext19getStaticMetaObjectEv @ 4379 NONAME - _ZN19QCoeFepInputContext20UpdateFepInlineTextLERK7TDesC16i @ 4380 NONAME - _ZN19QCoeFepInputContext21ReportAknEdStateEventEN19MAknEdStateObserver19EAknEdwinStateEventE @ 4381 NONAME - _ZN19QCoeFepInputContext22DoCommitFepInlineEditLEv @ 4382 NONAME - _ZN19QCoeFepInputContext25SetCursorSelectionForFepLERK16TCursorSelection @ 4383 NONAME - _ZN19QCoeFepInputContext29SetStateTransferingOwnershipLEPN33MCoeFepAwareTextEditor_Extension16CStateE4TUid @ 4384 NONAME - _ZN19QCoeFepInputContext29queueInputCapabilitiesChangedEv @ 4385 NONAME - _ZN19QCoeFepInputContext30ensureInputCapabilitiesChangedEv @ 4386 NONAME - _ZN19QCoeFepInputContext33SetInlineEditingCursorVisibilityLEi @ 4387 NONAME - _ZN19QCoeFepInputContext5StateE4TUid @ 4388 NONAME - _ZN19QCoeFepInputContext5resetEv @ 4389 NONAME - _ZN19QCoeFepInputContext6updateEv @ 4390 NONAME - _ZN19QCoeFepInputContext8languageEv @ 4391 NONAME - _ZN19QCoeFepInputContextC1EP7QObject @ 4392 NONAME - _ZN19QCoeFepInputContextC2EP7QObject @ 4393 NONAME - _ZN19QCoeFepInputContextD0Ev @ 4394 NONAME - _ZN19QCoeFepInputContextD1Ev @ 4395 NONAME - _ZN19QCoeFepInputContextD2Ev @ 4396 NONAME + _ZN19QCoeFepInputContext10Extension1ERi @ 4363 NONAME ABSENT + _ZN19QCoeFepInputContext10applyHintsE6QFlagsIN2Qt15InputMethodHintEE @ 4364 NONAME ABSENT + _ZN19QCoeFepInputContext11applyFormatEP5QListIN17QInputMethodEvent9AttributeEE @ 4365 NONAME ABSENT + _ZN19QCoeFepInputContext11filterEventEPK6QEvent @ 4366 NONAME ABSENT + _ZN19QCoeFepInputContext11qt_metacallEN11QMetaObject4CallEiPPv @ 4367 NONAME ABSENT + _ZN19QCoeFepInputContext11qt_metacastEPKc @ 4368 NONAME ABSENT + _ZN19QCoeFepInputContext11updateHintsEb @ 4369 NONAME ABSENT + _ZN19QCoeFepInputContext12mouseHandlerEiP11QMouseEvent @ 4370 NONAME ABSENT + _ZN19QCoeFepInputContext14setFocusWidgetEP7QWidget @ 4371 NONAME ABSENT + _ZN19QCoeFepInputContext15MopSupplyObjectE8TTypeUid @ 4372 NONAME ABSENT + _ZN19QCoeFepInputContext15widgetDestroyedEP7QWidget @ 4373 NONAME ABSENT + _ZN19QCoeFepInputContext16staticMetaObjectE @ 4374 NONAME DATA 16 ABSENT + _ZN19QCoeFepInputContext17inputCapabilitiesEv @ 4375 NONAME ABSENT + _ZN19QCoeFepInputContext19CancelFepInlineEditEv @ 4376 NONAME ABSENT + _ZN19QCoeFepInputContext19StartFepInlineEditLERK7TDesC16iiPK15MFormCustomDrawR29MFepInlineTextFormatRetrieverR39MFepPointerEventHandlerDuringInlineEdit @ 4377 NONAME ABSENT + _ZN19QCoeFepInputContext19commitCurrentStringEb @ 4378 NONAME ABSENT + _ZN19QCoeFepInputContext19getStaticMetaObjectEv @ 4379 NONAME ABSENT + _ZN19QCoeFepInputContext20UpdateFepInlineTextLERK7TDesC16i @ 4380 NONAME ABSENT + _ZN19QCoeFepInputContext21ReportAknEdStateEventEN19MAknEdStateObserver19EAknEdwinStateEventE @ 4381 NONAME ABSENT + _ZN19QCoeFepInputContext22DoCommitFepInlineEditLEv @ 4382 NONAME ABSENT + _ZN19QCoeFepInputContext25SetCursorSelectionForFepLERK16TCursorSelection @ 4383 NONAME ABSENT + _ZN19QCoeFepInputContext29SetStateTransferingOwnershipLEPN33MCoeFepAwareTextEditor_Extension16CStateE4TUid @ 4384 NONAME ABSENT + _ZN19QCoeFepInputContext29queueInputCapabilitiesChangedEv @ 4385 NONAME ABSENT + _ZN19QCoeFepInputContext30ensureInputCapabilitiesChangedEv @ 4386 NONAME ABSENT + _ZN19QCoeFepInputContext33SetInlineEditingCursorVisibilityLEi @ 4387 NONAME ABSENT + _ZN19QCoeFepInputContext5StateE4TUid @ 4388 NONAME ABSENT + _ZN19QCoeFepInputContext5resetEv @ 4389 NONAME ABSENT + _ZN19QCoeFepInputContext6updateEv @ 4390 NONAME ABSENT + _ZN19QCoeFepInputContext8languageEv @ 4391 NONAME ABSENT + _ZN19QCoeFepInputContextC1EP7QObject @ 4392 NONAME ABSENT + _ZN19QCoeFepInputContextC2EP7QObject @ 4393 NONAME ABSENT + _ZN19QCoeFepInputContextD0Ev @ 4394 NONAME ABSENT + _ZN19QCoeFepInputContextD1Ev @ 4395 NONAME ABSENT + _ZN19QCoeFepInputContextD2Ev @ 4396 NONAME ABSENT _ZN19QEventDispatcherS6011qt_metacallEN11QMetaObject4CallEiPPv @ 4397 NONAME _ZN19QEventDispatcherS6011qt_metacastEPKc @ 4398 NONAME _ZN19QEventDispatcherS6013processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE @ 4399 NONAME @@ -9263,13 +9263,13 @@ EXPORTS _ZNK19QAbstractScrollArea8viewportEv @ 9262 NONAME _ZNK19QApplicationPrivate11inPopupModeEv @ 9263 NONAME _ZNK19QApplicationPrivate7appNameEv @ 9264 NONAME - _ZNK19QCoeFepInputContext10metaObjectEv @ 9265 NONAME - _ZNK19QCoeFepInputContext15GetFormatForFepER11TCharFormati @ 9266 NONAME - _ZNK19QCoeFepInputContext20DocumentLengthForFepEv @ 9267 NONAME - _ZNK19QCoeFepInputContext22GetEditorContentForFepER6TDes16ii @ 9268 NONAME - _ZNK19QCoeFepInputContext24GetCursorSelectionForFepER16TCursorSelection @ 9269 NONAME - _ZNK19QCoeFepInputContext27DocumentMaximumLengthForFepEv @ 9270 NONAME - _ZNK19QCoeFepInputContext27GetScreenCoordinatesForFepLER6TPointRiS2_i @ 9271 NONAME + _ZNK19QCoeFepInputContext10metaObjectEv @ 9265 NONAME ABSENT + _ZNK19QCoeFepInputContext15GetFormatForFepER11TCharFormati @ 9266 NONAME ABSENT + _ZNK19QCoeFepInputContext20DocumentLengthForFepEv @ 9267 NONAME ABSENT + _ZNK19QCoeFepInputContext22GetEditorContentForFepER6TDes16ii @ 9268 NONAME ABSENT + _ZNK19QCoeFepInputContext24GetCursorSelectionForFepER16TCursorSelection @ 9269 NONAME ABSENT + _ZNK19QCoeFepInputContext27DocumentMaximumLengthForFepEv @ 9270 NONAME ABSENT + _ZNK19QCoeFepInputContext27GetScreenCoordinatesForFepLER6TPointRiS2_i @ 9271 NONAME ABSENT _ZNK19QEventDispatcherS6010metaObjectEv @ 9272 NONAME _ZNK19QGraphicsBlurEffect10blurRadiusEv @ 9273 NONAME _ZNK19QGraphicsBlurEffect10metaObjectEv @ 9274 NONAME @@ -10774,7 +10774,7 @@ EXPORTS _ZTI19QAbstractProxyModel @ 10773 NONAME _ZTI19QAbstractScrollArea @ 10774 NONAME _ZTI19QApplicationPrivate @ 10775 NONAME - _ZTI19QCoeFepInputContext @ 10776 NONAME + _ZTI19QCoeFepInputContext @ 10776 NONAME ABSENT _ZTI19QEventDispatcherS60 @ 10777 NONAME _ZTI19QGraphicsBlurEffect @ 10778 NONAME _ZTI19QGraphicsGridLayout @ 10779 NONAME @@ -11056,7 +11056,7 @@ EXPORTS _ZTV19QAbstractProxyModel @ 11055 NONAME _ZTV19QAbstractScrollArea @ 11056 NONAME _ZTV19QApplicationPrivate @ 11057 NONAME - _ZTV19QCoeFepInputContext @ 11058 NONAME + _ZTV19QCoeFepInputContext @ 11058 NONAME ABSENT _ZTV19QEventDispatcherS60 @ 11059 NONAME _ZTV19QGraphicsBlurEffect @ 11060 NONAME _ZTV19QGraphicsGridLayout @ 11061 NONAME @@ -11164,8 +11164,8 @@ EXPORTS _ZThn12_N14QDragMoveEventD1Ev @ 11163 NONAME _ZThn12_N15QDragEnterEventD0Ev @ 11164 NONAME _ZThn12_N15QDragEnterEventD1Ev @ 11165 NONAME - _ZThn12_N19QCoeFepInputContext29SetStateTransferingOwnershipLEPN33MCoeFepAwareTextEditor_Extension16CStateE4TUid @ 11166 NONAME - _ZThn12_N19QCoeFepInputContext5StateE4TUid @ 11167 NONAME + _ZThn12_N19QCoeFepInputContext29SetStateTransferingOwnershipLEPN33MCoeFepAwareTextEditor_Extension16CStateE4TUid @ 11166 NONAME ABSENT + _ZThn12_N19QCoeFepInputContext5StateE4TUid @ 11167 NONAME ABSENT _ZThn12_NK10QDropEvent11encodedDataEPKc @ 11168 NONAME _ZThn12_NK10QDropEvent6formatEi @ 11169 NONAME _ZThn12_NK10QDropEvent8providesEPKc @ 11170 NONAME @@ -11173,7 +11173,7 @@ EXPORTS _ZThn16_N15QGraphicsWidget14updateGeometryEv @ 11172 NONAME _ZThn16_N15QGraphicsWidgetD0Ev @ 11173 NONAME _ZThn16_N15QGraphicsWidgetD1Ev @ 11174 NONAME - _ZThn16_N19QCoeFepInputContext15MopSupplyObjectE8TTypeUid @ 11175 NONAME + _ZThn16_N19QCoeFepInputContext15MopSupplyObjectE8TTypeUid @ 11175 NONAME ABSENT _ZThn16_N20QGraphicsProxyWidget11setGeometryERK6QRectF @ 11176 NONAME _ZThn16_N20QGraphicsProxyWidgetD0Ev @ 11177 NONAME _ZThn16_N20QGraphicsProxyWidgetD1Ev @ 11178 NONAME @@ -11323,13 +11323,13 @@ EXPORTS _ZThn8_N17QIconEnginePluginD1Ev @ 11322 NONAME _ZThn8_N19QAbstractScrollAreaD0Ev @ 11323 NONAME _ZThn8_N19QAbstractScrollAreaD1Ev @ 11324 NONAME - _ZThn8_N19QCoeFepInputContext10Extension1ERi @ 11325 NONAME - _ZThn8_N19QCoeFepInputContext19CancelFepInlineEditEv @ 11326 NONAME - _ZThn8_N19QCoeFepInputContext19StartFepInlineEditLERK7TDesC16iiPK15MFormCustomDrawR29MFepInlineTextFormatRetrieverR39MFepPointerEventHandlerDuringInlineEdit @ 11327 NONAME - _ZThn8_N19QCoeFepInputContext20UpdateFepInlineTextLERK7TDesC16i @ 11328 NONAME - _ZThn8_N19QCoeFepInputContext22DoCommitFepInlineEditLEv @ 11329 NONAME - _ZThn8_N19QCoeFepInputContext25SetCursorSelectionForFepLERK16TCursorSelection @ 11330 NONAME - _ZThn8_N19QCoeFepInputContext33SetInlineEditingCursorVisibilityLEi @ 11331 NONAME + _ZThn8_N19QCoeFepInputContext10Extension1ERi @ 11325 NONAME ABSENT + _ZThn8_N19QCoeFepInputContext19CancelFepInlineEditEv @ 11326 NONAME ABSENT + _ZThn8_N19QCoeFepInputContext19StartFepInlineEditLERK7TDesC16iiPK15MFormCustomDrawR29MFepInlineTextFormatRetrieverR39MFepPointerEventHandlerDuringInlineEdit @ 11327 NONAME ABSENT + _ZThn8_N19QCoeFepInputContext20UpdateFepInlineTextLERK7TDesC16i @ 11328 NONAME ABSENT + _ZThn8_N19QCoeFepInputContext22DoCommitFepInlineEditLEv @ 11329 NONAME ABSENT + _ZThn8_N19QCoeFepInputContext25SetCursorSelectionForFepLERK16TCursorSelection @ 11330 NONAME ABSENT + _ZThn8_N19QCoeFepInputContext33SetInlineEditingCursorVisibilityLEi @ 11331 NONAME ABSENT _ZThn8_N19QIconEnginePluginV2D0Ev @ 11332 NONAME _ZThn8_N19QIconEnginePluginV2D1Ev @ 11333 NONAME _ZThn8_N19QInputContextPluginD0Ev @ 11334 NONAME @@ -11446,12 +11446,12 @@ EXPORTS _ZThn8_NK17QGraphicsTextItem5shapeEv @ 11445 NONAME _ZThn8_NK17QGraphicsTextItem8containsERK7QPointF @ 11446 NONAME _ZThn8_NK17QGraphicsTextItem9extensionERK8QVariant @ 11447 NONAME - _ZThn8_NK19QCoeFepInputContext15GetFormatForFepER11TCharFormati @ 11448 NONAME - _ZThn8_NK19QCoeFepInputContext20DocumentLengthForFepEv @ 11449 NONAME - _ZThn8_NK19QCoeFepInputContext22GetEditorContentForFepER6TDes16ii @ 11450 NONAME - _ZThn8_NK19QCoeFepInputContext24GetCursorSelectionForFepER16TCursorSelection @ 11451 NONAME - _ZThn8_NK19QCoeFepInputContext27DocumentMaximumLengthForFepEv @ 11452 NONAME - _ZThn8_NK19QCoeFepInputContext27GetScreenCoordinatesForFepLER6TPointRiS2_i @ 11453 NONAME + _ZThn8_NK19QCoeFepInputContext15GetFormatForFepER11TCharFormati @ 11448 NONAME ABSENT + _ZThn8_NK19QCoeFepInputContext20DocumentLengthForFepEv @ 11449 NONAME ABSENT + _ZThn8_NK19QCoeFepInputContext22GetEditorContentForFepER6TDes16ii @ 11450 NONAME ABSENT + _ZThn8_NK19QCoeFepInputContext24GetCursorSelectionForFepER16TCursorSelection @ 11451 NONAME ABSENT + _ZThn8_NK19QCoeFepInputContext27DocumentMaximumLengthForFepEv @ 11452 NONAME ABSENT + _ZThn8_NK19QCoeFepInputContext27GetScreenCoordinatesForFepLER6TPointRiS2_i @ 11453 NONAME ABSENT _ZThn8_NK20QGraphicsProxyWidget4typeEv @ 11454 NONAME _ZThn8_NK7QLayout11maximumSizeEv @ 11455 NONAME _ZThn8_NK7QLayout11minimumSizeEv @ 11456 NONAME -- cgit v0.12 From 1f860338b23d783387b3817de0da100840078edf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 4 Nov 2009 12:15:06 +0100 Subject: reshuffle command line parsing collect the files into a string list during the initial run instead of iterating the argument list twice. --- tools/linguist/lrelease/main.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index db15506..b32b133 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -164,8 +164,8 @@ int main(int argc, char **argv) cd.m_verbose = true; // the default is true starting with Qt 4.2 bool removeIdentical = false; Translator tor; + QStringList inputFiles; QString outputFile; - int numFiles = 0; for (int i = 1; i < argc; ++i) { if (args[i] == QLatin1String("-compress")) { @@ -197,38 +197,34 @@ int main(int argc, char **argv) printUsage(); return 1; } - i++; - outputFile = args[i]; + outputFile = args[++i]; } else if (args[i] == QLatin1String("-help")) { printUsage(); return 0; - } else if (args[i][0] == QLatin1Char('-')) { + } else if (args[i].startsWith(QLatin1Char('-'))) { printUsage(); return 1; } else { - numFiles++; + inputFiles << args[i]; } } - if (numFiles == 0) { + if (inputFiles.isEmpty()) { printUsage(); return 1; } - for (int i = 1; i < argc; ++i) { - if (args[i][0] == QLatin1Char('-') || args[i] == outputFile) - continue; - - if (args[i].endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) - || args[i].endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) { + foreach (const QString &inputFile, inputFiles) { + if (inputFile.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive) + || inputFile.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) { QHash varMap; - bool ok = evaluateProFile(args[i], cd.isVerbose(), &varMap); + bool ok = evaluateProFile(inputFile, cd.isVerbose(), &varMap); if (ok) { QStringList translations = varMap.value("TRANSLATIONS"); if (translations.isEmpty()) { qWarning("lrelease warning: Met no 'TRANSLATIONS' entry in" " project file '%s'\n", - qPrintable(args[i])); + qPrintable(inputFile)); } else { foreach (const QString &trans, translations) if (!releaseTsFile(trans, cd, removeIdentical)) @@ -242,10 +238,10 @@ int main(int argc, char **argv) } } else { if (outputFile.isEmpty()) { - if (!releaseTsFile(args[i], cd, removeIdentical)) + if (!releaseTsFile(inputFile, cd, removeIdentical)) return 1; } else { - if (!loadTsFile(tor, args[i], cd.isVerbose())) + if (!loadTsFile(tor, inputFile, cd.isVerbose())) return 1; } } -- cgit v0.12 From 9a88c8808f8e084e77ee22f907366250f3a0ad2a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 4 Nov 2009 12:17:03 +0100 Subject: add -markuntranslated option maemo *really* want it, so pushing it in now ... --- tests/auto/linguist/lrelease/tst_lrelease.cpp | 13 ++++++++++ tools/linguist/lrelease/main.cpp | 9 +++++++ tools/linguist/shared/qm.cpp | 35 +++++++++++++++------------ tools/linguist/shared/translator.h | 1 + 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index 39de8a1..93cb97c 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -60,6 +60,7 @@ private slots: void mixedcodecs(); void compressed(); void idbased(); + void markuntranslated(); void dupes(); private: @@ -210,6 +211,18 @@ void tst_lrelease::idbased() QCOMPARE(qtTrId("untranslated_id"), QString::fromAscii("This has no translation.")); } +void tst_lrelease::markuntranslated() +{ + QVERIFY(!QProcess::execute(binDir + "/lrelease -markuntranslated # -idbased testdata/idbased.ts")); + + QTranslator translator; + QVERIFY(translator.load("testdata/idbased.qm")); + qApp->installTranslator(&translator); + + QCOMPARE(qtTrId("test_id"), QString::fromAscii("This is a test string.")); + QCOMPARE(qtTrId("untranslated_id"), QString::fromAscii("#This has no translation.")); +} + void tst_lrelease::dupes() { QProcess proc; diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index b32b133..ecaed27 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -79,6 +79,9 @@ static void printUsage() " -removeidentical\n" " If the translated text is the same as\n" " the source text, do not include the message\n" + " -markuntranslated \n" + " If a message has no real translation, use the source text\n" + " prefixed with the given string instead\n" " -silent\n" " Do not explain what is being done\n" " -version\n" @@ -183,6 +186,12 @@ int main(int argc, char **argv) } else if (args[i] == QLatin1String("-nounfinished")) { cd.m_ignoreUnfinished = true; continue; + } else if (args[i] == QLatin1String("-markuntranslated")) { + if (i == argc - 1) { + printUsage(); + return 1; + } + cd.m_unTrPrefix = args[++i]; } else if (args[i] == QLatin1String("-silent")) { cd.m_verbose = false; continue; diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 317a07e..5965aac 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -172,8 +172,8 @@ public: bool save(QIODevice *iod); - void insert(const TranslatorMessage &msg, bool forceComment); - void insertIdBased(const TranslatorMessage &message); + void insert(const TranslatorMessage &msg, const QStringList &tlns, bool forceComment); + void insertIdBased(const TranslatorMessage &message, const QStringList &tlns); void squeeze(TranslatorSaveMode mode); @@ -186,7 +186,8 @@ private: // on turn should be the same as passed to the actual tr(...) calls QByteArray originalBytes(const QString &str, bool isUtf8) const; - void insertInternal(const TranslatorMessage &message, bool forceComment, bool isUtf8); + void insertInternal(const TranslatorMessage &message, const QStringList &tlns, + bool forceComment, bool isUtf8); static Prefix commonPrefix(const ByteTranslatorMessage &m1, const ByteTranslatorMessage &m2); @@ -413,12 +414,13 @@ void Releaser::squeeze(TranslatorSaveMode mode) } } -void Releaser::insertInternal(const TranslatorMessage &message, bool forceComment, bool isUtf8) +void Releaser::insertInternal(const TranslatorMessage &message, const QStringList &tlns, + bool forceComment, bool isUtf8) { ByteTranslatorMessage bmsg(originalBytes(message.context(), isUtf8), originalBytes(message.sourceText(), isUtf8), originalBytes(message.comment(), isUtf8), - message.translations()); + tlns); if (!forceComment) { ByteTranslatorMessage bmsg2( bmsg.context(), bmsg.sourceText(), QByteArray(""), bmsg.translations()); @@ -430,20 +432,15 @@ void Releaser::insertInternal(const TranslatorMessage &message, bool forceCommen m_messages.insert(bmsg, 0); } -void Releaser::insert(const TranslatorMessage &message, bool forceComment) +void Releaser::insert(const TranslatorMessage &message, const QStringList &tlns, bool forceComment) { - insertInternal(message, forceComment, message.isUtf8()); + insertInternal(message, tlns, forceComment, message.isUtf8()); if (message.isUtf8() && message.isNonUtf8()) - insertInternal(message, forceComment, false); + insertInternal(message, tlns, forceComment, false); } -void Releaser::insertIdBased(const TranslatorMessage &message) +void Releaser::insertIdBased(const TranslatorMessage &message, const QStringList &tlns) { - QStringList tlns = message.translations(); - if (message.type() == TranslatorMessage::Unfinished) - for (int i = 0; i < tlns.size(); ++i) - if (tlns.at(i).isEmpty()) - tlns[i] = message.sourceText(); ByteTranslatorMessage bmsg("", originalBytes(message.id(), false), "", tlns); m_messages.insert(bmsg, 0); } @@ -725,10 +722,16 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData } else { ++finished; } + QStringList tlns = msg.translations(); + if (msg.type() == TranslatorMessage::Unfinished + && (cd.m_idBased || !cd.m_unTrPrefix.isEmpty())) + for (int j = 0; j < tlns.size(); ++j) + if (tlns.at(j).isEmpty()) + tlns[j] = cd.m_unTrPrefix + msg.sourceText(); if (cd.m_idBased) { if (!msg.context().isEmpty() || !msg.comment().isEmpty()) ++droppedData; - releaser.insertIdBased(msg); + releaser.insertIdBased(msg, tlns); } else { // Drop the comment in (context, sourceText, comment), // unless the context is empty, @@ -739,7 +742,7 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData msg.comment().isEmpty() || msg.context().isEmpty() || translator.contains(msg.context(), msg.sourceText(), QString()); - releaser.insert(msg, forceComment); + releaser.insert(msg, tlns, forceComment); } } } diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 1dd6a59..ef81d2a 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -86,6 +86,7 @@ public: QString m_defaultContext; QByteArray m_codecForSource; // CPP, PO & QM specific QByteArray m_outputCodec; // PO specific + QString m_unTrPrefix; // QM specific QString m_sourceFileName; QString m_targetFileName; QDir m_sourceDir; -- cgit v0.12 From a314ed575a6d32ef2f31e9b5fd12b14f13208d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Wed, 4 Nov 2009 18:26:01 +0200 Subject: Make button margins bigger in QS60Style Currenly QS60Style relies on QCommonStyle to calculate correct button content size. Unfortunately, common style does not understand frames, so it is possible that the frame-border of theme graphic gets under button content. This change makes both QPushButton and QToolButton bigger. Task-number: None Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 350a8e6..6c56813 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2292,8 +2292,15 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, { QSize sz(csz); switch (ct) { + case CT_ToolButton: + sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); + //FIXME properly - style should calculate the location of border frame-part + sz += QSize(2*pixelMetric(PM_ButtonMargin), 2*pixelMetric(PM_ButtonMargin)); + break; case CT_PushButton: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); + //FIXME properly - style should calculate the location of border frame-part + sz += QSize(2*pixelMetric(PM_ButtonMargin), 2*pixelMetric(PM_ButtonMargin)); if (const QAbstractButton *buttonWidget = (qobject_cast(widget))) if (buttonWidget->isCheckable()) sz += QSize(pixelMetric(PM_IndicatorWidth) + pixelMetric(PM_CheckBoxLabelSpacing), 0); -- cgit v0.12 From 77c281714d9dea1f3bbc47380d5884bff31402c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Wed, 4 Nov 2009 18:36:52 +0200 Subject: QS60Style: QToolButton indicator will not fit into toolbutton area QToolButton rect does not include reserved area for menu indicator, so drawing the indicator makes the rest of the toolbutton area smaller. Fixed by including the menu indicator area into tool button. Task-number: QTBUG-5266 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 6c56813..c0a1f76 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2296,6 +2296,9 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); //FIXME properly - style should calculate the location of border frame-part sz += QSize(2*pixelMetric(PM_ButtonMargin), 2*pixelMetric(PM_ButtonMargin)); + if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast(opt)) + if (toolBtn->subControls & SC_ToolButtonMenu) + sz += QSize(pixelMetric(PM_MenuButtonIndicator),0); break; case CT_PushButton: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); @@ -2579,8 +2582,8 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple break; case CC_ToolButton: if (const QStyleOptionToolButton *toolButton = qstyleoption_cast(option)) { - const int indicatorRect = pixelMetric(PM_MenuButtonIndicator, toolButton, widget) + - 2*pixelMetric(PM_ButtonMargin, toolButton, widget); + const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2*pixelMetric(PM_ButtonMargin); + const int border = pixelMetric(PM_ButtonMargin) + pixelMetric(PM_DefaultFrameWidth); ret = toolButton->rect; const bool popup = (toolButton->features & (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay)) @@ -2592,7 +2595,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple break; case SC_ToolButtonMenu: if (popup) - ret.adjust(ret.width() - indicatorRect, ret.height() - indicatorRect, 0, 0); + ret.adjust(ret.width() - indicatorRect, border, -pixelMetric(PM_ButtonMargin), -border); break; default: break; @@ -2614,8 +2617,8 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con QRect ret; switch (element) { case SE_LineEditContents: { - // in S60 the input text box doesn't start from line Edit's TL, but - // a bit indented. + // in S60 the input text box doesn't start from line Edit's TL, but + // a bit indented. QRect lineEditRect = opt->rect; const int adjustment = opt->rect.height()>>2; lineEditRect.adjust(adjustment,0,0,0); -- cgit v0.12 From 55f0b7e5f3203fa6dfe6a149cf82f42b8b403006 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 4 Nov 2009 17:47:41 +0100 Subject: added my changes to the ChangeLog --- dist/changes-4.6.0 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 61c3aa0..8292957 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -24,6 +24,11 @@ information about a particular change. now 0.93. +Third party components +---------------------- + + - Updated FreeType to version 2.3.9 + **************************************************************************** * Library * **************************************************************************** @@ -42,10 +47,20 @@ information about a particular change. - Qt::escape * now escape the double quote (") + - QScopedPointer + * New pointer class for cleaning up objects when leaving the + current scope + + - QFile + * Make QFile::resize() more robust when operating on buffered files + **************************************************************************** * Platform Specific Changes * **************************************************************************** + - Added community supported Qt ports for QNX and VxWorks. See platform + notes in the Qt documentation for details. + - Significant external contribution from Milan Burda for planned removal of (non-unicode) Windows 9x/ME support. @@ -65,6 +80,10 @@ information about a particular change. - On Windows CE the link time code geration has been disabled by default to be consistent with win32-msvc200x. + - Added QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES1CL and + QMAKE_LIBS_OPENGL_ES2 qmake variables for specifying OpenGL ES + specific libraries. + **************************************************************************** * Tools * **************************************************************************** -- cgit v0.12 From ad3fa7ce6b8a36c2b23f0364f867713f63c6da3b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 4 Nov 2009 18:55:46 +0100 Subject: Some of my changes in the changelog --- dist/changes-4.6.0 | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 8292957..6a1f6f9 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -39,10 +39,14 @@ Third party components * Since the 4.6 beta Qt::RenderHint has been moved to QGraphicsBlurEffect::BlurHint. +QtCore + - QVariant * Many optimisations * Added QVariant::toFloat() and QVariant::toReal() * Added QVariant(float) constructor + * qvariant_cast and qVariantFromValue are now + identify functions - Qt::escape * now escape the double quote (") @@ -54,6 +58,53 @@ Third party components - QFile * Make QFile::resize() more robust when operating on buffered files + - QObject + * Added the possibility to pass the flag Qt::UniqueConnection to QObject::connect + * Fixed race conditions that occured when moving object to threads while connecting + +- QTextStream + * [221316] Fixed crash on large input. + +QtGui + + - QTreeView + * [234930] Be able to use :has-children and :has-sibillings in a stylesheet + * [252616] Set QStyleOptionViewItemV4::OnlyOne flag when painting spanning collumns + + - QTableView + * [234926] Fixed sorting after changing QTableView header + * [244651] Speed up table view with many spans + + - QTabBar + * [196326] Fixed having a stylesheet on a QTabBar resulted in some tab names + to be slightly clipped. + * [241383] Added ability to style the close tab button with style sheet + + - QComboBox + * [220195] Fixed keyboard search when current index is -1 + + - QSpinBox + * [259226] Fixed setting a stylesheet on a QSpinBox to change the arrow possition + + - QStandardItemModel + * [255652] Fixed crash while using takeRow with a QSortFilterProxyModel + + - QGraphicsItem + * Added a new set of properties to set a transformation on a item + + - QMenu + * [252610] Fixed position of the shortcut text while setting a stylesheet on menu items + + - QSortFilterProxyModel + * [251296] Fixed bugs in which filtered items could not be filtered. + + - QSplitter + * [206494] Added ability to style pressed slided with stylesheet + + - QWidget + * [201649] Added QWidget::previousInFocusChain + + **************************************************************************** * Platform Specific Changes * **************************************************************************** @@ -84,6 +135,9 @@ Third party components QMAKE_LIBS_OPENGL_ES2 qmake variables for specifying OpenGL ES specific libraries. + - KDE Integration: Improved the integration into KDE desktop (loading of KDE + palette, usage of KColorDialog and KFileDialog) using the GuiPlatformPlugin + **************************************************************************** * Tools * **************************************************************************** @@ -251,8 +305,8 @@ Third party components for all floating point numbers, and this can be changed using the new function setFloatingPointPrecision(). Set Qt_4_5 as the version of the QDataStream to get the behavior of previous versions. - + - On Mac OS X, QDesktopServices::storageLocation(DataLocation) now includes QCoreApplication::organizationName() and QCoreApplication::applicationName() if those are set. This matches the behavior on the other platforms. - + -- cgit v0.12 From b30cc1dbf2073a6591289b8600e6efd2bfb465a2 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 4 Nov 2009 19:06:30 +0100 Subject: Updated WebKit from /home/jturcott/dev/webkit/ to qtwebkit/qtwebkit-4.6 ( 16aab1b39e14195abdc2100265da2e45b96b739f ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-11-04 Yael Aharon Reviewed by Simon Hausmann. [Qt] REGRESSION: Allow applications to use their own QWidget bypassing QWebView. https://bugs.webkit.org/show_bug.cgi?id=30979 Decouple QWebViewPrivate from QWebPageClient, and automatically create QWebPageWidgetClient whenever the view is QWidget based. * Api/qwebpage.cpp: (QWebPageWidgetClient::QWebPageWidgetClient): (QWebPageWidgetClient::scroll): (QWebPageWidgetClient::update): (QWebPageWidgetClient::setInputMethodEnabled): (QWebPageWidgetClient::setInputMethodHint): (QWebPageWidgetClient::cursor): (QWebPageWidgetClient::updateCursor): (QWebPageWidgetClient::palette): (QWebPageWidgetClient::screenNumber): (QWebPageWidgetClient::ownerWidget): (QWebPageWidgetClient::pluginParent): (QWebPage::setView): * Api/qwebview.cpp: (QWebView::~QWebView): (QWebView::setPage): (QWebView::event): 2009-11-03 Andras Becsi Reviewed by Simon Hausmann. [Qt] Fix build of unit-test after r50454. * tests/qwebpage/tst_qwebpage.cpp: 2009-11-03 Simon Hausmann Reviewed by Tor Arne Vestbø. Make QWebPluginDatabase private API for now. https://bugs.webkit.org/show_bug.cgi?id=30775 * Api/headers.pri: * Api/qwebplugindatabase.cpp: * Api/qwebplugindatabase_p.h: Renamed from WebKit/qt/Api/qwebplugindatabase.h. * Api/qwebsettings.cpp: * Api/qwebsettings.h: * QtLauncher/main.cpp: (MainWindow::setupUI): * tests/tests.pro: 2009-11-03 Simon Hausmann Rubber-stamped by Tor Arne Vestbø. Oops, also remove the API docs of the removed networkRequestStarted() signal. * Api/qwebpage.cpp: 2009-11-03 Simon Hausmann Reviewed by Tor Arne Vestbø. Replace the QWebPage::networkRequestStarted() signal with the originatingObject property set to the QWebFrame that belongs to the request. https://bugs.webkit.org/show_bug.cgi?id=29975 * Api/qwebpage.h: * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): (WebCore::FrameLoaderClientQt::startDownload): * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::loadFinished): (TestNetworkManager::createRequest): (tst_QWebPage::originatingObjectInNetworkRequests): 2009-11-02 Jedrzej Nowacki Reviewed by Adam Barth. QWebView crash fix. The QWebView should not crash if the stop() method is called from a function triggered by the loadProgress signal. A null pointer protection was added in the ProgressTracker::incrementProgress. New autotest was created. https://bugs.webkit.org/show_bug.cgi?id=29425 * tests/qwebview/tst_qwebview.cpp: (WebViewCrashTest::WebViewCrashTest): (WebViewCrashTest::loading): (tst_QWebView::crashTests): 2009-10-30 Jocelyn Turcotte Reviewed by Tor Arne Vestbø. [Qt] Remove the QWebInspector::windowTitleChanged signal, QEvent::WindowTitleChange can be used to achieve the same. https://bugs.webkit.org/show_bug.cgi?id=30927 * Api/qwebinspector.cpp: * Api/qwebinspector.h: * WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientQt::updateWindowTitle): 2009-10-29 Laszlo Gombos Reviewed by Tor Arne Vestbø. [Qt] Implement DELETE HTTP method for XmlHttpRequest https://bugs.webkit.org/show_bug.cgi?id=30894 No new tests as this functionality is already tested by the xmlhttprequest LayoutTests. As this patch depends on an unreleased version of the dependent QtNetwork library and the tests will be enabled later once the dependent library is released (and the buildbot is updated). * Api/qwebframe.cpp: (QWebFrame::load): --- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 40 +------ .../webkit/JavaScriptCore/runtime/Collector.cpp | 8 +- src/3rdparty/webkit/VERSION | 4 +- src/3rdparty/webkit/WebCore/ChangeLog | 108 +++++++++++++++++ src/3rdparty/webkit/WebCore/WebCore.pro | 16 +-- .../webkit/WebCore/inspector/front-end/WebKit.qrc | 11 ++ .../webkit/WebCore/loader/ProgressTracker.cpp | 14 ++- src/3rdparty/webkit/WebCore/platform/FileSystem.h | 11 -- src/3rdparty/webkit/WebCore/platform/KURL.cpp | 4 +- .../platform/graphics/qt/ImageDecoderQt.cpp | 10 +- .../platform/network/qt/QNetworkReplyHandler.cpp | 19 +-- .../WebCore/platform/network/qt/ResourceRequest.h | 3 +- .../platform/network/qt/ResourceRequestQt.cpp | 5 +- .../webkit/WebCore/platform/qt/RenderThemeQt.cpp | 10 +- src/3rdparty/webkit/WebKit/qt/Api/headers.pri | 1 - .../webkit/WebKit/qt/Api/qgraphicswebview.cpp | 96 +-------------- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 5 + .../webkit/WebKit/qt/Api/qwebinspector.cpp | 6 - src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h | 3 - src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 129 ++++++++++++++++----- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h | 2 - .../webkit/WebKit/qt/Api/qwebplugindatabase.cpp | 5 +- .../webkit/WebKit/qt/Api/qwebplugindatabase.h | 98 ---------------- .../webkit/WebKit/qt/Api/qwebplugindatabase_p.h | 98 ++++++++++++++++ src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp | 5 +- src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h | 2 +- src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 91 +-------------- src/3rdparty/webkit/WebKit/qt/ChangeLog | 129 +++++++++++++++++++++ .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 10 +- .../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 1 - src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc | 2 +- .../webkit/WebKit/qt/tests/qwebframe/qwebframe.pro | 2 +- .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 27 ++++- .../webkit/WebKit/qt/tests/qwebpage/qwebpage.pro | 2 +- .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 32 ++++- .../WebKit/qt/tests/qwebview/data/frame_a.html | 2 + .../WebKit/qt/tests/qwebview/data/index.html | 4 + .../webkit/WebKit/qt/tests/qwebview/qwebview.pro | 1 + .../WebKit/qt/tests/qwebview/tst_qwebview.cpp | 43 +++++++ .../WebKit/qt/tests/qwebview/tst_qwebview.qrc | 7 ++ src/3rdparty/webkit/WebKit/qt/tests/tests.pro | 2 +- 41 files changed, 628 insertions(+), 440 deletions(-) delete mode 100644 src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h create mode 100644 src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 470ed0b..c999618 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -75,25 +75,12 @@ namespace JSC { #define THUMB_FUNC_PARAM(name) #endif -#if PLATFORM(LINUX) && (PLATFORM(X86_64) || PLATFORM(X86)) +#if PLATFORM(LINUX) && PLATFORM(X86_64) #define SYMBOL_STRING_RELOCATION(name) #name "@plt" #else #define SYMBOL_STRING_RELOCATION(name) SYMBOL_STRING(name) #endif -#if PLATFORM(DARWIN) - // Mach-O platform -#define HIDE_SYMBOL(name) ".private_extern _" #name -#elif PLATFORM(AIX) - // IBM's own file format -#define HIDE_SYMBOL(name) ".lglobl " #name -#elif PLATFORM(LINUX) || PLATFORM(FREEBSD) || PLATFORM(OPENBSD) || PLATFORM(SOLARIS) || (PLATFORM(HPUX) && PLATFORM(IA64)) || PLATFORM(SYMBIAN) || PLATFORM(NETBSD) - // ELF platform -#define HIDE_SYMBOL(name) ".hidden " #name -#else -#define HIDE_SYMBOL(name) -#endif - #if USE(JSVALUE32_64) #if COMPILER(GCC) && PLATFORM(X86) @@ -106,9 +93,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x50, JITStackFrame_code_offset_matches_ctiTrampoline); asm volatile ( -".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushl %ebp" "\n" "movl %esp, %ebp" "\n" @@ -129,7 +114,6 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" #if !USE(JIT_STUB_ARGUMENT_VA_LIST) "movl %esp, %ecx" "\n" @@ -145,7 +129,6 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addl $0x3c, %esp" "\n" "popl %ebx" "\n" @@ -170,7 +153,6 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x80, JITStackFrame_code_ asm volatile ( ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushq %rbp" "\n" "movq %rsp, %rbp" "\n" @@ -197,7 +179,6 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "movq %rsp, %rdi" "\n" "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" @@ -213,7 +194,6 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addq $0x48, %rsp" "\n" "popq %rbx" "\n" @@ -235,7 +215,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" @@ -262,7 +241,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" @@ -368,9 +346,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x30, JITStackFrame_code_ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x1c, JITStackFrame_stub_argument_space_matches_ctiTrampoline); asm volatile ( -".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushl %ebp" "\n" "movl %esp, %ebp" "\n" @@ -391,7 +367,6 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" #if !USE(JIT_STUB_ARGUMENT_VA_LIST) "movl %esp, %ecx" "\n" @@ -407,7 +382,6 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addl $0x1c, %esp" "\n" "popl %ebx" "\n" @@ -430,9 +404,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x48, JITStackFrame_code_ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x78, JITStackFrame_stub_argument_space_matches_ctiTrampoline); asm volatile ( -".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushq %rbp" "\n" "movq %rsp, %rbp" "\n" @@ -466,7 +438,6 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "movq %rsp, %rdi" "\n" "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" @@ -482,7 +453,6 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addq $0x78, %rsp" "\n" "popq %rbx" "\n" @@ -504,7 +474,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" @@ -531,7 +500,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" @@ -549,7 +517,6 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" @@ -564,9 +531,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" #elif COMPILER(GCC) && PLATFORM(ARM_TRADITIONAL) asm volatile ( -".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "stmdb sp!, {r1-r3}" "\n" "stmdb sp!, {r4-r8, lr}" "\n" @@ -583,14 +548,12 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "mov r0, sp" "\n" "bl " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" // Both has the same return sequence ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "add sp, sp, #36" "\n" "ldmia sp!, {r4-r8, lr}" "\n" @@ -925,7 +888,6 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD ".text" "\n" \ ".align 2" "\n" \ ".globl " SYMBOL_STRING(cti_##op) "\n" \ - HIDE_SYMBOL(cti_##op) "\n" \ ".thumb" "\n" \ ".thumb_func " THUMB_FUNC_PARAM(cti_##op) "\n" \ SYMBOL_STRING(cti_##op) ":" "\n" \ diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index 8b647a0..b885049 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -240,9 +240,7 @@ void Heap::destroy() template NEVER_INLINE CollectorBlock* Heap::allocateBlock() { - // Disable the use of vm_map for the Qt build on Darwin, because when compiled on 10.4 - // it crashes on 10.5 -#if PLATFORM(DARWIN) && !PLATFORM(QT) +#if PLATFORM(DARWIN) vm_address_t address = 0; // FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: . vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); @@ -334,9 +332,7 @@ NEVER_INLINE void Heap::freeBlock(size_t block) NEVER_INLINE void Heap::freeBlock(CollectorBlock* block) { - // Disable the use of vm_deallocate for the Qt build on Darwin, because when compiled on 10.4 - // it crashes on 10.5 -#if PLATFORM(DARWIN) && !PLATFORM(QT) +#if PLATFORM(DARWIN) vm_deallocate(current_task(), reinterpret_cast(block), BLOCK_SIZE); #elif PLATFORM(SYMBIAN) userChunk->Free(reinterpret_cast(block)); diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 98f007c..810781f 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,8 +4,8 @@ This is a snapshot of the Qt port of WebKit from The commit imported was from the - qtwebkit-4.6-snapshot-20091003 branch/tag + qtwebkit/qtwebkit-4.6 branch/tag and has the sha1 checksum - 8f810287200d21aded375664cc0a6ac0476dbdea + 16aab1b39e14195abdc2100265da2e45b96b739f diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 2b36014..1dfc2f9 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,111 @@ +2009-11-03 Simon Hausmann + + Unreviewed build fix for WebInspector with Qt build. + + Simply re-generate the Qt resource file by running + WebKitTools/Scripts/generate-qt-inspector-resource + + * inspector/front-end/WebKit.qrc: + +2009-11-03 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + Make QWebPluginDatabase private API for now. + + https://bugs.webkit.org/show_bug.cgi?id=30775 + + * WebCore.pro: + +2009-11-03 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + Extended the conversion of the WebCore ResourceRequest to the + QNetworkRequest with a mandatory originating object argument, + which is meant to be the QWebFrame the request belongs to. + + https://bugs.webkit.org/show_bug.cgi?id=29975 + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): + (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): + (WebCore::QNetworkReplyHandler::start): + * platform/network/qt/ResourceRequest.h: + * platform/network/qt/ResourceRequestQt.cpp: + (WebCore::ResourceRequest::toNetworkRequest): + +2009-11-02 Jedrzej Nowacki + + Reviewed by Adam Barth. + + QWebView crash fix. + + The QWebView should not crash if the stop() method is called from + a function triggered by the loadProgress signal. + + A null pointer protection was added in the ProgressTracker::incrementProgress. + + New autotest was created. + + https://bugs.webkit.org/show_bug.cgi?id=29425 + + * loader/ProgressTracker.cpp: + (WebCore::ProgressTracker::incrementProgress): + +2009-11-02 Kai Koehne + + Reviewed by Holger Freyther. + + Remove implementation of ImageDecocerQt::clearFrameBufferCache. + The implementation was buggy, and will visually break repeating + animations anyway. + + https://bugs.webkit.org/show_bug.cgi?id=31009 + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::clearFrameBufferCache): + +2009-11-01 Yael Aharon + + Reviewed by Darin Adler. + + Don't add '/' to the URL path if the it does not include '/' after the protocol component + https://bugs.webkit.org/show_bug.cgi?id=30971 + + Match IE8 behaviour, that does not add '/' if there is none after the protocol component. + + * platform/KURL.cpp: + (WebCore::KURL::parse): + +2009-10-30 Kenneth Rohde Christiansen + + Reviewed by Holger Hans Peter Freyther. + + If the owner widget of the page has a palette set, we + should use that one. This was only working when the + owner was a QWebView. This patch fixes that. + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::applyTheme): + +2009-10-29 Laszlo Gombos + + Reviewed by Tor Arne Vestbø. + + [Qt] Implement DELETE HTTP method for XmlHttpRequest + https://bugs.webkit.org/show_bug.cgi?id=30894 + + No new tests as this functionality is already tested by the + xmlhttprequest LayoutTests. As this patch depends on an unreleased + version of the dependent QtNetwork library and the tests will be + enabled later once the dependent library is released (and the + buildbot is updated). + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): + (WebCore::QNetworkReplyHandler::start): + 2009-11-02 Tor Arne Vestbø Rubber-stamped by Antti Koivisto. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 1379fdd..60e414f 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -2327,6 +2327,7 @@ HEADERS += \ xml/XSLTExtensions.h \ xml/XSLTProcessor.h \ xml/XSLTUnicodeSort.h \ + $$PWD/../WebKit/qt/Api/qwebplugindatabase_p.h \ $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ $$PWD/platform/network/qt/DnsPrefetchHelper.h @@ -3380,18 +3381,3 @@ CONFIG(QTDIR_build):isEqual(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 4 plugins/win/PaintHooks.asm } } - -# Temporary workaround to pick up the DEF file from the same place as all the others -symbian { - shared { - contains(MMP_RULES, defBlock) { - MMP_RULES -= defBlock - - MMP_RULES += "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE ../../../s60installs/bwins/$${TARGET}.def" \ - "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE ../../../s60installs/eabi/$${TARGET}.def" \ - "$${LITERAL_HASH}endif" - } - } -} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc index a1d671e..0347952 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc @@ -28,6 +28,7 @@ InjectedScript.js InjectedScriptAccess.js inspector.js + InspectorControllerStub.js KeyboardShortcut.js MetricsSidebarPane.js Object.js @@ -161,6 +162,15 @@ Images/statusbarResizerVertical.png Images/storageIcon.png Images/successGreenDot.png + Images/timelineBarBlue.png + Images/timelineBarGray.png + Images/timelineBarGreen.png + Images/timelineBarOrange.png + Images/timelineBarPurple.png + Images/timelineBarRed.png + Images/timelineBarYellow.png + Images/timelineCheckmarks.png + Images/timelineDots.png Images/timelineHollowPillBlue.png Images/timelineHollowPillGray.png Images/timelineHollowPillGreen.png @@ -168,6 +178,7 @@ Images/timelineHollowPillPurple.png Images/timelineHollowPillRed.png Images/timelineHollowPillYellow.png + Images/timelineIcon.png Images/timelinePillBlue.png Images/timelinePillGray.png Images/timelinePillGreen.png diff --git a/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp b/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp index e682b9b..6b6ce1b 100644 --- a/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp +++ b/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp @@ -176,8 +176,10 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i // FIXME: Can this ever happen? if (!item) return; + + RefPtr frame = m_originatingProgressFrame; - m_originatingProgressFrame->loader()->client()->willChangeEstimatedProgress(); + frame->loader()->client()->willChangeEstimatedProgress(); unsigned bytesReceived = length; double increment, percentOfRemainingBytes; @@ -189,7 +191,7 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i item->estimatedLength = item->bytesReceived * 2; } - int numPendingOrLoadingRequests = m_originatingProgressFrame->loader()->numPendingOrLoadingRequests(true); + int numPendingOrLoadingRequests = frame->loader()->numPendingOrLoadingRequests(true); estimatedBytesForPendingRequests = progressItemDefaultEstimatedLength * numPendingOrLoadingRequests; remainingBytes = ((m_totalPageAndResourceBytesToLoad + estimatedBytesForPendingRequests) - m_totalBytesReceived); if (remainingBytes > 0) // Prevent divide by 0. @@ -199,8 +201,8 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i // For documents that use WebCore's layout system, treat first layout as the half-way point. // FIXME: The hasHTMLView function is a sort of roundabout way of asking "do you use WebCore's layout system". - bool useClampedMaxProgress = m_originatingProgressFrame->loader()->client()->hasHTMLView() - && !m_originatingProgressFrame->loader()->firstLayoutDone(); + bool useClampedMaxProgress = frame->loader()->client()->hasHTMLView() + && !frame->loader()->firstLayoutDone(); double maxProgressValue = useClampedMaxProgress ? 0.5 : finalProgressValue; increment = (maxProgressValue - m_progressValue) * percentOfRemainingBytes; m_progressValue += increment; @@ -221,14 +223,14 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i if (m_progressValue == 1) m_finalProgressChangedSent = true; - m_originatingProgressFrame->loader()->client()->postProgressEstimateChangedNotification(); + frame->loader()->client()->postProgressEstimateChangedNotification(); m_lastNotifiedProgressValue = m_progressValue; m_lastNotifiedProgressTime = now; } } - m_originatingProgressFrame->loader()->client()->didChangeEstimatedProgress(); + frame->loader()->client()->didChangeEstimatedProgress(); } void ProgressTracker::completeProgress(unsigned long identifier) diff --git a/src/3rdparty/webkit/WebCore/platform/FileSystem.h b/src/3rdparty/webkit/WebCore/platform/FileSystem.h index 791198d..9952b39 100644 --- a/src/3rdparty/webkit/WebCore/platform/FileSystem.h +++ b/src/3rdparty/webkit/WebCore/platform/FileSystem.h @@ -98,17 +98,6 @@ struct PlatformModuleVersion { { } - bool operator != (const PlatformModuleVersion& rhs) const - { - return mostSig != rhs.mostSig && leastSig != rhs.leastSig; - } - - - bool operator > (const PlatformModuleVersion& rhs) const - { - return mostSig > rhs.mostSig && leastSig > rhs.leastSig; - } - }; #else typedef unsigned PlatformModuleVersion; diff --git a/src/3rdparty/webkit/WebCore/platform/KURL.cpp b/src/3rdparty/webkit/WebCore/platform/KURL.cpp index ffacc19..c5829d2 100644 --- a/src/3rdparty/webkit/WebCore/platform/KURL.cpp +++ b/src/3rdparty/webkit/WebCore/platform/KURL.cpp @@ -1269,8 +1269,8 @@ void KURL::parse(const char* url, const String* originalString) m_userStart = m_userEnd = m_passwordEnd = m_hostEnd = m_portEnd = p - buffer.data(); // For canonicalization, ensure we have a '/' for no path. - // Only do this for http and https. - if (m_protocolInHTTPFamily && pathEnd - pathStart == 0) + // Do this only for hierarchical URL with protocol http or https. + if (m_protocolInHTTPFamily && hierarchical && pathEnd == pathStart) *p++ = '/'; // add path, escaping bad characters diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index f8403b7..b6823dd 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -145,16 +145,8 @@ RGBA32Buffer* ImageDecoderQt::frameBufferAtIndex(size_t index) return &frame; } -void ImageDecoderQt::clearFrameBufferCache(size_t index) +void ImageDecoderQt::clearFrameBufferCache(size_t /*index*/) { - // Currently QImageReader will be asked to read everything. This - // might change when we read gif images on demand. For now we - // can have a rather simple implementation. - if (index > m_frameBufferCache.size()) - return; - - for (size_t i = 0; i < index; ++index) - m_frameBufferCache[index].clear(); } void ImageDecoderQt::internalDecodeSize() diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index ed5e024..bbf5525 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -140,10 +140,14 @@ QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadMode load m_method = QNetworkAccessManager::PostOperation; else if (r.httpMethod() == "PUT") m_method = QNetworkAccessManager::PutOperation; +#if QT_VERSION >= 0x040600 + else if (r.httpMethod() == "DELETE") + m_method = QNetworkAccessManager::DeleteOperation; +#endif else m_method = QNetworkAccessManager::UnknownOperation; - m_request = r.toNetworkRequest(); + m_request = r.toNetworkRequest(m_resourceHandle->getInternal()->m_frame); if (m_loadMode == LoadNormal) start(); @@ -323,10 +327,7 @@ void QNetworkReplyHandler::sendResponseIfNeeded() client->willSendRequest(m_resourceHandle, newRequest, response); m_redirected = true; - m_request = newRequest.toNetworkRequest(); - - ResourceHandleInternal* d = m_resourceHandle->getInternal(); - emit d->m_frame->page()->networkRequestStarted(d->m_frame, &m_request); + m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame); return; } @@ -368,8 +369,6 @@ void QNetworkReplyHandler::start() QNetworkAccessManager* manager = d->m_frame->page()->networkAccessManager(); - emit d->m_frame->page()->networkRequestStarted(d->m_frame, &m_request); - const QUrl url = m_request.url(); const QString scheme = url.scheme(); // Post requests on files and data don't really make sense, but for @@ -398,6 +397,12 @@ void QNetworkReplyHandler::start() putDevice->setParent(m_reply); break; } +#if QT_VERSION >= 0x040600 + case QNetworkAccessManager::DeleteOperation: { + m_reply = manager->deleteResource(m_request); + break; + } +#endif case QNetworkAccessManager::UnknownOperation: { m_reply = 0; ResourceHandleClient* client = m_resourceHandle->client(); diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h index 93dacf3..60d32dd 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h @@ -31,6 +31,7 @@ QT_BEGIN_NAMESPACE class QNetworkRequest; +class QObject; QT_END_NAMESPACE namespace WebCore { @@ -59,7 +60,7 @@ namespace WebCore { } #if QT_VERSION >= 0x040400 - QNetworkRequest toNetworkRequest() const; + QNetworkRequest toNetworkRequest(QObject* originatingObject) const; #endif private: diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp index c8f6ad5..c866a54 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -28,10 +28,13 @@ namespace WebCore { -QNetworkRequest ResourceRequest::toNetworkRequest() const +QNetworkRequest ResourceRequest::toNetworkRequest(QObject* originatingFrame) const { QNetworkRequest request; request.setUrl(url()); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + request.setOriginatingObject(originatingFrame); +#endif const HTTPHeaderMap &headers = httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index b61d356..501a28b 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -45,6 +45,7 @@ #include "RenderBox.h" #include "RenderTheme.h" #include "UserAgentStyleSheets.h" +#include "QWebPageClient.h" #include "qwebpage.h" #include @@ -757,12 +758,13 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con if (result == RadioPart || result == CheckboxPart) option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off); - // If the webview has a custom palette, use it + // If the owner widget has a custom palette, use it Page* page = o->document()->page(); if (page) { - QWidget* view = static_cast(page->chrome()->client())->m_webPage->view(); - if (view) - option.palette = view->palette(); + ChromeClient* client = page->chrome()->client(); + QWebPageClient* pageClient = client->platformPageClient(); + if (pageClient) + option.palette = pageClient->palette(); } return result; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri index 5a95c67..1a42597 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri +++ b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri @@ -8,7 +8,6 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \ $$PWD/qwebdatabase.h \ $$PWD/qwebsecurityorigin.h \ $$PWD/qwebelement.h \ - $$PWD/qwebplugindatabase.h \ $$PWD/qwebpluginfactory.h \ $$PWD/qwebhistory.h \ $$PWD/qwebinspector.h \ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index b22109b..50a0986 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -164,101 +164,17 @@ void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s) /*! \class QGraphicsWebView - \brief The QGraphicsWebView class allows Web content to be added to a GraphicsView. + \brief The QGraphicsWebView class allows web content to be added to a GraphicsView. \since 4.6 - An instance of this class renders Web content from a URL or supplied as data, using - features of the QtWebKit module. + A WebGraphicsItem renders web content based on a URL or set data. - If the width and height of the item is not set, they will dynamically adjust to - a size appropriate for the content. This width may be large (e.g., 980 pixels or - more) for typical online Web pages. - - \section1 Browser Features - - Many of the functions, signals and properties provided by QWebView are also available - for this item, making it simple to adapt existing code to use QGraphicsWebView instead - of QWebView. - - The item uses a QWebPage object to perform the rendering of Web content, and this can - be obtained with the page() function, enabling the document itself to be accessed and - modified. - - As with QWebView, the item records the browsing history using a QWebHistory object, - accessible using the history() function. The QWebSettings object that defines the - configuration of the browser can be obtained with the settings() function, enabling - features like plugin support to be customized for each item. - - \sa QWebView, QGraphicsTextItem -*/ - -/*! - \fn void QGraphicsWebView::titleChanged(const QString &title) - - This signal is emitted whenever the \a title of the main frame changes. - - \sa title() -*/ - -/*! - \fn void QGraphicsWebView::urlChanged(const QUrl &url) - - This signal is emitted when the \a url of the view changes. - - \sa url(), load() -*/ - -/*! - \fn void QGraphicsWebView::statusChanged() - - This signal is emitted when the status bar text is changed by the page. -*/ - -/*! - \fn void QGraphicsWebView::iconChanged() - - This signal is emitted whenever the icon of the page is loaded or changes. - - In order for icons to be loaded, you will need to set an icon database path - using QWebSettings::setIconDatabasePath(). - - \sa icon(), QWebSettings::setIconDatabasePath() -*/ - -/*! - \fn void QGraphicsWebView::loadStarted() - - This signal is emitted when a new load of the page is started. - - \sa progressChanged(), loadFinished() -*/ - -/*! - \fn void QGraphicsWebView::loadFinished(bool ok) - - This signal is emitted when a load of the page is finished. - \a ok will indicate whether the load was successful or any error occurred. - - \sa loadStarted() + If the width and height of the item is not set, they will + dynamically adjust to a size appropriate for the content. + This width may be large (eg. 980) for typical online web pages. */ /*! - \fn void QGraphicsWebView::progressChanged(qreal progress) - - This signal is emitted every time an element in the web page - completes loading and the overall loading progress advances. - - This signal tracks the progress of all child frames. - - The current value is provided by \a progress and scales from 0.0 to 1.0, - which is the default range of QProgressBar. - - \sa loadStarted(), loadFinished() -*/ - - - -/*! Constructs an empty QGraphicsWebView with parent \a parent. \sa load() @@ -275,7 +191,7 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) } /*! - Destroys the item. + Destroys the web graphicsitem. */ QGraphicsWebView::~QGraphicsWebView() { diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 606dae4..17a0118 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -734,6 +734,11 @@ void QWebFrame::load(const QNetworkRequest &req, case QNetworkAccessManager::PostOperation: request.setHTTPMethod("POST"); break; +#if QT_VERSION >= 0x040600 + case QNetworkAccessManager::DeleteOperation: + request.setHTTPMethod("DELETE"); + break; +#endif case QNetworkAccessManager::UnknownOperation: // eh? break; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp index 4578dc9..409e1a0 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp @@ -188,9 +188,3 @@ void QWebInspectorPrivate::adjustFrontendSize(const QSize& size) frontend->resize(size); } -/*! - \fn void QWebInspector::windowTitleChanged(const QString& newTitle); - - This is emitted to signal that this widget's title changed to \a newTitle. -*/ - diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h index bb5bd64..a5c1ed5 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h @@ -39,9 +39,6 @@ public: QSize sizeHint() const; bool event(QEvent*); -Q_SIGNALS: - void windowTitleChanged(const QString& newTitle); - protected: void resizeEvent(QResizeEvent* event); void showEvent(QShowEvent* event); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 6f1347c..5402ab1 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -78,6 +78,7 @@ #include "Cache.h" #include "runtime/InitializeThreading.h" #include "PageGroup.h" +#include "QWebPageClient.h" #include #include @@ -107,6 +108,9 @@ #else #include "qwebnetworkinterface.h" #endif +#if defined(Q_WS_X11) +#include +#endif using namespace WebCore; @@ -138,6 +142,95 @@ QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page) return page->handle()->page->groupName(); } +class QWebPageWidgetClient : public QWebPageClient { +public: + QWebPageWidgetClient(QWidget* view) + : view(view) + { + Q_ASSERT(view); + } + + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + virtual void setInputMethodEnabled(bool enable); +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); +#endif + +#ifndef QT_NO_CURSOR + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); +#endif + + virtual QPalette palette() const; + virtual int screenNumber() const; + virtual QWidget* ownerWidget() const; + + virtual QObject* pluginParent() const; + + QWidget* view; +}; + +void QWebPageWidgetClient::scroll(int dx, int dy, const QRect& rectToScroll) +{ + view->scroll(qreal(dx), qreal(dy), rectToScroll); +} + +void QWebPageWidgetClient::update(const QRect & dirtyRect) +{ + view->update(dirtyRect); +} + +void QWebPageWidgetClient::setInputMethodEnabled(bool enable) +{ + view->setAttribute(Qt::WA_InputMethodEnabled, enable); +} +#if QT_VERSION >= 0x040600 +void QWebPageWidgetClient::setInputMethodHint(Qt::InputMethodHint hint, bool enable) +{ + if (enable) + view->setInputMethodHints(view->inputMethodHints() | hint); + else + view->setInputMethodHints(view->inputMethodHints() & ~hint); +} +#endif +#ifndef QT_NO_CURSOR +QCursor QWebPageWidgetClient::cursor() const +{ + return view->cursor(); +} + +void QWebPageWidgetClient::updateCursor(const QCursor& cursor) +{ + view->setCursor(cursor); +} +#endif + +QPalette QWebPageWidgetClient::palette() const +{ + return view->palette(); +} + +int QWebPageWidgetClient::screenNumber() const +{ +#if defined(Q_WS_X11) + if (view) + return view->x11Info().screen(); +#endif + + return 0; +} + +QWidget* QWebPageWidgetClient::ownerWidget() const +{ + return view; +} + +QObject* QWebPageWidgetClient::pluginParent() const +{ + return view; +} + // Lookup table mapping QWebPage::WebActions to the associated Editor commands static const char* editorCommandWebActions[] = { @@ -1672,6 +1765,15 @@ void QWebPage::setView(QWidget *view) { if (this->view() != view) { d->view = view; + if (!view) { + delete d->client; + d->client = 0; + } else { + if (!d->client) + d->client = new QWebPageWidgetClient(view); + else + static_cast(d->client)->view = view; + } setViewportSize(view ? view->size() : QSize(0, 0)); } } @@ -2661,17 +2763,6 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) as a result of the user clicking on a "file upload" button in a HTML form where multiple file selection is allowed. - \omitvalue ErrorPageExtension (introduced in Qt 4.6) -*/ - -/*! - \enum QWebPage::ErrorDomain - \since 4.6 - \internal - - \value QtNetwork - \value Http - \value WebKit */ /*! @@ -2722,12 +2813,6 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) */ /*! - \fn QWebPage::ErrorPageExtensionReturn::ErrorPageExtensionReturn() - - Constructs a new error page object. -*/ - -/*! \class QWebPage::ChooseMultipleFilesExtensionOption \since 4.5 \brief The ChooseMultipleFilesExtensionOption class describes the option @@ -3406,16 +3491,6 @@ quint64 QWebPage::bytesReceived() const */ /*! - \since 4.6 - \fn void QWebPage::networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); - \preliminary - - This signal is emitted when a \a frame of the current page requests a web resource. The application - may want to associate the \a request with the \a frame that initiated it by storing the \a frame - as an attribute of the \a request. -*/ - -/*! \fn QWebPagePrivate* QWebPage::handle() const \internal */ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h index f2bbde0..f39209c 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h @@ -347,8 +347,6 @@ Q_SIGNALS: void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); void restoreFrameStateRequested(QWebFrame* frame); - void networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); - protected: virtual QWebPage *createWindow(WebWindowType type); virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp index 623895f..758e257 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp @@ -18,7 +18,7 @@ */ #include "config.h" -#include "qwebplugindatabase.h" +#include "qwebplugindatabase_p.h" #include "PluginDatabase.h" #include "PluginPackage.h" @@ -26,6 +26,7 @@ using namespace WebCore; /*! + \internal \typedef QWebPluginInfo::MimeType \since 4.6 \brief Represents a single MIME type supported by a plugin. @@ -33,6 +34,7 @@ using namespace WebCore; /*! \class QWebPluginInfo + \internal \since 4.6 \brief The QWebPluginInfo class represents a single Netscape plugin. @@ -232,6 +234,7 @@ QWebPluginInfo &QWebPluginInfo::operator=(const QWebPluginInfo& other) /*! \class QWebPluginDatabase + \internal \since 4.6 \brief The QWebPluginDatabase class provides an interface for managing Netscape plugins used by WebKit in QWebPages. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h deleted file mode 100644 index b22c3de..0000000 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2009 Jakub Wieczorek - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef QWEBPLUGINDATABASE_H -#define QWEBPLUGINDATABASE_H - -#include "qwebkitglobal.h" -#include "qwebpluginfactory.h" - -#include -#include - -namespace WebCore { - class PluginDatabase; - class PluginPackage; -} - -class QWebPluginInfoPrivate; -class QWEBKIT_EXPORT QWebPluginInfo { -public: - QWebPluginInfo(); - QWebPluginInfo(const QWebPluginInfo& other); - QWebPluginInfo &operator=(const QWebPluginInfo& other); - ~QWebPluginInfo(); - -private: - QWebPluginInfo(WebCore::PluginPackage* package); - -public: - typedef QWebPluginFactory::MimeType MimeType; - - QString name() const; - QString description() const; - QList mimeTypes() const; - bool supportsMimeType(const QString& mimeType) const; - QString path() const; - - bool isNull() const; - - void setEnabled(bool enabled); - bool isEnabled() const; - - bool operator==(const QWebPluginInfo& other) const; - bool operator!=(const QWebPluginInfo& other) const; - - friend class QWebPluginDatabase; - -private: - QWebPluginInfoPrivate* d; - WebCore::PluginPackage* m_package; - mutable QList m_mimeTypes; -}; - -class QWebPluginDatabasePrivate; -class QWEBKIT_EXPORT QWebPluginDatabase : public QObject { - Q_OBJECT - -private: - QWebPluginDatabase(QObject* parent = 0); - ~QWebPluginDatabase(); - -public: - QList plugins() const; - - static QStringList defaultSearchPaths(); - QStringList searchPaths() const; - void setSearchPaths(const QStringList& paths); - void addSearchPath(const QString& path); - - void refresh(); - - QWebPluginInfo pluginForMimeType(const QString& mimeType); - void setPreferredPluginForMimeType(const QString& mimeType, const QWebPluginInfo& plugin); - - friend class QWebSettings; - -private: - QWebPluginDatabasePrivate* d; - WebCore::PluginDatabase* m_database; -}; - -#endif // QWEBPLUGINDATABASE_H diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h new file mode 100644 index 0000000..b22c3de --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h @@ -0,0 +1,98 @@ +/* + Copyright (C) 2009 Jakub Wieczorek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBPLUGINDATABASE_H +#define QWEBPLUGINDATABASE_H + +#include "qwebkitglobal.h" +#include "qwebpluginfactory.h" + +#include +#include + +namespace WebCore { + class PluginDatabase; + class PluginPackage; +} + +class QWebPluginInfoPrivate; +class QWEBKIT_EXPORT QWebPluginInfo { +public: + QWebPluginInfo(); + QWebPluginInfo(const QWebPluginInfo& other); + QWebPluginInfo &operator=(const QWebPluginInfo& other); + ~QWebPluginInfo(); + +private: + QWebPluginInfo(WebCore::PluginPackage* package); + +public: + typedef QWebPluginFactory::MimeType MimeType; + + QString name() const; + QString description() const; + QList mimeTypes() const; + bool supportsMimeType(const QString& mimeType) const; + QString path() const; + + bool isNull() const; + + void setEnabled(bool enabled); + bool isEnabled() const; + + bool operator==(const QWebPluginInfo& other) const; + bool operator!=(const QWebPluginInfo& other) const; + + friend class QWebPluginDatabase; + +private: + QWebPluginInfoPrivate* d; + WebCore::PluginPackage* m_package; + mutable QList m_mimeTypes; +}; + +class QWebPluginDatabasePrivate; +class QWEBKIT_EXPORT QWebPluginDatabase : public QObject { + Q_OBJECT + +private: + QWebPluginDatabase(QObject* parent = 0); + ~QWebPluginDatabase(); + +public: + QList plugins() const; + + static QStringList defaultSearchPaths(); + QStringList searchPaths() const; + void setSearchPaths(const QStringList& paths); + void addSearchPath(const QString& path); + + void refresh(); + + QWebPluginInfo pluginForMimeType(const QString& mimeType); + void setPreferredPluginForMimeType(const QString& mimeType, const QWebPluginInfo& plugin); + + friend class QWebSettings; + +private: + QWebPluginDatabasePrivate* d; + WebCore::PluginDatabase* m_database; +}; + +#endif // QWEBPLUGINDATABASE_H diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp index ffa21e4..3052056 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp @@ -22,7 +22,7 @@ #include "qwebpage.h" #include "qwebpage_p.h" -#include "qwebplugindatabase.h" +#include "qwebplugindatabase_p.h" #include "Cache.h" #include "CrossOriginPreflightResultCache.h" @@ -627,7 +627,7 @@ QIcon QWebSettings::iconForUrl(const QUrl& url) /*! Returns the plugin database object. -*/ + QWebPluginDatabase *QWebSettings::pluginDatabase() { static QWebPluginDatabase* database = 0; @@ -635,6 +635,7 @@ QWebPluginDatabase *QWebSettings::pluginDatabase() database = new QWebPluginDatabase(); return database; } +*/ /*! Sets \a graphic to be drawn when QtWebKit needs to draw an image of the diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h index e68ea53..c958ae7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h @@ -114,7 +114,7 @@ public: static void clearIconDatabase(); static QIcon iconForUrl(const QUrl &url); - static QWebPluginDatabase *pluginDatabase(); + //static QWebPluginDatabase *pluginDatabase(); static void setWebGraphic(WebGraphic type, const QPixmap &graphic); static QPixmap webGraphic(WebGraphic type); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index b9c2f74..12b20ab 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -32,11 +32,8 @@ #include "qprinter.h" #include "qdir.h" #include "qfile.h" -#if defined(Q_WS_X11) -#include -#endif -class QWebViewPrivate : public QWebPageClient { +class QWebViewPrivate { public: QWebViewPrivate(QWebView *view) : view(view) @@ -46,24 +43,6 @@ public: Q_ASSERT(view); } - virtual void scroll(int dx, int dy, const QRect&); - virtual void update(const QRect& dirtyRect); - virtual void setInputMethodEnabled(bool enable); -#if QT_VERSION >= 0x040600 - virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); -#endif - -#ifndef QT_NO_CURSOR - virtual QCursor cursor() const; - virtual void updateCursor(const QCursor& cursor); -#endif - - virtual QPalette palette() const; - virtual int screenNumber() const; - virtual QWidget* ownerWidget() const; - - virtual QObject* pluginParent() const; - void _q_pageDestroyed(); QWebView *view; @@ -72,66 +51,6 @@ public: QPainter::RenderHints renderHints; }; -void QWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) -{ - view->scroll(qreal(dx), qreal(dy), rectToScroll); -} - -void QWebViewPrivate::update(const QRect & dirtyRect) -{ - view->update(dirtyRect); -} - -void QWebViewPrivate::setInputMethodEnabled(bool enable) -{ - view->setAttribute(Qt::WA_InputMethodEnabled, enable); -} -#if QT_VERSION >= 0x040600 -void QWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) -{ - if (enable) - view->setInputMethodHints(view->inputMethodHints() | hint); - else - view->setInputMethodHints(view->inputMethodHints() & ~hint); -} -#endif -#ifndef QT_NO_CURSOR -QCursor QWebViewPrivate::cursor() const -{ - return view->cursor(); -} - -void QWebViewPrivate::updateCursor(const QCursor& cursor) -{ - view->setCursor(cursor); -} -#endif - -QPalette QWebViewPrivate::palette() const -{ - return view->palette(); -} - -int QWebViewPrivate::screenNumber() const -{ -#if defined(Q_WS_X11) - if (view) - return view->x11Info().screen(); -#endif - - return 0; -} - -QWidget* QWebViewPrivate::ownerWidget() const -{ - return view; -} - -QObject* QWebViewPrivate::pluginParent() const -{ - return view; -} - void QWebViewPrivate::_q_pageDestroyed() { page = 0; @@ -151,7 +70,7 @@ void QWebViewPrivate::_q_pageDestroyed() It can be used in various applications to display web content live from the Internet. - The image below shows QWebView previewed in \QD with a Nokia website. + The image below shows QWebView previewed in \QD with the Trolltech website. \image qwebview-url.png @@ -251,6 +170,7 @@ QWebView::~QWebView() #else d->page->d->view = 0; #endif + delete d->page->d->client; d->page->d->client = 0; } @@ -296,7 +216,6 @@ void QWebView::setPage(QWebPage* page) d->page = page; if (d->page) { d->page->setView(this); - d->page->d->client = d; // set the page client d->page->setPalette(palette()); // #### connect signals QWebFrame *mainFrame = d->page->mainFrame(); @@ -728,7 +647,7 @@ bool QWebView::event(QEvent *e) // WebCore. // FIXME: Add a QEvent::CursorUnset or similar to Qt. if (cursor().shape() == Qt::ArrowCursor) - d->resetCursor(); + d->page->d->client->resetCursor(); #endif #endif } else if (e->type() == QEvent::Leave) @@ -1055,7 +974,7 @@ void QWebView::changeEvent(QEvent *e) /*! \fn void QWebView::statusBarMessage(const QString& text) - This signal is emitted when the status bar \a text is changed by the page. + This signal is emitted when the statusbar \a text is changed by the page. */ /*! diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index b19a1d0..84c5d43 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,132 @@ +2009-11-04 Yael Aharon + + Reviewed by Simon Hausmann. + + [Qt] REGRESSION: Allow applications to use their own QWidget bypassing QWebView. + https://bugs.webkit.org/show_bug.cgi?id=30979 + + Decouple QWebViewPrivate from QWebPageClient, and automatically create + QWebPageWidgetClient whenever the view is QWidget based. + + * Api/qwebpage.cpp: + (QWebPageWidgetClient::QWebPageWidgetClient): + (QWebPageWidgetClient::scroll): + (QWebPageWidgetClient::update): + (QWebPageWidgetClient::setInputMethodEnabled): + (QWebPageWidgetClient::setInputMethodHint): + (QWebPageWidgetClient::cursor): + (QWebPageWidgetClient::updateCursor): + (QWebPageWidgetClient::palette): + (QWebPageWidgetClient::screenNumber): + (QWebPageWidgetClient::ownerWidget): + (QWebPageWidgetClient::pluginParent): + (QWebPage::setView): + * Api/qwebview.cpp: + (QWebView::~QWebView): + (QWebView::setPage): + (QWebView::event): + +2009-11-03 Andras Becsi + + Reviewed by Simon Hausmann. + + [Qt] Fix build of unit-test after r50454. + + * tests/qwebpage/tst_qwebpage.cpp: + +2009-11-03 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + Make QWebPluginDatabase private API for now. + + https://bugs.webkit.org/show_bug.cgi?id=30775 + + * Api/headers.pri: + * Api/qwebplugindatabase.cpp: + * Api/qwebplugindatabase_p.h: Renamed from WebKit/qt/Api/qwebplugindatabase.h. + * Api/qwebsettings.cpp: + * Api/qwebsettings.h: + * QtLauncher/main.cpp: + (MainWindow::setupUI): + * tests/tests.pro: + +2009-11-03 Simon Hausmann + + Rubber-stamped by Tor Arne Vestbø. + + Oops, also remove the API docs of the removed networkRequestStarted() signal. + + * Api/qwebpage.cpp: + +2009-11-03 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + Replace the QWebPage::networkRequestStarted() signal with the originatingObject + property set to the QWebFrame that belongs to the request. + + https://bugs.webkit.org/show_bug.cgi?id=29975 + + * Api/qwebpage.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): + (WebCore::FrameLoaderClientQt::startDownload): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadFinished): + (TestNetworkManager::createRequest): + (tst_QWebPage::originatingObjectInNetworkRequests): + +2009-11-02 Jedrzej Nowacki + + Reviewed by Adam Barth. + + QWebView crash fix. + + The QWebView should not crash if the stop() method is called from + a function triggered by the loadProgress signal. + + A null pointer protection was added in the ProgressTracker::incrementProgress. + + New autotest was created. + + https://bugs.webkit.org/show_bug.cgi?id=29425 + + * tests/qwebview/tst_qwebview.cpp: + (WebViewCrashTest::WebViewCrashTest): + (WebViewCrashTest::loading): + (tst_QWebView::crashTests): + +2009-10-30 Jocelyn Turcotte + + Reviewed by Tor Arne Vestbø. + + [Qt] Remove the QWebInspector::windowTitleChanged signal, + QEvent::WindowTitleChange can be used to achieve the same. + https://bugs.webkit.org/show_bug.cgi?id=30927 + + * Api/qwebinspector.cpp: + * Api/qwebinspector.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::updateWindowTitle): + +2009-10-29 Laszlo Gombos + + Reviewed by Tor Arne Vestbø. + + [Qt] Implement DELETE HTTP method for XmlHttpRequest + https://bugs.webkit.org/show_bug.cgi?id=30894 + + No new tests as this functionality is already tested by the + xmlhttprequest LayoutTests. As this patch depends on an unreleased + version of the dependent QtNetwork library and the tests will be + enabled later once the dependent library is released (and the + buildbot is updated). + + * Api/qwebframe.cpp: + (QWebFrame::load): + 2009-10-29 Kenneth Rohde Christiansen Reviewed by Tor Arne Vestbø. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 1ed9b21..f706d77 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -708,7 +708,7 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request) { ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().prettyURL(), - QCoreApplication::translate("QWebFrame", "Request canceled", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Request cancelled", 0, QCoreApplication::UnicodeUTF8)); error.setIsCancellation(true); return error; } @@ -746,7 +746,7 @@ WebCore::ResourceError FrameLoaderClientQt::interruptForPolicyChangeError(const WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response) { return ResourceError("WebKit", WebKitErrorCannotShowMIMEType, response.url().string(), - QCoreApplication::translate("QWebFrame", "Cannot show MIME type", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0, QCoreApplication::UnicodeUTF8)); } WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response) @@ -946,7 +946,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else - QNetworkRequest r(request.toNetworkRequest()); + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); #endif QWebPage* page = m_webFrame->page(); @@ -971,7 +971,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else - QNetworkRequest r(request.toNetworkRequest()); + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); #endif QWebPage*page = m_webFrame->page(); @@ -1001,7 +1001,7 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request) if (!m_webFrame) return; - emit m_webFrame->page()->downloadRequested(request.toNetworkRequest()); + emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_webFrame)); #endif } diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 12f405c..7a1bfd5 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -166,7 +166,6 @@ void InspectorClientQt::updateWindowTitle() if (m_inspectedWebPage->d->inspector) { QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); m_inspectedWebPage->d->inspector->setWindowTitle(caption); - emit m_inspectedWebPage->d->inspector->windowTitleChanged(caption); } } diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 408478c..09dfae5 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -31,7 +31,7 @@ the module under the appropriate version of the GNU LGPL; version 2.1 for applications and libraries licensed under the GNU GPL version 2, or version 3 for applications and libraries licensed under the GNU - GPL version 3. + GPL version 2. \legalese WebKit is licensed under the GNU Library General Public License. diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index b8734cd..0e540e5 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -5,7 +5,7 @@ SOURCES += tst_qwebframe.cpp RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -!symbian:DEFINES += SRCDIR=\\\"$$PWD/resources\\\" +DEFINES += SRCDIR=\\\"$$PWD/resources\\\" symbian { TARGET.UID3 = 0xA000E53D diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index d304d3e..7cc62b0 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -38,10 +38,6 @@ #endif #include "../util.h" -#if defined(Q_OS_SYMBIAN) -# define SRCDIR "" -#endif - //TESTED_CLASS= //TESTED_FILES= @@ -590,6 +586,7 @@ private slots: void javaScriptWindowObjectClearedOnEvaluate(); void setHtml(); void setHtmlWithResource(); + void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); void popupFocus(); @@ -2375,6 +2372,28 @@ void tst_QWebFrame::setHtmlWithResource() QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red")); } +void tst_QWebFrame::setHtmlWithBaseURL() +{ + QString html("

hello world

"); + + QWebPage page; + QWebFrame* frame = page.mainFrame(); + + // in few seconds, the image should be completey loaded + QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); + + frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); + QTest::qWait(200); + QCOMPARE(spy.count(), 1); + + QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); + QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128); + QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128); + + // no history item has to be added. + QCOMPARE(m_view->page()->history()->count(), 0); +} + class TestNetworkManager : public QNetworkAccessManager { public: diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index 7853b28..6b28efd 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -5,7 +5,7 @@ SOURCES += tst_qwebpage.cpp RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" +DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian { TARGET.UID3 = 0xA000E53E diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 8373e04..6cbe2b1 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -37,10 +37,6 @@ #include #include -#if defined(Q_OS_SYMBIAN) -# define SRCDIR "" -#endif - // Will try to wait for the condition while allowing event processing #define QTRY_COMPARE(__expr, __expected) \ do { \ @@ -133,6 +129,8 @@ private slots: void screenshot_data(); void screenshot(); + void originatingObjectInNetworkRequests(); + private: QWebView* m_view; QWebPage* m_page; @@ -238,7 +236,6 @@ void tst_QWebPage::loadFinished() { qRegisterMetaType("QWebFrame*"); qRegisterMetaType("QNetworkRequest*"); - QSignalSpy spyNetworkRequestStarted(m_page, SIGNAL(networkRequestStarted(QWebFrame*, QNetworkRequest*))); QSignalSpy spyLoadStarted(m_view, SIGNAL(loadStarted())); QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); @@ -249,7 +246,6 @@ void tst_QWebPage::loadFinished() QTest::qWait(3000); - QVERIFY(spyNetworkRequestStarted.count() > 1); QVERIFY(spyLoadStarted.count() > 1); QVERIFY(spyLoadFinished.count() > 1); @@ -350,9 +346,11 @@ public: TestNetworkManager(QObject* parent) : QNetworkAccessManager(parent) {} QList requestedUrls; + QList requests; protected: virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest &request, QIODevice* outgoingData) { + requests.append(request); requestedUrls.append(request.url()); return QNetworkAccessManager::createRequest(op, request, outgoingData); } @@ -1613,5 +1611,27 @@ void tst_QWebPage::screenshot() QDir::setCurrent(QApplication::applicationDirPath()); } +void tst_QWebPage::originatingObjectInNetworkRequests() +{ + TestNetworkManager* networkManager = new TestNetworkManager(m_page); + m_page->setNetworkAccessManager(networkManager); + networkManager->requests.clear(); + + m_view->setHtml(QString("data:text/html,foo \">" + ""), QUrl()); + QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); + + QCOMPARE(networkManager->requests.count(), 2); + + QList childFrames = m_page->mainFrame()->childFrames(); + QCOMPARE(childFrames.count(), 2); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + for (int i = 0; i < 2; ++i) + QVERIFY(qobject_cast(networkManager->requests.at(i).originatingObject()) == childFrames.at(i)); +#endif +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html new file mode 100644 index 0000000..9ff68f1 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html @@ -0,0 +1,2 @@ +
Google +Yahoo diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html new file mode 100644 index 0000000..c53ad09 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html @@ -0,0 +1,4 @@ + + + + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index e67bb7a..735537b 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -4,6 +4,7 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +RESOURCES += tst_qwebview.qrc DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian { diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index fda979e..27daf38 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -20,6 +20,7 @@ */ #include +#include "../util.h" #include #include @@ -45,6 +46,8 @@ private slots: void reusePage_data(); void reusePage(); + + void crashTests(); }; // This will be called before the first test function is executed. @@ -148,6 +151,46 @@ void tst_QWebView::reusePage() QDir::setCurrent(QApplication::applicationDirPath()); } +// Class used in crashTests +class WebViewCrashTest : public QObject { + Q_OBJECT + QWebView* m_view; +public: + bool m_executed; + + + WebViewCrashTest(QWebView* view) + : m_view(view) + , m_executed(false) + { + view->connect(view, SIGNAL(loadProgress(int)), this, SLOT(loading(int))); + } + +private slots: + void loading(int progress) + { + if (progress >= 20 && progress < 90) { + QVERIFY(!m_executed); + m_view->stop(); + m_executed = true; + } + } +}; + + +// Should not crash. +void tst_QWebView::crashTests() +{ + // Test if loading can be stopped in loadProgress handler without crash. + // Test page should have frames. + QWebView view; + WebViewCrashTest tester(&view); + QUrl url("qrc:///data/index.html"); + view.load(url); + QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed. +} + + QTEST_MAIN(tst_QWebView) #include "tst_qwebview.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc new file mode 100644 index 0000000..ede34a9 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc @@ -0,0 +1,7 @@ + + + data/index.html + data/frame_a.html + + + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro index 81cc8f3..939cd22 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebplugindatabase qwebview qwebhistory +SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro -- cgit v0.12 From 29afcb69d6023aba012051bd2a026b57b3689732 Mon Sep 17 00:00:00 2001 From: Liang QI Date: Tue, 3 Nov 2009 12:05:50 +0100 Subject: Re-apply change 1db4a133a9d35e00bad50541fb8d64079a7debea by Liang QI Fix tst_qwebpage and tst_qwebframe compilation on Symbian. RevBy: TrustMe --- src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro | 2 +- src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 4 ++++ src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro | 2 +- src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index 0e540e5..b8734cd 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -5,7 +5,7 @@ SOURCES += tst_qwebframe.cpp RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/resources\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/resources\\\" symbian { TARGET.UID3 = 0xA000E53D diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 7cc62b0..6f07e90 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -38,6 +38,10 @@ #endif #include "../util.h" +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + //TESTED_CLASS= //TESTED_FILES= diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index 6b28efd..7853b28 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -5,7 +5,7 @@ SOURCES += tst_qwebpage.cpp RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian { TARGET.UID3 = 0xA000E53E diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 6cbe2b1..3eead92 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -37,6 +37,10 @@ #include #include +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + // Will try to wait for the condition while allowing event processing #define QTRY_COMPARE(__expr, __expected) \ do { \ -- cgit v0.12 From fdb9419f23d1cd2a9ddfc1f7e2fb58f6e845483b Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 13 Oct 2009 11:34:27 +0200 Subject: Re-apply change 2fbc823bb66db6ef6f6acc74d2baa96ebe1dec81 by Jocelyn Turcotte Re-apply change 6125aabeccb01a07c706fe4227279eb827e8e890 by Jocelyn Turcotte Re-apply change 6b8ac349b9a477863a8c8388dcc0658f3284bc54 by Jocelyn Turcotte Re-applying commit ee0a43fee20cc398b505eb65218ebed56dfc8f39 by Simon Hausmann Fix crash of QtScript on Mac OS X When compiling on 10.4 but running on 10.5 the flags passed to vm_map cause it to crash. For now fall back to the use of mmap() as allocator instead. Reviewed-by: Kent Hansen --- src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index b885049..8b647a0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -240,7 +240,9 @@ void Heap::destroy() template NEVER_INLINE CollectorBlock* Heap::allocateBlock() { -#if PLATFORM(DARWIN) + // Disable the use of vm_map for the Qt build on Darwin, because when compiled on 10.4 + // it crashes on 10.5 +#if PLATFORM(DARWIN) && !PLATFORM(QT) vm_address_t address = 0; // FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: . vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); @@ -332,7 +334,9 @@ NEVER_INLINE void Heap::freeBlock(size_t block) NEVER_INLINE void Heap::freeBlock(CollectorBlock* block) { -#if PLATFORM(DARWIN) + // Disable the use of vm_deallocate for the Qt build on Darwin, because when compiled on 10.4 + // it crashes on 10.5 +#if PLATFORM(DARWIN) && !PLATFORM(QT) vm_deallocate(current_task(), reinterpret_cast(block), BLOCK_SIZE); #elif PLATFORM(SYMBIAN) userChunk->Free(reinterpret_cast(block)); -- cgit v0.12 From b065fda13c29110fc81f77c9bbf1069d562b4d67 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 16 Oct 2009 14:30:39 +0200 Subject: Re-apply change 422c747c5108f9f0c544b5dd0789df32aa498fb7 by Martin Smith Re-apply change cef1901dbd96be81fc4139b50b094dfae5223e6f by Martin Smith Re-apply change 0f8bff1970d4b0f10e98ce7d6ab341620f4ce76b by Martin Smith doc: Changed Trolltech to Nokia --- src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 12b20ab..6623f24 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -70,7 +70,7 @@ void QWebViewPrivate::_q_pageDestroyed() It can be used in various applications to display web content live from the Internet. - The image below shows QWebView previewed in \QD with the Trolltech website. + The image below shows QWebView previewed in \QD with a Nokia website. \image qwebview-url.png -- cgit v0.12 From 62ed4c43c8c2fe3457de6d7570c2ae4a09a5ecf0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 23 Oct 2009 14:51:48 +0200 Subject: Re-apply change 914de965a8380e7620209c7b26e984ed9fbccc57 by David Boddie Re-apply change 37dc859e7e2e0f135e4c40bc7f6f824fcdb21e86 by David Boddie Doc: Fixed and synchronized QWebView related documentation. Reviewed-by: Trust Me --- .../webkit/WebKit/qt/Api/qgraphicswebview.cpp | 96 ++++++++++++++++++++-- src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 2 +- 2 files changed, 91 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index 50a0986..b22109b 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -164,17 +164,101 @@ void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s) /*! \class QGraphicsWebView - \brief The QGraphicsWebView class allows web content to be added to a GraphicsView. + \brief The QGraphicsWebView class allows Web content to be added to a GraphicsView. \since 4.6 - A WebGraphicsItem renders web content based on a URL or set data. + An instance of this class renders Web content from a URL or supplied as data, using + features of the QtWebKit module. - If the width and height of the item is not set, they will - dynamically adjust to a size appropriate for the content. - This width may be large (eg. 980) for typical online web pages. + If the width and height of the item is not set, they will dynamically adjust to + a size appropriate for the content. This width may be large (e.g., 980 pixels or + more) for typical online Web pages. + + \section1 Browser Features + + Many of the functions, signals and properties provided by QWebView are also available + for this item, making it simple to adapt existing code to use QGraphicsWebView instead + of QWebView. + + The item uses a QWebPage object to perform the rendering of Web content, and this can + be obtained with the page() function, enabling the document itself to be accessed and + modified. + + As with QWebView, the item records the browsing history using a QWebHistory object, + accessible using the history() function. The QWebSettings object that defines the + configuration of the browser can be obtained with the settings() function, enabling + features like plugin support to be customized for each item. + + \sa QWebView, QGraphicsTextItem +*/ + +/*! + \fn void QGraphicsWebView::titleChanged(const QString &title) + + This signal is emitted whenever the \a title of the main frame changes. + + \sa title() +*/ + +/*! + \fn void QGraphicsWebView::urlChanged(const QUrl &url) + + This signal is emitted when the \a url of the view changes. + + \sa url(), load() +*/ + +/*! + \fn void QGraphicsWebView::statusChanged() + + This signal is emitted when the status bar text is changed by the page. +*/ + +/*! + \fn void QGraphicsWebView::iconChanged() + + This signal is emitted whenever the icon of the page is loaded or changes. + + In order for icons to be loaded, you will need to set an icon database path + using QWebSettings::setIconDatabasePath(). + + \sa icon(), QWebSettings::setIconDatabasePath() +*/ + +/*! + \fn void QGraphicsWebView::loadStarted() + + This signal is emitted when a new load of the page is started. + + \sa progressChanged(), loadFinished() +*/ + +/*! + \fn void QGraphicsWebView::loadFinished(bool ok) + + This signal is emitted when a load of the page is finished. + \a ok will indicate whether the load was successful or any error occurred. + + \sa loadStarted() */ /*! + \fn void QGraphicsWebView::progressChanged(qreal progress) + + This signal is emitted every time an element in the web page + completes loading and the overall loading progress advances. + + This signal tracks the progress of all child frames. + + The current value is provided by \a progress and scales from 0.0 to 1.0, + which is the default range of QProgressBar. + + \sa loadStarted(), loadFinished() +*/ + + + +/*! Constructs an empty QGraphicsWebView with parent \a parent. \sa load() @@ -191,7 +275,7 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) } /*! - Destroys the web graphicsitem. + Destroys the item. */ QGraphicsWebView::~QGraphicsWebView() { diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 6623f24..55ce1f7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -974,7 +974,7 @@ void QWebView::changeEvent(QEvent *e) /*! \fn void QWebView::statusBarMessage(const QString& text) - This signal is emitted when the statusbar \a text is changed by the page. + This signal is emitted when the status bar \a text is changed by the page. */ /*! -- cgit v0.12 From 16d98a3fa8e5cf5f41e35e257b8791ce030a4ce1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 26 Oct 2009 10:56:57 +0100 Subject: Re-apply change cbb2efb13cdf05aabc245e2b0157883146cf069d by Thiago Macieira Re-apply change 3f7a99565de7ed17d7ac4c0a25b02997b094b1a9 by Thiago Macieira Fix linking of WebKit on Linux 32-bit. It was missing the ".text" directive at the top of the file, indicating that code would follow. Without it, the assembler created "NOTYPE" symbols, which would result in linker errors. --- src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index c999618..9fa898a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -75,7 +75,7 @@ namespace JSC { #define THUMB_FUNC_PARAM(name) #endif -#if PLATFORM(LINUX) && PLATFORM(X86_64) +#if PLATFORM(LINUX) && (PLATFORM(X86_64) || PLATFORM(X86)) #define SYMBOL_STRING_RELOCATION(name) #name "@plt" #else #define SYMBOL_STRING_RELOCATION(name) SYMBOL_STRING(name) @@ -93,6 +93,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x50, JITStackFrame_code_offset_matches_ctiTrampoline); asm volatile ( +".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushl %ebp" "\n" -- cgit v0.12 From 0951f86be22633e1ff763de935f9c35a20f8a575 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 26 Oct 2009 11:04:21 +0100 Subject: Re-apply change 7293097060383bcb75ee9f3e6a270de3b5bee2dc by Thiago Macieira Re-apply change e2ef97128c006ac2a5c99c67bb54eebaa3b45720 by Thiago Macieira Implement symbol hiding for JSC's JIT functions. These functions are implemented directly in assembly, so they need the proper directives to enable/disable visibility. On ELF systems, it's .hidden, whereas on Mach-O systems (Mac) it's .private_extern. On Windows, it's not necessary since you have to explicitly export. I also implemented the AIX idiom, though it's unlikely anyone will implement AIX/POWER JIT. That leaves only HP-UX on PA-RISC unimplemented, from the platforms that Qt supports. It's also unlikely that we'll imlpement JIT for it. Reviewed-by: Kent Hansen (this commit was 26d0990c66068bfc92a2ec77512b26d4a0c11b02, but was lost during a WebKit update) --- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 9fa898a..470ed0b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -81,6 +81,19 @@ namespace JSC { #define SYMBOL_STRING_RELOCATION(name) SYMBOL_STRING(name) #endif +#if PLATFORM(DARWIN) + // Mach-O platform +#define HIDE_SYMBOL(name) ".private_extern _" #name +#elif PLATFORM(AIX) + // IBM's own file format +#define HIDE_SYMBOL(name) ".lglobl " #name +#elif PLATFORM(LINUX) || PLATFORM(FREEBSD) || PLATFORM(OPENBSD) || PLATFORM(SOLARIS) || (PLATFORM(HPUX) && PLATFORM(IA64)) || PLATFORM(SYMBIAN) || PLATFORM(NETBSD) + // ELF platform +#define HIDE_SYMBOL(name) ".hidden " #name +#else +#define HIDE_SYMBOL(name) +#endif + #if USE(JSVALUE32_64) #if COMPILER(GCC) && PLATFORM(X86) @@ -95,6 +108,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x50, JITStackFrame_code_ asm volatile ( ".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushl %ebp" "\n" "movl %esp, %ebp" "\n" @@ -115,6 +129,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" #if !USE(JIT_STUB_ARGUMENT_VA_LIST) "movl %esp, %ecx" "\n" @@ -130,6 +145,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addl $0x3c, %esp" "\n" "popl %ebx" "\n" @@ -154,6 +170,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x80, JITStackFrame_code_ asm volatile ( ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushq %rbp" "\n" "movq %rsp, %rbp" "\n" @@ -180,6 +197,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "movq %rsp, %rdi" "\n" "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" @@ -195,6 +213,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addq $0x48, %rsp" "\n" "popq %rbx" "\n" @@ -216,6 +235,7 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" @@ -242,6 +262,7 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" @@ -347,7 +368,9 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x30, JITStackFrame_code_ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x1c, JITStackFrame_stub_argument_space_matches_ctiTrampoline); asm volatile ( +".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushl %ebp" "\n" "movl %esp, %ebp" "\n" @@ -368,6 +391,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" #if !USE(JIT_STUB_ARGUMENT_VA_LIST) "movl %esp, %ecx" "\n" @@ -383,6 +407,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addl $0x1c, %esp" "\n" "popl %ebx" "\n" @@ -405,7 +430,9 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x48, JITStackFrame_code_ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x78, JITStackFrame_stub_argument_space_matches_ctiTrampoline); asm volatile ( +".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "pushq %rbp" "\n" "movq %rsp, %rbp" "\n" @@ -439,6 +466,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "movq %rsp, %rdi" "\n" "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" @@ -454,6 +482,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "addq $0x78, %rsp" "\n" "popq %rbx" "\n" @@ -475,6 +504,7 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" @@ -501,6 +531,7 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" @@ -518,6 +549,7 @@ asm volatile ( ".text" "\n" ".align 2" "\n" ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" @@ -532,7 +564,9 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" #elif COMPILER(GCC) && PLATFORM(ARM_TRADITIONAL) asm volatile ( +".text\n" ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "stmdb sp!, {r1-r3}" "\n" "stmdb sp!, {r4-r8, lr}" "\n" @@ -549,12 +583,14 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "mov r0, sp" "\n" "bl " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" // Both has the same return sequence ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "add sp, sp, #36" "\n" "ldmia sp!, {r4-r8, lr}" "\n" @@ -889,6 +925,7 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD ".text" "\n" \ ".align 2" "\n" \ ".globl " SYMBOL_STRING(cti_##op) "\n" \ + HIDE_SYMBOL(cti_##op) "\n" \ ".thumb" "\n" \ ".thumb_func " THUMB_FUNC_PARAM(cti_##op) "\n" \ SYMBOL_STRING(cti_##op) ":" "\n" \ -- cgit v0.12 From 4f62d29e8ae464c223af5bc08ae219d9b198da63 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 26 Oct 2009 17:35:17 +0100 Subject: Re-apply change b4be512bffba65bf4577a2b8275d7c38ce5501a1 by David Boddie Re-apply change 6f36d0aafaccbb9affe8ac1b82c225d985aa7491 by David Boddie Doc: Added internal or hidden placeholder documentation. Reviewed-by: Trust Me To-be-completed-by: QtWebKit developers --- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 5402ab1..a1e131a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -2763,6 +2763,17 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) as a result of the user clicking on a "file upload" button in a HTML form where multiple file selection is allowed. + \omitvalue ErrorPageExtension (introduced in Qt 4.6) +*/ + +/*! + \enum QWebPage::ErrorDomain + \since 4.6 + \internal + + \value QtNetwork + \value Http + \value WebKit */ /*! @@ -2813,6 +2824,12 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) */ /*! + \fn QWebPage::ErrorPageExtensionReturn::ErrorPageExtensionReturn() + + Constructs a new error page object. +*/ + +/*! \class QWebPage::ChooseMultipleFilesExtensionOption \since 4.5 \brief The ChooseMultipleFilesExtensionOption class describes the option -- cgit v0.12 From 914d5847532a85a564a5df4a2bc8bdccb0f91abb Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 28 Oct 2009 08:52:30 +0100 Subject: Re-apply change cadd19cd98b9a6ff7ff8755f7774027400aadb0f by Shane Kearns Re-apply change 6bc9ef388590b4bfb281d2e1510dc7c3d1837349 by Shane Kearns Fix to 8e0fbc2caa3edefb78d6667721235b783bc1a850 This version of the fix will set the def file only if defblock is enabled in qbase.pri. That means that def files don't get turned on for webkit but not for the whole project (avoids build failures in the continuous integration system when other teams change the exported symbols) Reviewed-by: Jason Barron --- src/3rdparty/webkit/WebCore/WebCore.pro | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 60e414f..4e84a80 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -3381,3 +3381,18 @@ CONFIG(QTDIR_build):isEqual(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 4 plugins/win/PaintHooks.asm } } + +# Temporary workaround to pick up the DEF file from the same place as all the others +symbian { + shared { + contains(MMP_RULES, defBlock) { + MMP_RULES -= defBlock + + MMP_RULES += "$${LITERAL_HASH}ifdef WINSCW" \ + "DEFFILE ../../../s60installs/bwins/$${TARGET}.def" \ + "$${LITERAL_HASH}elif defined EABI" \ + "DEFFILE ../../../s60installs/eabi/$${TARGET}.def" \ + "$${LITERAL_HASH}endif" + } + } +} -- cgit v0.12 From 2a9596d85a6c44fe1eba98447ab95ca913f10e29 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 27 Oct 2009 16:19:19 +0100 Subject: Re-apply change 62923e7edacf6a1d28accaff70cbdc0176890d62 by Joerg Bornemann Re-apply change fa1856bcb2eff41dadf0900202dd43f44ddb2343 by Joerg Bornemann WebKit compile fix for Windows CE Not sure if this is right fix. We could also disable PLUGIN_PACKAGE_SIMPLE_HASH. But this is automatically enabled when NETSCAPE_PLUGIN_API is disabled. Reviewed-by: thartman --- src/3rdparty/webkit/WebCore/platform/FileSystem.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/3rdparty/webkit/WebCore/platform/FileSystem.h b/src/3rdparty/webkit/WebCore/platform/FileSystem.h index 9952b39..791198d 100644 --- a/src/3rdparty/webkit/WebCore/platform/FileSystem.h +++ b/src/3rdparty/webkit/WebCore/platform/FileSystem.h @@ -98,6 +98,17 @@ struct PlatformModuleVersion { { } + bool operator != (const PlatformModuleVersion& rhs) const + { + return mostSig != rhs.mostSig && leastSig != rhs.leastSig; + } + + + bool operator > (const PlatformModuleVersion& rhs) const + { + return mostSig > rhs.mostSig && leastSig > rhs.leastSig; + } + }; #else typedef unsigned PlatformModuleVersion; -- cgit v0.12 From e3500ec7fb8c17c33345142a22eeef8e467564cd Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 4 Nov 2009 18:29:50 +0000 Subject: Fix for link error when building QtSvg Building QtSvg for Symbian (ARMV5 build) fails due to the following linker error: QGraphicsEffectSourcePrivate::invalidateCache(bool) const (referred from qsvgwidget.o). This function is called from the inline destructor of QGraphicsEffectSourcePrivate. Making this destructor non-inline fixes the problem. It is not clear why QtSvg is instantiating this destructor, however, as neither QGraphicsEffectSourcePrivate nor any of its derived classes are referred to from QtSvg source. This problem seems to have been triggered by 85e41590. Reviewed-by: Shane Kearns --- src/gui/effects/qgraphicseffect.cpp | 5 +++++ src/gui/effects/qgraphicseffect_p.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 83f4f79..b170254 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -303,6 +303,11 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse return pm; } +QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate() +{ + invalidateCache(); +} + void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const { if (effectRectChanged && m_cachedMode != QGraphicsEffectSource::ExpandToEffectRectPadMode) diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 0ff5794..370efdd 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -72,7 +72,7 @@ public: , m_cachedMode(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) {} - virtual ~QGraphicsEffectSourcePrivate() { invalidateCache(); } + virtual ~QGraphicsEffectSourcePrivate(); virtual void detach() = 0; virtual QRectF boundingRect(Qt::CoordinateSystem system) const = 0; virtual QRect deviceRect() const = 0; -- cgit v0.12 From c1eae9d5842c73719d7719cccc4beca55711714d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 4 Nov 2009 19:35:37 +0100 Subject: Doc: Fixed qdoc warnings. Reviewed-by: Trust Me --- doc/src/examples/ftp.qdoc | 12 ++++++------ doc/src/getting-started/examples.qdoc | 2 +- doc/src/network-programming/qtnetwork.qdoc | 4 ++-- src/dbus/qdbusservicewatcher.cpp | 10 +++++----- src/gui/graphicsview/qgraphicslinearlayout.cpp | 3 +++ src/gui/kernel/qevent.cpp | 5 +++-- src/gui/kernel/qgesture.cpp | 20 ++++++++++---------- src/gui/s60framework/qs60mainappui.cpp | 2 ++ src/gui/styles/qstyleoption.cpp | 5 +++-- src/network/socket/qabstractsocket.cpp | 6 +++--- src/network/ssl/qsslsocket.cpp | 10 ++++++++-- 11 files changed, 46 insertions(+), 33 deletions(-) diff --git a/doc/src/examples/ftp.qdoc b/doc/src/examples/ftp.qdoc index 8fded88..68fb0d7 100644 --- a/doc/src/examples/ftp.qdoc +++ b/doc/src/examples/ftp.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \example network/ftp + \example network/qftp \title FTP Example The FTP example demonstrates a simple FTP client that can be used @@ -90,12 +90,12 @@ the FTP server, and registers whether an entry represents a directory or a file. We use the QFile object to download files from the FTP server. - + \section1 FtpWindow Class Implementation We skip the \c FtpWindow constructor as it only contains code for setting up the GUI, which is explained in other examples. - + We move on to the slots, starting with \c connectOrDisconnect(). \snippet examples/network/qftp/ftpwindow.cpp 0 @@ -137,7 +137,7 @@ \snippet examples/network/qftp/ftpwindow.cpp 3 \dots \snippet examples/network/qftp/ftpwindow.cpp 4 - + We first fetch the name of the file, which we find in the selected item of \c fileList. We then start the download by using QFtp::get(). QFtp will send progress signals during the download @@ -153,7 +153,7 @@ finished a QFtp::Command. If an error occurred during the command, QFtp will set \c error to one of the values in the QFtp::Error enum; otherwise, \c error is zero. - + \snippet examples/network/qftp/ftpwindow.cpp 7 After login, the QFtp::list() function will list the top-level @@ -165,7 +165,7 @@ When a \l{QFtp::}{Get} command is finished, a file has finished downloading (or an error occurred during the download). - + \snippet examples/network/qftp/ftpwindow.cpp 9 After a \l{QFtp::}{List} command is performed, we have to check if diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 05940e4..79cbe89 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -729,7 +729,7 @@ \o \l{network/network-chat}{Network Chat} \o \l{network/fortuneclient}{Fortune Client}\raisedaster \o \l{network/fortuneserver}{Fortune Server}\raisedaster - \o \l{network/ftp}{FTP}\raisedaster + \o \l{network/qftp}{FTP}\raisedaster \o \l{network/http}{HTTP} \o \l{network/loopback}{Loopback} \o \l{network/threadedfortuneserver}{Threaded Fortune Server}\raisedaster diff --git a/doc/src/network-programming/qtnetwork.qdoc b/doc/src/network-programming/qtnetwork.qdoc index d9377fb..c20adaf 100644 --- a/doc/src/network-programming/qtnetwork.qdoc +++ b/doc/src/network-programming/qtnetwork.qdoc @@ -101,7 +101,7 @@ Each application or library can create one or more instances of QNetworkAccessManager to handle network communication. - + \section1 Writing FTP Clients with QFtp FTP (File Transfer Protocol) is a protocol used almost exclusively @@ -155,7 +155,7 @@ commands based on the result of a previous command. It also enables you to provide detailed feedback to the user. - The \l{network/ftp}{FTP} example + The \l{network/qftp}{FTP} example illustrates how to write an FTP client. Writing your own FTP (or HTTP) server is possible using the lower-level classes QTcpSocket and QTcpServer. diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp index 4872732..115fe3e 100644 --- a/src/dbus/qdbusservicewatcher.cpp +++ b/src/dbus/qdbusservicewatcher.cpp @@ -150,14 +150,14 @@ void QDBusServiceWatcherPrivate::removeService(const QString &service) modes: \list - \o watching for service registration only - \o watching for service unregistration only - \o watching for any kind of service ownership change (the default mode) + \o Watching for service registration only. + \o Watching for service unregistration only. + \o Watching for any kind of service ownership change (the default mode). \endlist Besides being created or deleted, services may change owners without a - unregister/register operation happening. So the \ref serviceRegistered() - and \ref serviceUnregistered() signals may not be emitted if that + unregister/register operation happening. So the serviceRegistered() + and serviceUnregistered() signals may not be emitted if that happens. This class is more efficient than using the diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 5684f0e..cb68741 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -542,6 +542,9 @@ void QGraphicsLinearLayout::invalidate() QGraphicsLayout::invalidate(); } +/*! + \internal +*/ void QGraphicsLinearLayout::dump(int indent) const { #ifdef QT_DEBUG diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 55a329c..31bd83f 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4344,8 +4344,9 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const Sets the accept flag of the given \a gestureType object to the specified \a value. - Setting the accept flag indicates that the event receiver wants the \a gesture. - Unwanted gestures may be propagated to the parent widget. + Setting the accept flag indicates that the event receiver wants to receive + gestures of the specified type. Unwanted gestures may be propagated to the + parent widget. By default, gestures in events of type QEvent::Gesture are accepted, and gestures in QEvent::GestureOverride events are ignored. diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 850f22c..c121bad 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -174,6 +174,16 @@ void QGesture::unsetHotSpot() } /*! + \property QGesture::gestureCancelPolicy + \brief the policy for deciding what happens on accepting a gesture + + On accepting one gesture Qt can automatically cancel other gestures + that belong to other targets. The policy is normally set to not cancel + any other gestures and can be set to cancel all active gestures in the + context. For example for all child widgets. +*/ + +/*! \enum QGesture::GestureCancelPolicy This enum describes how accepting a gesture can cancel other gestures @@ -217,16 +227,6 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const */ /*! - \property QGesture::GestureCancelPolicy - \brief the policy for deciding what happens on accepting a gesture - - On accepting one gesture Qt can automatically cancel other gestures - that belong to other targets. The policy is normally set to not cancel - any other gestures and can be set to cancel all active gestures in the - context. For example for all child widgets. -*/ - -/*! \property QPanGesture::lastOffset \brief the last offset recorded for this gesture diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 4ad78f9..33c39e6 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -161,6 +161,8 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type) } /*! + * \fn void QS60MainAppUi::HandleWsEventL(const TWsEvent &event, CCoeControl *destination) + * * \brief Handles raw window server events. * * The event type and information is passed in \a event, while the receiving control is passed in diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp index f5a2b94..d73a563 100644 --- a/src/gui/styles/qstyleoption.cpp +++ b/src/gui/styles/qstyleoption.cpp @@ -4736,8 +4736,9 @@ QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTab QStyleOptionFrame types. If the \a{other} style option's version is 1, this style option's - \l FrameFeature value is set to \l QStyleOptionFrameV2::None. If - its version is 2, its \l FrameFeature value is simply copied to + QStyleOptionFrameV2::FrameFeature value is set to + QStyleOptionFrameV2::None. If its version is 2, its + \l{QStyleOptionFrameV2::}{FrameFeature} value is simply copied to this style option. */ QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QStyleOptionTabWidgetFrame &other) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 89a6e91..8b4f364 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1589,10 +1589,10 @@ bool QAbstractSocket::setSocketDescriptor(int socketDescriptor, SocketState sock } /*! - Sets the option \a option to the value described by \a value. + \since 4.6 + Sets the given \a option to the value described by \a value. \sa socketOption() - \since 4.6 */ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) { @@ -1618,10 +1618,10 @@ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, cons } /*! + \since 4.6 Returns the value of the \a option option. \sa setSocketOption() - \since 4.6 */ QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option) { diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index cfa99c8..e53d8a4 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -468,7 +468,10 @@ bool QSslSocket::setSocketDescriptor(int socketDescriptor, SocketState state, Op } /*! - \reimp + \since 4.6 + Sets the given \a option to the value described by \a value. + + \sa socketOption() */ void QSslSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) { @@ -478,7 +481,10 @@ void QSslSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVa } /*! - \reimp + \since 4.6 + Returns the value of the \a option option. + + \sa setSocketOption() */ QVariant QSslSocket::socketOption(QAbstractSocket::SocketOption option) { -- cgit v0.12 From eda773316824cbb1aa7bdba402e568340b79b4f3 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 4 Nov 2009 18:42:33 +0000 Subject: tst_qwidget widgetAt now does not leave widget lowered if test fails Task-number: QTBUG-5396 Reviewed-by: axis --- tests/auto/qwidget/tst_qwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 3d801cc..e027dd1 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -3328,9 +3328,10 @@ void tst_QWidget::widgetAt() w2->lower(); qApp->processEvents(); QTRY_VERIFY((wr = QApplication::widgetAt(100, 100))); - QCOMPARE(wr->objectName(), QString("w1")); - + const bool match = (wr->objectName() == QString("w1")); w2->raise(); + QVERIFY(match); + qApp->processEvents(); QTRY_VERIFY((wr = QApplication::widgetAt(100, 100))); QCOMPARE(wr->objectName(), QString("w2")); -- cgit v0.12 From 4dbc0d34657bff0166ff6984e91a38b79e59e107 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 4 Nov 2009 19:55:27 +0100 Subject: Added changes to ChangeLog. --- dist/changes-4.6.0 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 6a1f6f9..627760a 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -69,11 +69,14 @@ QtGui - QTreeView * [234930] Be able to use :has-children and :has-sibillings in a stylesheet - * [252616] Set QStyleOptionViewItemV4::OnlyOne flag when painting spanning collumns + * [252616] Set QStyleOptionViewItemV4::OnlyOne flag when painting spanning columns - QTableView + * [191545] Selections work more similarly to well-known spreadsheets * [234926] Fixed sorting after changing QTableView header - * [244651] Speed up table view with many spans + * [244651] [245327] [250193] [QTBUG-5062] Spans get plenty of love with + speed-up, support for rows/columns insertion/removal, and better keyboard + navigation - QTabBar * [196326] Fixed having a stylesheet on a QTabBar resulted in some tab names -- cgit v0.12 From 391441b2ce2be527db0829798631436670df0965 Mon Sep 17 00:00:00 2001 From: gunnar Date: Wed, 4 Nov 2009 19:38:01 +0100 Subject: Added some helpful info to QBrush and QPen's QDebug operators Reviewed-by: TrustMe --- src/gui/painting/qbrush.cpp | 24 +++++++++++++++++++++++- src/gui/painting/qpen.cpp | 12 +++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index cbfbba6..6f5d892 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -970,7 +970,29 @@ bool QBrush::operator==(const QBrush &b) const QDebug operator<<(QDebug dbg, const QBrush &b) { #ifndef Q_BROKEN_DEBUG_STREAM - dbg.nospace() << "QBrush(" << b.color() << ',' << b.style() << ')'; + char *BRUSH_STYLES[] = { + "NoBrush", + "SolidPattern", + "Dense1Pattern", + "Dense2Pattern", + "Dense3Pattern", + "Dense4Pattern", + "Dense5Pattern", + "Dense6Pattern", + "Dense7Pattern", + "HorPattern", + "VerPattern", + "CrossPattern", + "BDiagPattern", + "FDiagPattern", + "DiagCrossPattern", + "LinearGradientPattern", + "RadialGradientPattern", + "ConicalGradientPattern", + "TexturePattern" + }; + + dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')'; return dbg.space(); #else qWarning("This compiler doesn't support streaming QBrush to QDebug"); diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 41efc80..9746747 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -983,8 +983,18 @@ QDataStream &operator>>(QDataStream &s, QPen &p) QDebug operator<<(QDebug dbg, const QPen &p) { #ifndef Q_BROKEN_DEBUG_STREAM + char *PEN_STYLES[] = { + "NoPen", + "SolidLine", + "DashLine", + "DotLine", + "DashDotLine", + "DashDotDotLine", + "CustomDashLine" + }; + dbg.nospace() << "QPen(" << p.width() << ',' << p.brush() - << ',' << int(p.style()) << ',' << int(p.capStyle()) + << ',' << PEN_STYLES[p.style()] << ',' << int(p.capStyle()) << ',' << int(p.joinStyle()) << ',' << p.dashPattern() << ',' << p.dashOffset() << ',' << p.miterLimit() << ')'; -- cgit v0.12 From 1a71e4b7960ba27fe6d47815da9337020085ac16 Mon Sep 17 00:00:00 2001 From: gunnar Date: Wed, 4 Nov 2009 21:02:10 +0100 Subject: Made QPen== catch QPen(Qt::NoPen) == QPen(QBrush(Qt::NoBrush)) QSvgDocument uses the latter as default pen so every svg filling command would issue a penChange without this. Reviewed-by: TrustMe --- src/gui/painting/qpen.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 9746747..1ddadf2 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -835,16 +835,19 @@ bool QPen::operator==(const QPen &p) const { QPenData *dd = static_cast(d); QPenData *pdd = static_cast(p.d); - return (p.d == d) || (p.d->style == d->style - && p.d->capStyle == d->capStyle - && p.d->joinStyle == d->joinStyle - && p.d->width == d->width - && pdd->miterLimit == dd->miterLimit - && (d->style != Qt::CustomDashLine - || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) && - pdd->dashPattern == dd->dashPattern)) - && p.d->brush == d->brush - && pdd->cosmetic == dd->cosmetic); + return (p.d == d) + || (p.d->style == d->style + && p.d->capStyle == d->capStyle + && p.d->joinStyle == d->joinStyle + && p.d->width == d->width + && pdd->miterLimit == dd->miterLimit + && (d->style != Qt::CustomDashLine + || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) && + pdd->dashPattern == dd->dashPattern)) + && p.d->brush == d->brush + && pdd->cosmetic == dd->cosmetic) + || ((p.d->style == Qt::NoPen || p.d->brush.style() == Qt::NoBrush) + && (d->style == Qt::NoPen || d->brush.style() == Qt::NoBrush)); } -- cgit v0.12 From 23572588c4b0c759c14a6c1687e5bd86461e31e8 Mon Sep 17 00:00:00 2001 From: gunnar Date: Wed, 4 Nov 2009 21:06:29 +0100 Subject: Fixed some debug and some minor optims to QPaintBuffer Reviewed-by: TrustMe --- src/gui/painting/qpaintbuffer.cpp | 95 +++++++++++++++++++++++---------------- src/gui/painting/qpaintbuffer_p.h | 5 ++- 2 files changed, 60 insertions(+), 40 deletions(-) diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index 6b9d77c..b8700c3 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -48,7 +48,7 @@ #include -//#define QPAINTBUFFER_DEBUG_DRAW +// #define QPAINTBUFFER_DEBUG_DRAW QT_BEGIN_NAMESPACE @@ -247,23 +247,24 @@ void QPaintBuffer::draw(QPainter *painter, int frame) const #ifdef QPAINTBUFFER_DEBUG_DRAW qDebug() << "QPaintBuffer::draw() --------------------------------"; -// printf("Float buffer:"); -// for (int i=0; ifloats.size(); i++) { -// if ((i % 10) == 0) { -// printf("\n%4d-%4d: ", i, i+9); -// } -// printf("%4.2f ", d->floats[i]); -// } -// printf("\n"); - -// printf("Int Buffer:"); -// for (int i=0; iints.size(); i++) { -// if ((i % 10) == 0) { -// printf("\n%4d-%4d: ", i, i+10); -// } -// printf("%5d", d->ints[i]); -// } -// printf("\n"); + Q_D(const QPaintBuffer); + printf("Float buffer:"); + for (int i=0; ifloats.size(); i++) { + if ((i % 10) == 0) { + printf("\n%4d-%4d: ", i, i+9); + } + printf("%4.2f ", d->floats[i]); + } + printf("\n"); + + printf("Int Buffer:"); + for (int i=0; iints.size(); i++) { + if ((i % 10) == 0) { + printf("\n%4d-%4d: ", i, i+10); + } + printf("%5d", d->ints[i]); + } + printf("\n"); #endif if (painter && !painter->isActive()) @@ -406,16 +407,17 @@ void QPaintBufferEngine::clipEnabledChanged() void QPaintBufferEngine::penChanged() { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine:" << state()->pen; -#endif const QPen &pen = state()->pen; if (!buffer->commands.isEmpty() && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetPen) { +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << "QPaintBufferEngine: penChanged (compressed)" << state()->pen; +#endif buffer->variants[buffer->commands.last().offset] = pen; return; } + if (buffer->calculateBoundingRect) { if (pen.style() == Qt::NoPen) { buffer->penWidthAdjustment = 0; @@ -427,22 +429,28 @@ void QPaintBufferEngine::penChanged() buffer->penWidthAdjustment = transformedWidth.x() / 2.0; } } +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << "QPaintBufferEngine: penChanged" << state()->pen; +#endif buffer->addCommand(QPaintBufferPrivate::Cmd_SetPen, pen); } void QPaintBufferEngine::brushChanged() { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine:" << state()->brush; -#endif const QBrush &brush = state()->brush; if (!buffer->commands.isEmpty() && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetBrush) { +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << "QPaintBufferEngine: brushChanged (compressed)" << state()->brush; +#endif buffer->variants[buffer->commands.last().offset] = brush; return; } +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << "QPaintBufferEngine: brushChanged" << state()->brush; +#endif buffer->addCommand(QPaintBufferPrivate::Cmd_SetBrush, brush); } @@ -488,14 +496,14 @@ void QPaintBufferEngine::transformChanged() if (!buffer->commands.isEmpty() && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetTransform) { #ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: compressing " << state()->matrix; + qDebug() << "QPaintBufferEngine: transformChanged (compressing) " << state()->matrix; #endif buffer->variants[buffer->commands.last().offset] = state()->matrix; return; } #ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: " << state()->matrix; + qDebug() << "QPaintBufferEngine: transformChanged:" << state()->matrix; #endif buffer->addCommand(QPaintBufferPrivate::Cmd_SetTransform, state()->matrix); } @@ -514,7 +522,18 @@ void QPaintBufferEngine::draw(const QVectorPath &path) #ifdef QPAINTBUFFER_DEBUG_DRAW qDebug() << "QPaintBufferEngine: draw vpath:" << path.elementCount(); #endif - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawVectorPath, path); + + bool hasBrush = qbrush_style(state()->brush) != Qt::NoBrush; + bool hasPen = qpen_style(state()->pen) != Qt::NoPen + && qbrush_style(qpen_brush(state()->pen)) != Qt::NoBrush; + + if (hasPen || hasBrush) + buffer->addCommand(QPaintBufferPrivate::Cmd_DrawVectorPath, path); +#ifdef QPAINTBUFFER_DEBUG_DRAW + else + qDebug() << " - no pen or brush active, discarded...\n"; +#endif + // if (buffer->calculateBoundingRect) { // QRealRect r = path.controlPointRect(); // buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1)); @@ -745,15 +764,15 @@ void QPaintBufferEngine::drawEllipse(const QRect &r) void QPaintBufferEngine::drawPath(const QPainterPath &path) { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawPath: element count:" << path.elementCount(); -#endif - // ### Path -> QVariant - // buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPath, QVariant(path)); +// #ifdef QPAINTBUFFER_DEBUG_DRAW +// qDebug() << "QPaintBufferEngine: drawPath: element count:" << path.elementCount(); +// #endif +// // ### Path -> QVariant +// // buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPath, QVariant(path)); QPaintEngineEx::drawPath(path); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(path.boundingRect()); +// if (buffer->calculateBoundingRect) +// buffer->updateBoundingRect(path.boundingRect()); } void QPaintBufferEngine::drawPoints(const QPoint *points, int pointCount) @@ -1424,10 +1443,6 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd) QTextItemInt &ti = (*tiCopy)(); QString text(ti.text()); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawTextItem:" << pos << " " << text << " " << scaleFactor; -#endif - QFont font(ti.font()); font.setUnderline(false); font.setStrikeOut(false); @@ -1439,6 +1454,10 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd) justificationWidth = si.width.toReal(); qreal scaleFactor = font.d->dpi/qreal(qt_defaultDpiY()); +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << " -> Cmd_DrawTextItem:" << pos << " " << text << " " << scaleFactor; +#endif + if (scaleFactor != 1.0) { QFont fnt(font); QFakeDevice fake; diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h index 6a7ac73..adf0564 100644 --- a/src/gui/painting/qpaintbuffer_p.h +++ b/src/gui/painting/qpaintbuffer_p.h @@ -66,6 +66,7 @@ class QPaintBufferPlayback; class Q_GUI_EXPORT QPaintBuffer : public QPaintDevice { + Q_DECLARE_PRIVATE(QPaintBuffer); public: QPaintBuffer(); QPaintBuffer(const QPaintBuffer &other); @@ -311,7 +312,7 @@ public: virtual ~QPainterReplayer() { } void setupTransform(QPainter *painter); - void process(const QPaintBufferCommand &cmd); + virtual void process(const QPaintBufferCommand &cmd); void draw(const QPaintBuffer &buffer, QPainter *painter, int frame); protected: @@ -326,7 +327,7 @@ class Q_GUI_EXPORT QPaintEngineExReplayer : public QPainterReplayer public: QPaintEngineExReplayer() { } - void process(const QPaintBufferCommand &cmd); + virtual void process(const QPaintBufferCommand &cmd); }; class QPaintBufferEnginePrivate; -- cgit v0.12 From 6b448660f0d967d2749a520b49aa6946e46bff6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 4 Nov 2009 20:28:55 +0100 Subject: Further fixes to file size handling on Windows with fd and FILE* filelength is not available on Windows CE instead, we must fallback to fseek/ftell as was being done previously. Still on Windows CE, we still don't report the file size for file descriptors, but we also won't set a random error string. Changed qt_error_string calls to use errno when errors come from CRT functions. Also, if we're using filelength on FILE* streams, there's no reason not to use it for file descriptors, instead of requesting a native handle. Reviewed-by: Olivier Goffart --- src/corelib/io/qfsfileengine_win.cpp | 43 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 9fc4500..a6cb5a9 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -497,11 +497,30 @@ qint64 QFSFileEnginePrivate::nativeSize() const // ### Don't flush; for buffered files, we should get away with ftell. thatQ->flush(); +#if !defined(Q_OS_WINCE) + // stdlib/stdio mode. + if (fh || fd != -1) { + qint64 fileSize = _filelengthi64(fh ? QT_FILENO(fh) : fd); + if (fileSize == -1) { + fileSize = 0; + thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno)); + } + return fileSize; + } +#else // Q_OS_WINCE // Buffered stdlib mode. if (fh) { - qint64 fileSize = _filelengthi64(QT_FILENO(fh)); - return (fileSize == -1) ? 0 : fileSize; + QT_OFF_T oldPos = QT_FTELL(fh); + QT_FSEEK(fh, 0, SEEK_END); + qint64 fileSize = (qint64)QT_FTELL(fh); + QT_FSEEK(fh, oldPos, SEEK_SET); + if (fileSize == -1) { + fileSize = 0; + thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno)); + } + return fileSize; } +#endif // Not-open mode, where the file name is known: We'll check the // file system directly. @@ -541,23 +560,13 @@ qint64 QFSFileEnginePrivate::nativeSize() const return 0; } - // Unbuffed stdio mode. - if(fd != -1) { -#if !defined(Q_OS_WINCE) - HANDLE handle = (HANDLE)_get_osfhandle(fd); - if (handle != INVALID_HANDLE_VALUE) { - BY_HANDLE_FILE_INFORMATION fileInfo; - if (GetFileInformationByHandle(handle, &fileInfo)) { - qint64 size = fileInfo.nFileSizeHigh; - size <<= 32; - size += fileInfo.nFileSizeLow; - return size; - } - } -#endif - thatQ->setError(QFile::UnspecifiedError, qt_error_string()); +#if defined(Q_OS_WINCE) + // Unbuffed stdio mode + if (fd != -1) { + thatQ->setError(QFile::UnspecifiedError, QLatin1String("Not implemented!")); return 0; } +#endif // Windows native mode. if (fileHandle == INVALID_HANDLE_VALUE) -- cgit v0.12 From 49664f3ccc691e1be608fb8f922bda565da0fdab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 4 Nov 2009 21:36:42 +0100 Subject: Updating documentation to reflect actual behavior QFile::seek is supposed to work on Windows CE with FILE* streams. size() returns 0 on errors and sequential files. Probably on empty files as well ;-) Reviewed-by: Olivier Goffart --- src/corelib/io/qfile.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 4dd6185..c9b2603 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1020,14 +1020,15 @@ bool QFile::open(OpenMode mode) \bold{Warning:} \list 1 - \o If \a fh is \c stdin, \c stdout, or \c stderr, you may not be able - to seek(). See QIODevice::isSequential() for more information. + \o If \a fh does not refer to a regular file, e.g., it is \c stdin, + \c stdout, or \c stderr, you may not be able to seek(). size() + returns \c 0 in those cases. See QIODevice::isSequential() for + more information. \o Since this function opens the file without specifying the file name, you cannot use this QFile with a QFileInfo. \endlist - \note For Windows CE you may not be able to call seek() and resize(). - Also, size() is set to \c 0. + \note For Windows CE you may not be able to call resize(). \sa close(), {qmake Variable Reference#CONFIG}{qmake Variable Reference} @@ -1081,7 +1082,7 @@ bool QFile::open(FILE *fh, OpenMode mode) /*! \overload - Opens the existing file descripter \a fd in the given \a mode. + Opens the existing file descriptor \a fd in the given \a mode. Returns true if successful; otherwise returns false. When a QFile is opened using this function, close() does not @@ -1092,12 +1093,13 @@ bool QFile::open(FILE *fh, OpenMode mode) are slow. If you run into performance issues, you should try to use one of the other open functions. - \warning If \a fd is 0 (\c stdin), 1 (\c stdout), or 2 (\c - stderr), you may not be able to seek(). size() is set to \c - LLONG_MAX (in \c ). + \warning If \a fd is not a regular file, e.g, it is 0 (\c stdin), + 1 (\c stdout), or 2 (\c stderr), you may not be able to seek(). In + those cases, size() returns \c 0. See QIODevice::isSequential() + for more information. \warning For Windows CE you may not be able to call seek(), setSize(), - fileTime(). size() is set to \c 0. + fileTime(). size() returns \c 0. \warning Since this function opens the file without specifying the file name, you cannot use this QFile with a QFileInfo. -- cgit v0.12 From 7940327801724560b9193fef1b5d849412fbd6f3 Mon Sep 17 00:00:00 2001 From: Artur Duque de Souza Date: Wed, 4 Nov 2009 12:56:16 -0300 Subject: Add min/pref/max size properties to QGraphicsWidget QGraphicsLayouts and specially QGraphicsAnchorLayout makes large use of min/pref/max sizes. Making it properties allow QtScript bindings to take advantage of this and eases the use of Anchor Layout on this cases. The first use case for this patch was the use that Plasma makes of it on it's javascript engine. Signed-off-by: Artur Duque de Souza --- src/gui/graphicsview/qgraphicswidget.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 9c71140..38f72f0 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -74,6 +74,9 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) Q_PROPERTY(QSizeF size READ size WRITE resize) + Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize) + Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize) + Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize) Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) -- cgit v0.12 From ff5becbd4dafbabb79c086dc0cc18111d9e82a15 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Tue, 27 Oct 2009 16:04:10 -0300 Subject: QGAL: keep references to layout vertices We used to keep a reference just to the first vertex of the layout (corresponding to the left/top anchor point) inside the Graph class, as "root vertex". Since the notion of rootVertex isn't used by the Graph itself, now this is stored outside the graph, and we also store the central and last vertices. This avoids using internalVertex() function to find out the vertices based on the item (in the case, the 'q'). This will be useful when we do simplify vertices, since the original layout vertice might not be the "layout vertice" in the graph. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraph_p.h | 12 ----- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 61 ++++++++++++++---------- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 4 ++ 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/src/gui/graphicsview/qgraph_p.h b/src/gui/graphicsview/qgraph_p.h index f1fa185..b5b3c88 100644 --- a/src/gui/graphicsview/qgraph_p.h +++ b/src/gui/graphicsview/qgraph_p.h @@ -201,11 +201,6 @@ public: return l; } - void setRootVertex(Vertex *vertex) - { - userVertex = vertex; - } - QSet vertices() const { QSet setOfVertices; for (const_iterator it = constBegin(); it != constEnd(); ++it) { @@ -256,11 +251,6 @@ public: } #endif - Vertex *rootVertex() const - { - return userVertex; - } - protected: void createDirectedEdge(Vertex *from, Vertex *to, EdgeData *data) { @@ -286,8 +276,6 @@ protected: } private: - Vertex *userVertex; - QHash *> m_graph; }; diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 41aa8aa..6bffd09 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -484,6 +484,10 @@ QGraphicsAnchorLayoutPrivate::QGraphicsAnchorLayoutPrivate() spacings[i] = -1; graphSimplified[i] = false; graphHasConflicts[i] = false; + + layoutFirstVertex[i] = 0; + layoutCentralVertex[i] = 0; + layoutLastVertex[i] = 0; } } @@ -663,7 +667,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation) orientation == Horizontal ? "Horizontal" : "Vertical"); #endif - if (!graph[orientation].rootVertex()) + if (!layoutFirstVertex[orientation]) return true; bool dirty; @@ -700,7 +704,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP QSet visited; QStack > stack; - stack.push(qMakePair(static_cast(0), g.rootVertex())); + stack.push(qMakePair(static_cast(0), layoutFirstVertex[orientation])); QVector candidates; bool candidatesForward; @@ -959,9 +963,10 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() data->maxSize = QWIDGETSIZE_MAX; data->skipInPreferred = 1; - // Set the Layout Left edge as the root of the horizontal graph. - AnchorVertex *v = internalVertex(layout, Qt::AnchorLeft); - graph[Horizontal].setRootVertex(v); + // Save a reference to layout vertices + layoutFirstVertex[Horizontal] = internalVertex(layout, Qt::AnchorLeft); + layoutCentralVertex[Horizontal] = 0; + layoutLastVertex[Horizontal] = internalVertex(layout, Qt::AnchorRight); // Vertical data = new AnchorData; @@ -970,9 +975,10 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() data->maxSize = QWIDGETSIZE_MAX; data->skipInPreferred = 1; - // Set the Layout Top edge as the root of the vertical graph. - v = internalVertex(layout, Qt::AnchorTop); - graph[Vertical].setRootVertex(v); + // Save a reference to layout vertices + layoutFirstVertex[Vertical] = internalVertex(layout, Qt::AnchorTop); + layoutCentralVertex[Vertical] = 0; + layoutLastVertex[Vertical] = internalVertex(layout, Qt::AnchorBottom); } void QGraphicsAnchorLayoutPrivate::deleteLayoutEdges() @@ -1019,6 +1025,8 @@ void QGraphicsAnchorLayoutPrivate::createItemEdges(QGraphicsLayoutItem *item) void QGraphicsAnchorLayoutPrivate::createCenterAnchors( QGraphicsLayoutItem *item, Qt::AnchorPoint centerEdge) { + Q_Q(QGraphicsAnchorLayout); + Orientation orientation; switch (centerEdge) { case Qt::AnchorHorizontalCenter: @@ -1073,12 +1081,19 @@ void QGraphicsAnchorLayoutPrivate::createCenterAnchors( // Remove old one removeAnchor_helper(first, last); + + if (item == q) { + layoutCentralVertex[orientation] = internalVertex(q, centerEdge); + } + } void QGraphicsAnchorLayoutPrivate::removeCenterAnchors( QGraphicsLayoutItem *item, Qt::AnchorPoint centerEdge, bool substitute) { + Q_Q(QGraphicsAnchorLayout); + Orientation orientation; switch (centerEdge) { case Qt::AnchorHorizontalCenter: @@ -1151,6 +1166,10 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors( // by this time, the center vertex is deleted and merged into a non-centered internal anchor removeAnchor_helper(first, internalVertex(item, lastEdge)); } + + if (item == q) { + layoutCentralVertex[orientation] = 0; + } } @@ -1773,7 +1792,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( // For minimum and maximum, use the path between the two layout sides as the // objective function. - AnchorVertex *v = internalVertex(q, pickEdge(Qt::AnchorRight, orientation)); + AnchorVertex *v = layoutLastVertex[orientation]; GraphPath trunkPath = graphPaths[orientation].value(v); bool feasible = calculateTrunk(orientation, trunkPath, trunkConstraints, trunkVariables); @@ -1955,7 +1974,7 @@ void QGraphicsAnchorLayoutPrivate::findPaths(Orientation orientation) QSet visited; - AnchorVertex *root = graph[orientation].rootVertex(); + AnchorVertex *root = layoutFirstVertex[orientation]; graphPaths[orientation].insert(root, GraphPath()); @@ -2077,28 +2096,18 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation) { Q_Q(QGraphicsAnchorLayout); - // Find layout vertices and edges for the current orientation. - AnchorVertex *layoutFirstVertex = \ - internalVertex(q, pickEdge(Qt::AnchorLeft, orientation)); - - AnchorVertex *layoutCentralVertex = \ - internalVertex(q, pickEdge(Qt::AnchorHorizontalCenter, orientation)); - - AnchorVertex *layoutLastVertex = \ - internalVertex(q, pickEdge(Qt::AnchorRight, orientation)); - - Q_ASSERT(layoutFirstVertex && layoutLastVertex); + Q_ASSERT(layoutFirstVertex[orientation] && layoutLastVertex[orientation]); AnchorData *edgeL1 = NULL; AnchorData *edgeL2 = NULL; // The layout may have a single anchor between Left and Right or two half anchors // passing through the center - if (layoutCentralVertex) { - edgeL1 = graph[orientation].edgeData(layoutFirstVertex, layoutCentralVertex); - edgeL2 = graph[orientation].edgeData(layoutCentralVertex, layoutLastVertex); + if (layoutCentralVertex[orientation]) { + edgeL1 = graph[orientation].edgeData(layoutFirstVertex[orientation], layoutCentralVertex[orientation]); + edgeL2 = graph[orientation].edgeData(layoutCentralVertex[orientation], layoutLastVertex[orientation]); } else { - edgeL1 = graph[orientation].edgeData(layoutFirstVertex, layoutLastVertex); + edgeL1 = graph[orientation].edgeData(layoutFirstVertex[orientation], layoutLastVertex[orientation]); } QLinkedList remainingConstraints; @@ -2288,7 +2297,7 @@ void QGraphicsAnchorLayoutPrivate::calculateVertexPositions( QSet visited; // Get root vertex - AnchorVertex *root = graph[orientation].rootVertex(); + AnchorVertex *root = layoutFirstVertex[orientation]; root->distance = 0; visited.insert(root); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 7dd0d65..7d7bdb6 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -504,6 +504,10 @@ public: // Internal graph of anchorage points and anchors, for both orientations Graph graph[2]; + AnchorVertex *layoutFirstVertex[2]; + AnchorVertex *layoutCentralVertex[2]; + AnchorVertex *layoutLastVertex[2]; + // Graph paths and constraints, for both orientations QMultiHash graphPaths[2]; QList constraints[2]; -- cgit v0.12 From d00f3afdd547b3206016b6d97f669b04f48a27d7 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Wed, 4 Nov 2009 14:41:58 -0300 Subject: QGAL: escape vertices names in the serialized graph output Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraph_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraph_p.h b/src/gui/graphicsview/qgraph_p.h index b5b3c88..0a2bf27 100644 --- a/src/gui/graphicsview/qgraph_p.h +++ b/src/gui/graphicsview/qgraph_p.h @@ -236,7 +236,7 @@ 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]\" dir=both color=\"#000000:#a0a0a0\"] \n") .arg(v->toString()) .arg(v1->toString()) .arg(data->minSize) @@ -245,7 +245,7 @@ public: ; } } - strVertices += QString::fromAscii("%1 [label=\"%2\"]\n").arg(v->toString()).arg(v->toString()); + strVertices += QString::fromAscii("\"%1\" [label=\"%2\"]\n").arg(v->toString()).arg(v->toString()); } return QString::fromAscii("%1\n%2\n").arg(strVertices).arg(edges); } -- cgit v0.12 From 5c1c3e0366ce6992a514148815ef25b3f1f6f66b Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Wed, 4 Nov 2009 14:45:32 -0300 Subject: QGAL: add names to the items in some tests Those are useful when dumping the graph in dot format for debugging. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp | 8 ++++---- tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index c8a9fac..09e2ee2 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -1951,7 +1951,7 @@ void tst_QGraphicsAnchorLayout::simplifiableUnfeasible() if (hasSimplification) QVERIFY(!usedSimplex(l, Qt::Horizontal)); - // Now we make it valid again + // Now we make it valid b->setMinimumWidth(100); l->invalidate(); @@ -1979,9 +1979,9 @@ void tst_QGraphicsAnchorLayout::simplificationVsOrder() QSizeF pref(20, 10); QSizeF max(50, 10); - QGraphicsWidget *a = createItem(min, pref, max); - QGraphicsWidget *b = createItem(min, pref, max); - QGraphicsWidget *c = createItem(min, pref, max); + QGraphicsWidget *a = createItem(min, pref, max, "A"); + QGraphicsWidget *b = createItem(min, pref, max, "B"); + QGraphicsWidget *c = createItem(min, pref, max, "C"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 1c7a159..2d6b44b 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -162,10 +162,14 @@ Q_DECLARE_METATYPE(AnchorItemSizeHintList) class TestWidget : public QGraphicsWidget { public: - inline TestWidget(QGraphicsItem *parent = 0) + inline TestWidget(QGraphicsItem *parent = 0, const QString &name = QString()) : QGraphicsWidget(parent) { setContentsMargins( 0,0,0,0 ); + if (name.isEmpty()) + setData(0, QString::fromAscii("w%1").arg(int(this))); + else + setData(0, name); } ~TestWidget() { @@ -1684,7 +1688,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() // Create dummy widgets QList widgets; for (int i = 0; i < widgetCount; ++i) { - TestWidget *w = new TestWidget; + TestWidget *w = new TestWidget(0, QString::fromAscii("W%1").arg(i)); widgets << w; } -- cgit v0.12 From 41369cd2946956b9a455e4f2014dcc38ffcbad52 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Wed, 4 Nov 2009 14:54:49 -0300 Subject: QGAL: extend helper function to always return parallel anchor created Our helper function addAnchorMaybeParallel() returned 0 to indicate an unfeasible setup, so we ended up without the pointer to the new parallel anchor (which was created regardless the feasibility). While we don't make use of this information right now, vertex simplification will need to store those new parallel anchors even when they are not feasible. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 25 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 6bffd09..f0aeea4 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -533,13 +533,14 @@ inline static qreal checkAdd(qreal a, qreal b) Adds \a newAnchor to the graph \a g. Returns the newAnchor itself if it could be added without further changes to the graph. If a - new parallel anchor had to be created, then returns the new parallel anchor. In case the - addition is unfeasible -- because a parallel setup is not possible, returns 0. + new parallel anchor had to be created, then returns the new parallel anchor. If a parallel anchor + had to be created and it results in an unfeasible setup, \a feasible is set to false, otherwise + true. */ static AnchorData *addAnchorMaybeParallel(Graph *g, - AnchorData *newAnchor) + AnchorData *newAnchor, bool *feasible) { - bool feasible = true; + *feasible = true; // If already exists one anchor where newAnchor is supposed to be, we create a parallel // anchor. @@ -548,12 +549,12 @@ static AnchorData *addAnchorMaybeParallel(Graph *g, // At this point we can identify that the parallel anchor is not feasible, e.g. one // anchor minimum size is bigger than the other anchor maximum size. - feasible = parallel->refreshSizeHints_helper(0, false); + *feasible = parallel->refreshSizeHints_helper(0, false); newAnchor = parallel; } g->createEdge(newAnchor->from, newAnchor->to, newAnchor); - return feasible ? newAnchor : 0; + return newAnchor; } @@ -839,13 +840,21 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP // Add the sequence to the graph. // + // ### At this point we assume that if some parallel anchor will be created because + // of the new sequence, the other anchor will not be a center anchor (since we + // not deal with that case yet). This assumption will break once we start simplifying + // vertices. + AnchorData *possibleParallel = g.edgeData(beforeSequence, afterSequence); + Q_ASSERT(!possibleParallel || !possibleParallel->isCenterAnchor); + AnchorData *sequence = createSequence(&g, beforeSequence, candidates, afterSequence); // If 'beforeSequence' and 'afterSequence' already had an anchor between them, we'll // create a parallel anchor between the new sequence and the old anchor. - AnchorData *newAnchor = addAnchorMaybeParallel(&g, sequence); + bool newFeasible; + AnchorData *newAnchor = addAnchorMaybeParallel(&g, sequence, &newFeasible); - if (!newAnchor) { + if (!newFeasible) { *feasible = false; return false; } -- cgit v0.12 From 33faaf6fa1775dc74bb61acde8a48eae2b9f2635 Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Mon, 19 Oct 2009 16:36:53 -0300 Subject: QGAL: Do not restrict maximum size of layout anchors This commit improves the way QGAL handles setups where most anchors or items do not have explicit maximum sizes. By default the internal layout anchors and others, have maximum size of QWIDGETSIZE_MAX. It happens though that this value is rather arbitrary but yet, can restrict the size of other paths in the layout. For instance, in the setup below, where the maximum sizes of A and B is not set: ________ ________ | | item A | | item B | | o---o--------o---o--------o---o | |________| |________| | | | | (layout structural anchor) | o-----------------------------o | | the bottom path, of maximum size QWIDGETSIZE_MAX, restricts the lenght of the path at the top, of maximum size of 2 x QWIDGETSIZE_MAX. This introduces the need of fair distribution in the path A-B. While that's not an issue when the path is simplified to a single anchor, it may lead to unbalanced distributions if such simplification is not possible. As this case may arise when we have center anchors in the top path, it may appear in real-world cases. To work around that, we do not limit the maximum width of the layout anchor or parallel anchors that may have taken its place. The practical result in the example above is that the sizeAtMaximum will be set at 2 x QWIDGETSIZE_MAX, with a good distribution of A and B. On the other hand, this oversized layout is not a problem because the effectiveSizeHint code enforces the respect of QWIDGETSIZE_MAX. That means the layout will interpolate only between zero and QWIDGETSIZE_MAX even though its internal maximum size is twice that value. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 56 ++++++++++++++++++---- .../tst_qgraphicsanchorlayout.cpp | 6 +-- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index f0aeea4..dbfce74 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -342,13 +342,15 @@ void SequentialAnchorData::updateChildrenSizes() // ### check whether we are guarantee to get those or we need to warn stuff at this // point. Q_ASSERT(sizeAtMinimum > minSize || qFuzzyCompare(sizeAtMinimum, minSize)); - Q_ASSERT(sizeAtMinimum < maxSize || qFuzzyCompare(sizeAtMinimum, maxSize)); Q_ASSERT(sizeAtPreferred > minSize || qFuzzyCompare(sizeAtPreferred, minSize)); - Q_ASSERT(sizeAtPreferred < maxSize || qFuzzyCompare(sizeAtPreferred, maxSize)); Q_ASSERT(sizeAtExpanding > minSize || qFuzzyCompare(sizeAtExpanding, minSize)); - Q_ASSERT(sizeAtExpanding < maxSize || qFuzzyCompare(sizeAtExpanding, maxSize)); Q_ASSERT(sizeAtMaximum > minSize || qFuzzyCompare(sizeAtMaximum, minSize)); - Q_ASSERT(sizeAtMaximum < maxSize || qFuzzyCompare(sizeAtMaximum, maxSize)); + + // These may be false if this anchor was in parallel with the layout stucture + // Q_ASSERT(sizeAtMinimum < maxSize || qFuzzyCompare(sizeAtMinimum, maxSize)); + // Q_ASSERT(sizeAtPreferred < maxSize || qFuzzyCompare(sizeAtPreferred, maxSize)); + // Q_ASSERT(sizeAtExpanding < maxSize || qFuzzyCompare(sizeAtExpanding, maxSize)); + // Q_ASSERT(sizeAtMaximum < maxSize || qFuzzyCompare(sizeAtMaximum, maxSize)); // Band here refers if the value is in the Minimum To Preferred // band (the lower band) or the Preferred To Maximum (the upper band). @@ -1752,8 +1754,6 @@ QList getVariables(QList constraints) void QGraphicsAnchorLayoutPrivate::calculateGraphs( QGraphicsAnchorLayoutPrivate::Orientation orientation) { - Q_Q(QGraphicsAnchorLayout); - #if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT) lastCalculationUsedSimplex[orientation] = false; #endif @@ -2069,7 +2069,30 @@ void QGraphicsAnchorLayoutPrivate::updateAnchorSizes(Orientation orientation) QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHints( const QList &anchors) { + if (anchors.isEmpty()) + return QList(); + + // Look for the layout edge. That can be either the first half in case the + // layout is split in two, or the whole layout anchor. + Orientation orient = Orientation(anchors.first()->orientation); + AnchorData *layoutEdge1 = NULL; + AnchorData *layoutEdge2 = NULL; + if (layoutCentralVertex[orient]) { + layoutEdge1 = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]); + layoutEdge2 = graph[orient].edgeData(layoutCentralVertex[orient], layoutLastVertex[orient]); + } else { + layoutEdge1 = graph[orient].edgeData(layoutFirstVertex[orient], layoutLastVertex[orient]); + // If maxSize is less then "infinite", that means there are other anchors + // grouped together with this one. We can't ignore its maximum value so we + // set back the variable to NULL to prevent the continue condition from being + // satisfied in the loop below. + if (layoutEdge1->maxSize < QWIDGETSIZE_MAX) + layoutEdge1 = NULL; + } + + // For each variable, create constraints based on size hints QList anchorConstraints; + bool unboundedProblem = true; for (int i = 0; i < anchors.size(); ++i) { AnchorData *ad = anchors[i]; @@ -2079,6 +2102,7 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin c->constant = ad->minSize; c->ratio = QSimplexConstraint::Equal; anchorConstraints += c; + unboundedProblem = false; } else { QSimplexConstraint *c = new QSimplexConstraint; c->variables.insert(ad, 1.0); @@ -2086,14 +2110,30 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin c->ratio = QSimplexConstraint::MoreOrEqual; anchorConstraints += c; + // We avoid adding restrictions to the layout internal anchors. That's + // to prevent unnecessary fair distribution from happening due to this + // artificial restriction. + if ((ad == layoutEdge1) || (ad == layoutEdge2)) + continue; + c = new QSimplexConstraint; c->variables.insert(ad, 1.0); c->constant = ad->maxSize; c->ratio = QSimplexConstraint::LessOrEqual; anchorConstraints += c; + unboundedProblem = false; } } + // If no upper boundary restriction was added, add one to avoid unbounded problem + if (unboundedProblem) { + QSimplexConstraint *c = new QSimplexConstraint; + c->variables.insert(layoutEdge1, 1.0); + c->constant = QWIDGETSIZE_MAX; + c->ratio = QSimplexConstraint::LessOrEqual; + anchorConstraints += c; + } + return anchorConstraints; } @@ -2103,8 +2143,6 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin QList< QList > QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation) { - Q_Q(QGraphicsAnchorLayout); - Q_ASSERT(layoutFirstVertex[orientation] && layoutLastVertex[orientation]); AnchorData *edgeL1 = NULL; @@ -2501,7 +2539,7 @@ bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList // Save sizeAtMaximum results for (int i = 0; i < variables.size(); ++i) { AnchorData *ad = static_cast(variables[i]); - Q_ASSERT(ad->result <= ad->maxSize || qFuzzyCompare(ad->result, ad->maxSize)); + // Q_ASSERT(ad->result <= ad->maxSize || qFuzzyCompare(ad->result, ad->maxSize)); ad->sizeAtMaximum = ad->result; } } diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 09e2ee2..ce1ffad 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -1896,15 +1896,15 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes() QGraphicsWidget p; p.setLayout(l); + QCOMPARE(int(p.effectiveSizeHint(Qt::MaximumSize).width()), + QWIDGETSIZE_MAX); + p.resize(200, 10); QCOMPARE(a->geometry(), QRectF(0, 0, 50, 10)); QCOMPARE(b->geometry(), QRectF(50, 0, 50, 10)); QCOMPARE(c->geometry(), QRectF(100, 0, 50, 10)); QCOMPARE(d->geometry(), QRectF(150, 0, 50, 10)); - if (!hasSimplification) - QEXPECT_FAIL("", "Without simplification there is no fair distribution.", Abort); - p.resize(1000, 10); QCOMPARE(a->geometry(), QRectF(0, 0, 450, 10)); QCOMPARE(b->geometry(), QRectF(450, 0, 50, 10)); -- cgit v0.12 From 56c04b7f546babf5bbe64a6d0175f635cb2fd204 Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Thu, 29 Oct 2009 16:19:59 -0300 Subject: QGAL: Update infiniteSizes test to avoid simplification The infiniteSizes test is supposed to work w/o simplification, to ensure that I'm adding a central anchor. With this anchor we force the problem to go to the simplex solver and expect it to solve things fine anyway. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index ce1ffad..00bfe65 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -1882,6 +1882,7 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes() QGraphicsWidget *b = createItem(min, pref, max, "b"); QGraphicsWidget *c = createItem(min, pref, max, "c"); QGraphicsWidget *d = createItem(min, pref, max, "d"); + QGraphicsWidget *e = createItem(min, pref, max, "e"); // setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); @@ -1889,6 +1890,8 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes() setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0); setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 0); + setAnchor(l, b, Qt::AnchorHorizontalCenter, e, Qt::AnchorLeft, 0); + setAnchor(l, e, Qt::AnchorRight, c, Qt::AnchorHorizontalCenter, 0); a->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); c->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); -- cgit v0.12 From 52d737eb6f4b79cd0c7fc7ee1d041fb19d286a27 Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Thu, 29 Oct 2009 17:14:09 -0300 Subject: QGAL: Do not create sizeHint constraints for dependent anchors Some anchors have their sizes linked directly to the size of others. That is the case for instance with center anchors where one half must have exactly the same size as the other. To make that more clear, adding "dependency" info to AnchorData and setting it accordingly. This is future proof in the sense that if someday we are allowed to anchor to other items in terms of percentages, like, anchor to 70% of an items' width, we would also need this notion. Knowing that, we no longer need to create size hint constraints for the slave anchors, only for the master ones. The size of slave anchors is enforced by the dependency constraint (sizeSlave = X * sizeMaster). Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 25 +++++++++++++++--------- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 10 +++++++++- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index dbfce74..ad7d657 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -1080,12 +1080,14 @@ void QGraphicsAnchorLayoutPrivate::createCenterAnchors( c->variables.insert(data, 1.0); addAnchor_helper(item, firstEdge, item, centerEdge, data); data->isCenterAnchor = true; + data->dependency = AnchorData::Master; data->refreshSizeHints(0); data = new AnchorData; c->variables.insert(data, -1.0); addAnchor_helper(item, centerEdge, item, lastEdge, data); data->isCenterAnchor = true; + data->dependency = AnchorData::Slave; data->refreshSizeHints(0); itemCenterConstraints[orientation].append(c); @@ -2075,19 +2077,18 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin // Look for the layout edge. That can be either the first half in case the // layout is split in two, or the whole layout anchor. Orientation orient = Orientation(anchors.first()->orientation); - AnchorData *layoutEdge1 = NULL; - AnchorData *layoutEdge2 = NULL; + AnchorData *layoutEdge = NULL; if (layoutCentralVertex[orient]) { - layoutEdge1 = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]); - layoutEdge2 = graph[orient].edgeData(layoutCentralVertex[orient], layoutLastVertex[orient]); + layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]); } else { - layoutEdge1 = graph[orient].edgeData(layoutFirstVertex[orient], layoutLastVertex[orient]); + layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutLastVertex[orient]); + // If maxSize is less then "infinite", that means there are other anchors // grouped together with this one. We can't ignore its maximum value so we // set back the variable to NULL to prevent the continue condition from being // satisfied in the loop below. - if (layoutEdge1->maxSize < QWIDGETSIZE_MAX) - layoutEdge1 = NULL; + if (layoutEdge->maxSize < QWIDGETSIZE_MAX) + layoutEdge = NULL; } // For each variable, create constraints based on size hints @@ -2096,6 +2097,12 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin for (int i = 0; i < anchors.size(); ++i) { AnchorData *ad = anchors[i]; + // Anchors that have their size directly linked to another one don't need constraints + // For exammple, the second half of an item has exactly the same size as the first half + // thus constraining the latter is enough. + if (ad->dependency == AnchorData::Slave) + continue; + if ((ad->minSize == ad->maxSize) || qFuzzyCompare(ad->minSize, ad->maxSize)) { QSimplexConstraint *c = new QSimplexConstraint; c->variables.insert(ad, 1.0); @@ -2113,7 +2120,7 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin // We avoid adding restrictions to the layout internal anchors. That's // to prevent unnecessary fair distribution from happening due to this // artificial restriction. - if ((ad == layoutEdge1) || (ad == layoutEdge2)) + if (ad == layoutEdge) continue; c = new QSimplexConstraint; @@ -2128,7 +2135,7 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin // If no upper boundary restriction was added, add one to avoid unbounded problem if (unboundedProblem) { QSimplexConstraint *c = new QSimplexConstraint; - c->variables.insert(layoutEdge1, 1.0); + c->variables.insert(layoutEdge, 1.0); c->constant = QWIDGETSIZE_MAX; c->ratio = QSimplexConstraint::LessOrEqual; anchorConstraints += c; diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 7d7bdb6..2f0237c 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -150,6 +150,12 @@ struct AnchorData : public QSimplexVariable { Parallel }; + enum Dependency { + Independent = 0, + Master, + Slave + }; + AnchorData() : QSimplexVariable(), item(0), from(0), to(0), minSize(0), prefSize(0), expSize(0), maxSize(0), @@ -157,7 +163,8 @@ struct AnchorData : public QSimplexVariable { sizeAtExpanding(0), sizeAtMaximum(0), graphicsAnchor(0), skipInPreferred(0), type(Normal), hasSize(true), isLayoutAnchor(false), - isCenterAnchor(false), orientation(0) {} + isCenterAnchor(false), orientation(0), + dependency(Independent) {} virtual void updateChildrenSizes() {} virtual bool refreshSizeHints(const QLayoutStyleInfo *styleInfo); @@ -212,6 +219,7 @@ struct AnchorData : public QSimplexVariable { uint isLayoutAnchor : 1; // if this anchor is an internal layout anchor uint isCenterAnchor : 1; uint orientation : 1; + uint dependency : 2; // either Independent, Master or Slave }; #ifdef QT_DEBUG -- cgit v0.12 From d4d6901d82476e92f4c318d8d6e9da5d3410920f Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Tue, 27 Oct 2009 18:34:01 -0300 Subject: QGAL (Test): Disable simplification test when that is off Prevent failures when the test is run with QT_ANCHORLAYOUT_NO_SIMPLIFICATION Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 00bfe65..53e27dc 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -342,8 +342,10 @@ void tst_QGraphicsAnchorLayout::layoutDirection() QCOMPARE(checkReverseDirection(p), true); - QVERIFY(usedSimplex(l, Qt::Horizontal)); - QVERIFY(!usedSimplex(l, Qt::Vertical)); + if (hasSimplification) { + QVERIFY(usedSimplex(l, Qt::Horizontal)); + QVERIFY(!usedSimplex(l, Qt::Vertical)); + } delete p; delete view; -- cgit v0.12 From 6c758ba18ded5ed1ac518777cb59e519142d292c Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Tue, 27 Oct 2009 17:29:02 -0300 Subject: QGAL: Avoid false assertions due to floating point precision errors Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 22 ++++++++++++---------- src/gui/graphicsview/qsimplex_p.cpp | 2 +- src/gui/graphicsview/qsimplex_p.h | 2 +- .../tst_qgraphicsanchorlayout1.cpp | 17 ++++++++++++++++- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index ad7d657..baff206 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -341,16 +341,16 @@ 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 || qFuzzyCompare(sizeAtMinimum, minSize)); - Q_ASSERT(sizeAtPreferred > minSize || qFuzzyCompare(sizeAtPreferred, minSize)); - Q_ASSERT(sizeAtExpanding > minSize || qFuzzyCompare(sizeAtExpanding, minSize)); - Q_ASSERT(sizeAtMaximum > minSize || qFuzzyCompare(sizeAtMaximum, minSize)); + Q_ASSERT(sizeAtMinimum > minSize || qAbs(sizeAtMinimum - minSize) < 0.00000001); + Q_ASSERT(sizeAtPreferred > minSize || qAbs(sizeAtPreferred - minSize) < 0.00000001); + Q_ASSERT(sizeAtExpanding > minSize || qAbs(sizeAtExpanding - 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 || qFuzzyCompare(sizeAtMinimum, maxSize)); - // Q_ASSERT(sizeAtPreferred < maxSize || qFuzzyCompare(sizeAtPreferred, maxSize)); - // Q_ASSERT(sizeAtExpanding < maxSize || qFuzzyCompare(sizeAtExpanding, maxSize)); - // Q_ASSERT(sizeAtMaximum < maxSize || qFuzzyCompare(sizeAtMaximum, maxSize)); + // Q_ASSERT(sizeAtMinimum < maxSize || qAbs(sizeAtMinimum - maxSize) < 0.00000001); + // Q_ASSERT(sizeAtPreferred < maxSize || qAbs(sizeAtPreferred - maxSize) < 0.00000001); + // Q_ASSERT(sizeAtExpanding < maxSize || qAbs(sizeAtExpanding - 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). @@ -2536,8 +2536,9 @@ bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList QList variables = getVariables(constraints); for (int i = 0; i < variables.size(); ++i) { AnchorData *ad = static_cast(variables[i]); - Q_ASSERT(ad->result >= ad->minSize || qFuzzyCompare(ad->result, ad->minSize)); ad->sizeAtMinimum = ad->result; + Q_ASSERT(ad->sizeAtMinimum >= ad->minSize || + qAbs(ad->sizeAtMinimum - ad->minSize) < 0.00000001); } // Calculate maximum values @@ -2546,8 +2547,9 @@ bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList // Save sizeAtMaximum results for (int i = 0; i < variables.size(); ++i) { AnchorData *ad = static_cast(variables[i]); - // Q_ASSERT(ad->result <= ad->maxSize || qFuzzyCompare(ad->result, ad->maxSize)); ad->sizeAtMaximum = ad->result; + // Q_ASSERT(ad->sizeAtMaximum <= ad->maxSize || + // qAbs(ad->sizeAtMaximum - ad->maxSize) < 0.00000001); } } return feasible; diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index 86b10b4..cd40f9e 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -288,7 +288,7 @@ bool QSimplex::setConstraints(const QList newConstraints) // original problem. // Otherwise, we clean up our structures and report there is // no feasible solution. - if (valueAt(0, columns - 1) != 0.0) { + if ((valueAt(0, columns - 1) != 0.0) && (qAbs(valueAt(0, columns - 1)) > 0.00001)) { qWarning() << "QSimplex: No feasible solution!"; clearDataStructures(); return false; diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h index 084ad7f..a5816d1 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) || qFuzzyCompare(1000 + leftHandSide, 1000 + constant)) + if ((leftHandSide == constant) || qAbs(leftHandSide - constant) < 0.00000001) return true; switch (ratio) { diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 2d6b44b..a7ce9be 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -1668,6 +1668,18 @@ inline QGraphicsLayoutItem *getItem( return widgets[index]; } +static QRectF truncate(QRectF original) +{ + QRectF result; + + result.setX(qRound(original.x() * 1000000) / 1000000.0); + result.setY(qRound(original.y() * 1000000) / 1000000.0); + result.setWidth(qRound(original.width() * 1000000) / 1000000.0); + result.setHeight(qRound(original.height() * 1000000) / 1000000.0); + + return result; +} + void tst_QGraphicsAnchorLayout1::testBasicLayout() { QFETCH(QSizeF, size); @@ -1716,7 +1728,10 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() // Validate for (int i = 0; i < result.count(); ++i) { const BasicLayoutTestResult item = result[i]; - QCOMPARE(widgets[item.index]->geometry(), item.rect); + QRectF expected = truncate(item.rect); + QRectF actual = truncate(widgets[item.index]->geometry()); + + QCOMPARE(expected, actual); } // ###: not supported yet -- cgit v0.12 From 95ec02845997c2dee796c680186c46ab29e5e9ce Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Wed, 4 Nov 2009 16:11:58 -0300 Subject: QGAL (test): Test parent widget size besides children sizes Sometimes a test fails due to a wrong child size and we spend a lot of time trying to understand why but, in fact the problem is in the parent size. This commit adds a test to check whether the parent widget was properly resized. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- .../qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index a7ce9be..57e5c41 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -1720,10 +1720,8 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() widget->setLayout(layout); widget->setContentsMargins(0,0,0,0); - widget->setMinimumSize(size); - widget->setMaximumSize(size); - -// QTest::qWait(500); // layouting is asynchronous.. + widget->resize(size); + QCOMPARE(widget->size(), size); // Validate for (int i = 0; i < result.count(); ++i) { @@ -2231,8 +2229,8 @@ void tst_QGraphicsAnchorLayout1::testRemoveCenterAnchor() widget->setLayout(layout); widget->setContentsMargins(0,0,0,0); - widget->setMinimumSize(size); - widget->setMaximumSize(size); + widget->resize(size); + QCOMPARE(widget->size(), size); // Validate for (int i = 0; i < result.count(); ++i) { @@ -3072,8 +3070,8 @@ void tst_QGraphicsAnchorLayout1::testComplexCases() widget->setLayout(layout); widget->setContentsMargins(0,0,0,0); - widget->setMinimumSize(size); - widget->setMaximumSize(size); + widget->resize(size); + QCOMPARE(widget->size(), size); // QTest::qWait(500); // layouting is asynchronous.. -- cgit v0.12 From 07be7cc5016ba036d6cfe73e610b4f7dd99ecf53 Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Wed, 4 Nov 2009 11:04:00 -0300 Subject: QGAL: Remove support for QSizePolicy::Expanding After meeting with Jan-Arve, we are removing the support for the expanding size hint flag. The reason for that is that such feature adds too much complexity to the existing code and makes it harder for us to implement planned changes, like the support for out-of-order simplification. As these changes are consireded more important than the support for the expanding sizeHint, we are dropping expanding support for now. Once the QGAL is more stable and we have more time available, we can consider bringing it back. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 210 ++--------------------- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 12 +- 2 files changed, 20 insertions(+), 202 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index baff206..7ad994c 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -105,7 +105,7 @@ qreal QGraphicsAnchorPrivate::spacing() const static void internalSizeHints(QSizePolicy::Policy policy, qreal minSizeHint, qreal prefSizeHint, qreal maxSizeHint, qreal *minSize, qreal *prefSize, - qreal *expSize, qreal *maxSize) + qreal *maxSize) { // minSize, prefSize and maxSize are initialized // with item's preferred Size: this is QSizePolicy::Fixed. @@ -135,11 +135,6 @@ static void internalSizeHints(QSizePolicy::Policy policy, *prefSize = *minSize; else *prefSize = prefSizeHint; - - if (policy & QSizePolicy::ExpandFlag) - *expSize = *maxSize; - else - *expSize = *prefSize; } bool AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo) @@ -154,7 +149,6 @@ bool AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo) if (isLayoutAnchor) { minSize = 0; prefSize = 0; - expSize = 0; maxSize = QWIDGETSIZE_MAX; if (isCenterAnchor) maxSize /= 2; @@ -205,8 +199,8 @@ bool AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo) } maxSizeHint = QWIDGETSIZE_MAX; } - internalSizeHints(policy, minSizeHint, prefSizeHint, maxSizeHint, - &minSize, &prefSize, &expSize, &maxSize); + internalSizeHints(policy, minSizeHint, prefSizeHint, maxSizeHint, + &minSize, &prefSize, &maxSize); // Set the anchor effective sizes to preferred. // @@ -217,7 +211,6 @@ bool AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo) // recalculate and override the values we set here. sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; - sizeAtExpanding = prefSize; sizeAtMaximum = prefSize; return true; @@ -227,7 +220,6 @@ void ParallelAnchorData::updateChildrenSizes() { firstEdge->sizeAtMinimum = secondEdge->sizeAtMinimum = sizeAtMinimum; firstEdge->sizeAtPreferred = secondEdge->sizeAtPreferred = sizeAtPreferred; - firstEdge->sizeAtExpanding = secondEdge->sizeAtExpanding = sizeAtExpanding; firstEdge->sizeAtMaximum = secondEdge->sizeAtMaximum = sizeAtMaximum; firstEdge->updateChildrenSizes(); @@ -257,16 +249,12 @@ bool ParallelAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *styleIn return false; } - expSize = qMax(firstEdge->expSize, secondEdge->expSize); - expSize = qMin(expSize, maxSize); - prefSize = qMax(firstEdge->prefSize, secondEdge->prefSize); - prefSize = qMin(prefSize, expSize); + prefSize = qMin(prefSize, maxSize); // See comment in AnchorData::refreshSizeHints() about sizeAt* values sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; - sizeAtExpanding = prefSize; sizeAtMaximum = prefSize; return true; @@ -280,8 +268,7 @@ bool ParallelAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *styleIn 1 is at Maximum */ static QPair getFactor(qreal value, qreal min, - qreal pref, qreal exp, - qreal max) + qreal pref, qreal max) { QGraphicsAnchorLayoutPrivate::Interval interval; qreal lower; @@ -291,13 +278,9 @@ static QPair getFactor(qreal valu interval = QGraphicsAnchorLayoutPrivate::MinToPreferred; lower = min; upper = pref; - } else if (value < exp) { - interval = QGraphicsAnchorLayoutPrivate::PreferredToExpanding; - lower = pref; - upper = exp; } else { - interval = QGraphicsAnchorLayoutPrivate::ExpandingToMax; - lower = exp; + interval = QGraphicsAnchorLayoutPrivate::PreferredToMax; + lower = pref; upper = max; } @@ -313,7 +296,7 @@ static QPair getFactor(qreal valu static qreal interpolate(const QPair &factor, qreal min, qreal pref, - qreal exp, qreal max) + qreal max) { qreal lower; qreal upper; @@ -323,12 +306,8 @@ static qreal interpolate(const QPair minSize || qAbs(sizeAtMinimum - minSize) < 0.00000001); Q_ASSERT(sizeAtPreferred > minSize || qAbs(sizeAtPreferred - minSize) < 0.00000001); - Q_ASSERT(sizeAtExpanding > minSize || qAbs(sizeAtExpanding - 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(sizeAtExpanding < maxSize || qAbs(sizeAtExpanding - 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 minFactor = - getFactor(sizeAtMinimum, minSize, prefSize, expSize, maxSize); + getFactor(sizeAtMinimum, minSize, prefSize, maxSize); const QPair prefFactor = - getFactor(sizeAtPreferred, minSize, prefSize, expSize, maxSize); - const QPair expFactor = - getFactor(sizeAtExpanding, minSize, prefSize, expSize, maxSize); + getFactor(sizeAtPreferred, minSize, prefSize, maxSize); const QPair maxFactor = - getFactor(sizeAtMaximum, minSize, prefSize, expSize, maxSize); + getFactor(sizeAtMaximum, minSize, prefSize, maxSize); for (int i = 0; i < m_edges.count(); ++i) { AnchorData *e = m_edges.at(i); - e->sizeAtMinimum = interpolate(minFactor, e->minSize, e->prefSize, e->expSize, e->maxSize); - e->sizeAtPreferred = interpolate(prefFactor, e->minSize, e->prefSize, e->expSize, e->maxSize); - e->sizeAtExpanding = interpolate(expFactor, e->minSize, e->prefSize, e->expSize, e->maxSize); - e->sizeAtMaximum = interpolate(maxFactor, e->minSize, e->prefSize, e->expSize, e->maxSize); + 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); e->updateChildrenSizes(); } @@ -386,7 +360,6 @@ bool SequentialAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *style { minSize = 0; prefSize = 0; - expSize = 0; maxSize = 0; for (int i = 0; i < m_edges.count(); ++i) { @@ -398,14 +371,12 @@ bool SequentialAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *style minSize += edge->minSize; prefSize += edge->prefSize; - expSize += edge->expSize; maxSize += edge->maxSize; } // See comment in AnchorData::refreshSizeHints() about sizeAt* values sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; - sizeAtExpanding = prefSize; sizeAtMaximum = prefSize; return true; @@ -480,7 +451,6 @@ QGraphicsAnchorLayoutPrivate::QGraphicsAnchorLayoutPrivate() for (int j = 0; j < 3; ++j) { sizeHints[i][j] = -1; } - sizeAtExpanding[i] = -1; interpolationProgress[i] = -1; spacings[i] = -1; @@ -1866,27 +1836,19 @@ bool QGraphicsAnchorLayoutPrivate::calculateTrunk(Orientation orientation, const if (feasible) { solvePreferred(allConstraints, variables); - // Note that we don't include the sizeHintConstraints, since they - // have a different logic for solveExpanding(). - solveExpanding(constraints, variables); - - // Calculate and set the preferred and expanding sizes for the layout, + // Calculate and set the preferred size for the layout, // from the edge sizes that were calculated above. qreal pref(0.0); - qreal expanding(0.0); foreach (const AnchorData *ad, path.positives) { pref += ad->sizeAtPreferred; - expanding += ad->sizeAtExpanding; } foreach (const AnchorData *ad, path.negatives) { pref -= ad->sizeAtPreferred; - expanding -= ad->sizeAtExpanding; } sizeHints[orientation][Qt::MinimumSize] = min; sizeHints[orientation][Qt::PreferredSize] = pref; sizeHints[orientation][Qt::MaximumSize] = max; - sizeAtExpanding[orientation] = expanding; } qDeleteAll(sizeHintConstraints); @@ -1900,13 +1862,11 @@ bool QGraphicsAnchorLayoutPrivate::calculateTrunk(Orientation orientation, const AnchorData *ad = path.positives.toList()[0]; ad->sizeAtMinimum = ad->minSize; ad->sizeAtPreferred = ad->prefSize; - ad->sizeAtExpanding = ad->expSize; ad->sizeAtMaximum = ad->maxSize; sizeHints[orientation][Qt::MinimumSize] = ad->sizeAtMinimum; sizeHints[orientation][Qt::PreferredSize] = ad->sizeAtPreferred; sizeHints[orientation][Qt::MaximumSize] = ad->sizeAtMaximum; - sizeAtExpanding[orientation] = ad->sizeAtExpanding; } #if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT) @@ -1932,7 +1892,6 @@ bool QGraphicsAnchorLayoutPrivate::calculateNonTrunk(const QListsizeAtMinimum = ad->sizeAtPreferred; - ad->sizeAtExpanding = ad->sizeAtPreferred; ad->sizeAtMaximum = ad->sizeAtPreferred; } } @@ -2406,7 +2365,6 @@ void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation( result = getFactor(current, sizeHints[orientation][Qt::MinimumSize], sizeHints[orientation][Qt::PreferredSize], - sizeAtExpanding[orientation], sizeHints[orientation][Qt::MaximumSize]); interpolationInterval[orientation] = result.first; @@ -2421,7 +2379,6 @@ void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation( - minimum size, - preferred size, - - size when all expanding anchors are expanded, - maximum size. These three key values are calculated in advance using linear @@ -2441,7 +2398,7 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, interpolationProgress[orientation]); qreal edgeDistance = interpolate(factor, edge->sizeAtMinimum, edge->sizeAtPreferred, - edge->sizeAtExpanding, edge->sizeAtMaximum); + edge->sizeAtMaximum); Q_ASSERT(edge->from == base || edge->to == base); @@ -2628,139 +2585,6 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QListexpSize), this - value depends on the anchor expanding property in the following way: - - - Expanding normal anchors want to grow towards their maximum size - - Non-expanding normal anchors want to remain at their preferred size. - - Sequential anchors wants to grow towards a size that is calculated by: - summarizing it's child anchors, where it will use preferred size for non-expanding anchors - and maximum size for expanding anchors. - - Parallel anchors want to grow towards the smallest maximum size of all the expanding anchors. - - 2) Clamp their desired values to the value they assume in the neighbour - keyframes (sizeAtPreferred and sizeAtExpanding) - - 3) Run simplex with a setup that ensures the following: - - a. Anchors will change their value from their sizeAtPreferred towards - their sizeAtMaximum as much as required to ensure that ALL anchors - reach their respective "desired" expanding sizes. - - b. No anchors will change their value beyond what is NEEDED to satisfy - the requirement above. - - The final result is that, at the "expanding" keyframe expanding anchors - will grow and take with them all anchors that are parallel to them. - However, non-expanding anchors will remain at their preferred size unless - they are forced to grow by a parallel expanding anchor. - - Note: For anchors where the sizeAtPreferred is bigger than sizeAtMaximum, - the visual effect when the layout grows from its preferred size is - the following: Expanding anchors will keep their size while non - expanding ones will shrink. Only after non-expanding anchors have - shrinked all the way, the expanding anchors will start to shrink too. -*/ -void QGraphicsAnchorLayoutPrivate::solveExpanding(const QList &constraints, - const QList &variables) -{ - QList itemConstraints; - QSimplexConstraint *objective = new QSimplexConstraint; - bool hasExpanding = false; - - // Construct the simplex constraints and objective - for (int i = 0; i < variables.size(); ++i) { - // For each anchor - AnchorData *ad = variables[i]; - - // Clamp the desired expanding size - qreal upperBoundary = qMax(ad->sizeAtPreferred, ad->sizeAtMaximum); - qreal lowerBoundary = qMin(ad->sizeAtPreferred, ad->sizeAtMaximum); - qreal boundedExpSize = qBound(lowerBoundary, ad->expSize, upperBoundary); - - // Expanding anchors are those that want to move from their preferred size - if (boundedExpSize != ad->sizeAtPreferred) - hasExpanding = true; - - // Lock anchor between boundedExpSize and sizeAtMaximum (ensure 3.a) - if (boundedExpSize == ad->sizeAtMaximum || qFuzzyCompare(boundedExpSize, ad->sizeAtMaximum)) { - // The interval has only one possible value, we can use an "Equal" - // constraint and don't need to add this variable to the objective. - QSimplexConstraint *itemC = new QSimplexConstraint; - itemC->ratio = QSimplexConstraint::Equal; - itemC->variables.insert(ad, 1.0); - itemC->constant = boundedExpSize; - itemConstraints << itemC; - } else { - // Add MoreOrEqual and LessOrEqual constraints. - QSimplexConstraint *itemC = new QSimplexConstraint; - itemC->ratio = QSimplexConstraint::MoreOrEqual; - itemC->variables.insert(ad, 1.0); - itemC->constant = qMin(boundedExpSize, ad->sizeAtMaximum); - itemConstraints << itemC; - - itemC = new QSimplexConstraint; - itemC->ratio = QSimplexConstraint::LessOrEqual; - itemC->variables.insert(ad, 1.0); - itemC->constant = qMax(boundedExpSize, ad->sizeAtMaximum); - itemConstraints << itemC; - - // Create objective to avoid the anchors from moving away from - // the preferred size more than the needed amount. (ensure 3.b) - // The objective function is the distance between sizeAtPreferred - // and sizeAtExpanding, it will be minimized. - if (ad->sizeAtExpanding < ad->sizeAtMaximum) { - // Try to shrink this variable towards its sizeAtPreferred value - objective->variables.insert(ad, 1.0); - } else { - // Try to grow this variable towards its sizeAtPreferred value - objective->variables.insert(ad, -1.0); - } - } - } - - // Solve - if (hasExpanding == false) { - // If no anchors are expanding, we don't need to run the simplex - // Set all variables to their preferred size - for (int i = 0; i < variables.size(); ++i) { - variables[i]->sizeAtExpanding = variables[i]->sizeAtPreferred; - } - } else { - // Run simplex - QSimplex simplex; - - // Satisfy expanding (3.a) - bool feasible = simplex.setConstraints(constraints + itemConstraints); - Q_ASSERT(feasible); - - // Reduce damage (3.b) - simplex.setObjective(objective); - simplex.solveMin(); - - // Collect results - for (int i = 0; i < variables.size(); ++i) { - variables[i]->sizeAtExpanding = variables[i]->result; - } - } - - delete objective; - qDeleteAll(itemConstraints); -} - -/*! - \internal Returns true if there are no arrangement that satisfies all constraints. Otherwise returns false. diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 2f0237c..1e11ee2 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -158,9 +158,9 @@ struct AnchorData : public QSimplexVariable { AnchorData() : QSimplexVariable(), item(0), from(0), to(0), - minSize(0), prefSize(0), expSize(0), maxSize(0), + minSize(0), prefSize(0), maxSize(0), sizeAtMinimum(0), sizeAtPreferred(0), - sizeAtExpanding(0), sizeAtMaximum(0), + sizeAtMaximum(0), graphicsAnchor(0), skipInPreferred(0), type(Normal), hasSize(true), isLayoutAnchor(false), isCenterAnchor(false), orientation(0), @@ -201,7 +201,6 @@ struct AnchorData : public QSimplexVariable { // size. qreal minSize; qreal prefSize; - qreal expSize; qreal maxSize; // These attributes define which sizes should that anchor be in when the @@ -209,7 +208,6 @@ struct AnchorData : public QSimplexVariable { // calculated by the Simplex solver based on the current layout setup. qreal sizeAtMinimum; qreal sizeAtPreferred; - qreal sizeAtExpanding; qreal sizeAtMaximum; QGraphicsAnchor *graphicsAnchor; @@ -345,8 +343,7 @@ public: // Interval represents which interpolation interval are we operating in. enum Interval { MinToPreferred = 0, - PreferredToExpanding, - ExpandingToMax + PreferredToMax }; // Several structures internal to the layout are duplicated to handle @@ -487,8 +484,6 @@ public: GraphPath path, qreal *min, qreal *max); bool solvePreferred(const QList &constraints, const QList &variables); - void solveExpanding(const QList &constraints, - const QList &variables); bool hasConflicts() const; #ifdef QT_DEBUG @@ -499,7 +494,6 @@ public: qreal spacings[NOrientations]; // Size hints from simplex engine qreal sizeHints[2][3]; - qreal sizeAtExpanding[2]; // Items QVector items; -- cgit v0.12 From 77f81c95635ecac0fc3516b4a4b71f84ffb56bfd Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Wed, 4 Nov 2009 11:37:53 -0300 Subject: QGAL (test): Remove expanding tests After the removal of the expanding size hint support. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- .../tst_qgraphicsanchorlayout.cpp | 238 +-------------------- 1 file changed, 10 insertions(+), 228 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 53e27dc..cc96edb 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -79,9 +79,6 @@ private slots: void delete_anchor(); void conflicts(); void sizePolicy(); - void expandingSequence(); - void expandingSequenceFairDistribution(); - void expandingParallel(); void floatConflict(); void infiniteMaxSizes(); void simplifiableUnfeasible(); @@ -1611,217 +1608,6 @@ void tst_QGraphicsAnchorLayout::conflicts() delete p; } -void tst_QGraphicsAnchorLayout::expandingSequence() -{ - QSizeF min(10, 10); - QSizeF pref(50, 10); - QSizeF max(100, 10); - - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - - b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; - l->setContentsMargins(0, 0, 0, 0); - - // horizontal - setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); - setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0); - setAnchor(l, b, Qt::AnchorRight, l, Qt::AnchorRight, 0); - - // vertical - l->addAnchors(l, a, Qt::Vertical); - l->addAnchors(l, b, Qt::Vertical); - - QCOMPARE(l->count(), 2); - - QGraphicsWidget p; - p.setLayout(l); - - QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); - QCOMPARE(layoutMinimumSize.width(), qreal(20)); - - QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); - p.resize(layoutExpandedSize); - - QCOMPARE(a->geometry().size(), pref); - QCOMPARE(b->geometry().size(), max); - - QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); - QCOMPARE(layoutMaximumSize.width(), qreal(200)); - - if (hasSimplification) { - QVERIFY(!usedSimplex(l, Qt::Horizontal)); - QVERIFY(!usedSimplex(l, Qt::Vertical)); - } -} - -void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution() -{ - QSizeF min(10, 10); - QSizeF pref(50, 10); - QSizeF max(100, 10); - - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); - QGraphicsWidget *d = createItem(min, pref, max, "d"); - - b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - d->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; - l->setContentsMargins(0, 0, 0, 0); - - // horizontal - setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); - setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0); - setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); - setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0); - setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 0); - - // vertical - l->addAnchors(l, a, Qt::Vertical); - l->addAnchors(l, b, Qt::Vertical); - l->addAnchors(l, c, Qt::Vertical); - l->addAnchors(l, d, Qt::Vertical); - - QCOMPARE(l->count(), 4); - - QGraphicsWidget p; - p.setLayout(l); - - QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); - QCOMPARE(layoutMinimumSize.width(), qreal(40)); - - QSizeF layoutPartialExpandedSize((2 * pref.width()) + (2 * (pref.width() + 10)), - layoutMinimumSize.height()); - p.resize(layoutPartialExpandedSize); - - QCOMPARE(a->geometry().size(), pref); - QCOMPARE(b->geometry().size(), pref + QSizeF(10, 0)); - QCOMPARE(c->geometry().size(), pref); - QCOMPARE(d->geometry().size(), pref + QSizeF(10, 0)); - - QSizeF layoutExpandedSize((2 * pref.width()) + (2 * max.width()), - layoutMinimumSize.height()); - p.resize(layoutExpandedSize); - - QCOMPARE(a->geometry().size(), pref); - QCOMPARE(b->geometry().size(), max); - QCOMPARE(c->geometry().size(), pref); - QCOMPARE(d->geometry().size(), max); - - QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); - QCOMPARE(layoutMaximumSize.width(), qreal(400)); - - if (hasSimplification) { - QVERIFY(!usedSimplex(l, Qt::Horizontal)); - QVERIFY(!usedSimplex(l, Qt::Vertical)); - } - - // Now we change D to have more "room for growth" from its preferred size - // to its maximum size. We expect a proportional fair distribution. Note that - // this seems to not conform with what QGraphicsLinearLayout does. - d->setMaximumSize(QSizeF(150, 10)); - - QSizeF newLayoutExpandedSize((2 * pref.width()) + (max.width() + 150), - layoutMinimumSize.height()); - p.resize(newLayoutExpandedSize); - - QCOMPARE(a->geometry().size(), pref); - QCOMPARE(b->geometry().size(), max); - QCOMPARE(c->geometry().size(), pref); - QCOMPARE(d->geometry().size(), QSizeF(150, 10)); - - QSizeF newLayoutPartialExpandedSize((4 * pref.width()) + 75, - layoutMinimumSize.height()); - p.resize(newLayoutPartialExpandedSize); - - QCOMPARE(a->geometry().size(), pref); - QCOMPARE(b->geometry().size(), pref + QSizeF(25, 0)); - QCOMPARE(c->geometry().size(), pref); - QCOMPARE(d->geometry().size(), pref + QSizeF(50, 0)); - - if (hasSimplification) { - QVERIFY(!usedSimplex(l, Qt::Horizontal)); - QVERIFY(!usedSimplex(l, Qt::Vertical)); - } -} - -void tst_QGraphicsAnchorLayout::expandingParallel() -{ - QSizeF min(10, 10); - QSizeF pref(50, 10); - QSizeF max(100, 10); - QSizeF max2(100, 50); - - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max2, "c"); - - b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; - l->setContentsMargins(0, 0, 0, 0); - - // horizontal - setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); - setAnchor(l, l, Qt::AnchorLeft, b, Qt::AnchorLeft, 0); - - setAnchor(l, a, Qt::AnchorRight, c, Qt::AnchorLeft, 0); - setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); - - setAnchor(l, c, Qt::AnchorRight, l, Qt::AnchorRight, 0); - - // vertical - l->addAnchors(l, c, Qt::Vertical); - setAnchor(l, l, Qt::AnchorTop, a, Qt::AnchorTop, 0); - setAnchor(l, a, Qt::AnchorBottom, c, Qt::AnchorVerticalCenter, 0); - setAnchor(l, b, Qt::AnchorTop, c, Qt::AnchorVerticalCenter, 0); - setAnchor(l, b, Qt::AnchorBottom, l, Qt::AnchorBottom, 0); - - QCOMPARE(l->count(), 3); - - QGraphicsWidget p; - p.setLayout(l); - - QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); - QCOMPARE(layoutMinimumSize.width(), qreal(20)); - - QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); - p.resize(layoutExpandedSize); - - QCOMPARE(a->geometry().size(), max); - QCOMPARE(b->geometry().size(), max); - QCOMPARE(c->geometry().size(), QSizeF(pref.width(), 20)); - - QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); - QCOMPARE(layoutMaximumSize.width(), qreal(200)); - - // - // Change the parallel connection to a paralell connection of b with a center... - // - QGraphicsAnchor *anchor = l->anchor(b, Qt::AnchorRight, c, Qt::AnchorLeft); - delete anchor; - setAnchor(l, b, Qt::AnchorRight, a, Qt::AnchorHorizontalCenter, 0); - a->setMaximumSize(max + QSizeF(100, 0)); - - QSizeF newLayoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); - QCOMPARE(newLayoutMinimumSize.width(), qreal(30)); - - QSizeF newLayoutExpandedSize = layoutExpandedSize + QSizeF(100, 0); - p.resize(newLayoutExpandedSize); - - QCOMPARE(a->geometry().size(), max + QSizeF(100, 0)); - QCOMPARE(b->geometry().size(), max); - QCOMPARE(c->geometry().size(), QSizeF(pref.width(), 20)); - - QSizeF newLayoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); - QCOMPARE(newLayoutMaximumSize.width(), qreal(300)); -} - void tst_QGraphicsAnchorLayout::floatConflict() { QGraphicsWidget *a = createItem(QSizeF(80,10), QSizeF(90,10), QSizeF(100,10), "a"); @@ -1895,9 +1681,6 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes() setAnchor(l, b, Qt::AnchorHorizontalCenter, e, Qt::AnchorLeft, 0); setAnchor(l, e, Qt::AnchorRight, c, Qt::AnchorHorizontalCenter, 0); - a->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - c->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - QGraphicsWidget p; p.setLayout(l); @@ -1911,17 +1694,16 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes() QCOMPARE(d->geometry(), QRectF(150, 0, 50, 10)); p.resize(1000, 10); - QCOMPARE(a->geometry(), QRectF(0, 0, 450, 10)); - QCOMPARE(b->geometry(), QRectF(450, 0, 50, 10)); - QCOMPARE(c->geometry(), QRectF(500, 0, 450, 10)); - QCOMPARE(d->geometry(), QRectF(950, 0, 50, 10)); - - qreal expMaxSize = (QWIDGETSIZE_MAX - 100.0) / 2; - p.resize(QWIDGETSIZE_MAX, 10); - QCOMPARE(a->geometry(), QRectF(0, 0, expMaxSize, 10)); - QCOMPARE(b->geometry(), QRectF(expMaxSize, 0, 50, 10)); - QCOMPARE(c->geometry(), QRectF(expMaxSize + 50, 0, expMaxSize, 10)); - QCOMPARE(d->geometry(), QRectF(QWIDGETSIZE_MAX - 50, 0, 50, 10)); + QCOMPARE(a->geometry(), QRectF(0, 0, 250, 10)); + QCOMPARE(b->geometry(), QRectF(250, 0, 250, 10)); + QCOMPARE(c->geometry(), QRectF(500, 0, 250, 10)); + QCOMPARE(d->geometry(), QRectF(750, 0, 250, 10)); + + p.resize(40000, 10); + QCOMPARE(a->geometry(), QRectF(0, 0, 10000, 10)); + QCOMPARE(b->geometry(), QRectF(10000, 0, 10000, 10)); + QCOMPARE(c->geometry(), QRectF(20000, 0, 10000, 10)); + QCOMPARE(d->geometry(), QRectF(30000, 0, 10000, 10)); } void tst_QGraphicsAnchorLayout::simplifiableUnfeasible() -- cgit v0.12 From 829f617ab2d4f240950ce88e9ce97421a2939a74 Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Thu, 5 Nov 2009 10:17:16 +1000 Subject: Check success of query. For example a bogus use of setFilter() might cause a query to fail. Check for this. Reviewed-by: Bill King --- src/sql/models/qsqltablemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index a91dc9f..98f22c8 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -406,7 +406,7 @@ bool QSqlTableModel::select() QSqlQuery qu(query, d->db); setQuery(qu); - if (!qu.isActive()) { + if (!qu.isActive() || lastError().isValid()) { // something went wrong - revert to non-select state d->initRecordAndPrimaryIndex(); return false; -- cgit v0.12 From 91c09562ed9c6eb1bd3a4dbd84a8cc64647751ee Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Thu, 5 Nov 2009 10:35:48 +1000 Subject: Fix retrieval of SQL type "TIME" information for PostgreSQL PostgreSQL can store/retieve the millisecond part of type "TIME" , so allow it in the API level. Task-number: QTBUG-5251 Reviewed-by: Bill King --- src/sql/drivers/psql/qsql_psql.cpp | 2 +- tests/auto/qsqlquery/tst_qsqlquery.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 4c78d6a..3e3ea06 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -1133,7 +1133,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const case QVariant::Time: #ifndef QT_NO_DATESTRING if (field.value().toTime().isValid()) { - r = QLatin1Char('\'') + field.value().toTime().toString(Qt::ISODate) + QLatin1Char('\''); + r = QLatin1Char('\'') + field.value().toTime().toString(QLatin1String("hh:mm:ss.zzz")) + QLatin1Char('\''); } else #endif { diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 3463153..87774a3 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -194,6 +194,8 @@ private slots: void sqlServerReturn0_data() { generic_data(); } void sqlServerReturn0(); + void QTBUG_5251_data() { generic_data("QPSQL"); } + void QTBUG_5251(); private: // returns all database connections @@ -2880,5 +2882,35 @@ void tst_QSqlQuery::sqlServerReturn0() QVERIFY_SQL(q, next()); } +void tst_QSqlQuery::QTBUG_5251() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + + if (!db.driverName().startsWith( "QPSQL" )) return; + + QSqlQuery q(db); + q.exec("DROP TABLE " + qTableName("timetest")); + QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("timetest") + " (t TIME)")); + QVERIFY_SQL(q, exec("INSERT INTO " + qTableName("timetest") + " VALUES ('1:2:3.666')")); + + QSqlTableModel timetestModel(0,db); + timetestModel.setEditStrategy(QSqlTableModel::OnManualSubmit); + timetestModel.setTable(qTableName("timetest")); + QVERIFY_SQL(timetestModel, select()); + + QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("01:02:03.666")); + QVERIFY_SQL(timetestModel,setData(timetestModel.index(0, 0), QTime(0,12,34,500))); + QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:12:34.500")); + QVERIFY_SQL(timetestModel, submitAll()); + QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:12:34.500")); + + QVERIFY_SQL(q, exec("UPDATE " + qTableName("timetest") + " SET t = '0:11:22.33'")); + QVERIFY_SQL(timetestModel, select()); + QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:11:22.330")); + +} + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" -- cgit v0.12 From c416d0d026377a5c8659abbd12cb4a8eab7c7264 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 5 Nov 2009 12:13:59 +1000 Subject: Add new cross schema relation autotest Autotest for http://bugreports.qt.nokia.com/browse/QTBUG-5373 --- .../tst_qsqlrelationaltablemodel.cpp | 36 +++++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index cb24a9f..e045c10 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -86,6 +86,7 @@ private slots: void escapedRelations(); void escapedTableName(); void whiteSpaceInIdentifiers(); + void psqlSchemaTest(); private: void dropTestTables( QSqlDatabase db ); @@ -150,10 +151,11 @@ void tst_QSqlRelationalTableModel::initTestCase() if (db.driverName().startsWith("QIBASE")) db.exec("SET DIALECT 3"); else if (tst_Databases::isSqlServer(db)) { - QSqlQuery q(db); - QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); - QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); + db.exec("SET ANSI_DEFAULTS ON"); + db.exec("SET IMPLICIT_TRANSACTIONS OFF"); } + else if(tst_Databases::isPostgreSQL(db)) + db.exec("set client_min_messages='warning'"); recreateTestTables(db); } } @@ -181,6 +183,9 @@ void tst_QSqlRelationalTableModel::dropTestTables( QSqlDatabase db ) << qTableName("CASETEST1" ) << qTableName("casetest1" ); tst_Databases::safeDropTables( db, tableNames ); + + db.exec("DROP SCHEMA "+qTableName("QTBUG_5373")); + db.exec("DROP SCHEMA "+qTableName("QTBUG_5373_s2")); } void tst_QSqlRelationalTableModel::init() @@ -1118,8 +1123,8 @@ void tst_QSqlRelationalTableModel::escapedTableName() } } -void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers() { - +void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers() +{ QFETCH_GLOBAL(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -1193,5 +1198,26 @@ void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers() { QCOMPARE(model.data(model.index(0, 2)).toInt(), 6); } +void tst_QSqlRelationalTableModel::psqlSchemaTest() +{ + QFETCH_GLOBAL(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + if(!tst_Databases::isPostgreSQL(db)) { + QSKIP("Postgresql specific test", SkipSingle); + return; + } + QSqlRelationalTableModel model(0, db); + QSqlQuery q(db); + QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373"))); + QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373_s2"))); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373")+"."+qTableName("user")+"(userid int primary key, relatingid int)")); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373_s2")+"."+qTableName("user2")+"(userid2 int primary key, username2 char(40))")); + model.setTable(qTableName("QTBUG_5373")+"."+qTableName("user")); + model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user2"), "userid2", "username2")); + QVERIFY_SQL(model, select()); +} + QTEST_MAIN(tst_QSqlRelationalTableModel) #include "tst_qsqlrelationaltablemodel.moc" -- cgit v0.12 From 5e04d74a9fd339384bd6808ff6edc4c47f99fee0 Mon Sep 17 00:00:00 2001 From: Artur Duque de Souza Date: Thu, 5 Nov 2009 00:57:09 -0300 Subject: Weather Anchor Layout example This was a design that was not possible before with the other layouts. To do this, the developer would need to hardcode all the positions and resize would not work. Besides the fact that we use "pixmap widgets" no it's not totally usefull widgets, it shows how anchors can help developers an designers with to create applications with new layouts. Signed-off-by: Artur Duque de Souza --- .../weatheranchorlayout/images/5days.jpg | Bin 0 -> 5748 bytes .../weatheranchorlayout/images/details.jpg | Bin 0 -> 5323 bytes .../weatheranchorlayout/images/place.jpg | Bin 0 -> 62438 bytes .../weatheranchorlayout/images/tabbar.jpg | Bin 0 -> 849 bytes .../weatheranchorlayout/images/title.jpg | Bin 0 -> 3472 bytes .../images/weather-few-clouds.png | Bin 0 -> 18976 bytes examples/graphicsview/weatheranchorlayout/main.cpp | 274 +++++++++++++++++++++ .../weatheranchorlayout/weatheranchorlayout.pro | 16 ++ .../weatheranchorlayout/weatheranchorlayout.qrc | 10 + 9 files changed, 300 insertions(+) create mode 100644 examples/graphicsview/weatheranchorlayout/images/5days.jpg create mode 100644 examples/graphicsview/weatheranchorlayout/images/details.jpg create mode 100644 examples/graphicsview/weatheranchorlayout/images/place.jpg create mode 100644 examples/graphicsview/weatheranchorlayout/images/tabbar.jpg create mode 100644 examples/graphicsview/weatheranchorlayout/images/title.jpg create mode 100644 examples/graphicsview/weatheranchorlayout/images/weather-few-clouds.png create mode 100644 examples/graphicsview/weatheranchorlayout/main.cpp create mode 100644 examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro create mode 100644 examples/graphicsview/weatheranchorlayout/weatheranchorlayout.qrc diff --git a/examples/graphicsview/weatheranchorlayout/images/5days.jpg b/examples/graphicsview/weatheranchorlayout/images/5days.jpg new file mode 100644 index 0000000..fd92ba8 Binary files /dev/null and b/examples/graphicsview/weatheranchorlayout/images/5days.jpg differ diff --git a/examples/graphicsview/weatheranchorlayout/images/details.jpg b/examples/graphicsview/weatheranchorlayout/images/details.jpg new file mode 100644 index 0000000..fde0448 Binary files /dev/null and b/examples/graphicsview/weatheranchorlayout/images/details.jpg differ diff --git a/examples/graphicsview/weatheranchorlayout/images/place.jpg b/examples/graphicsview/weatheranchorlayout/images/place.jpg new file mode 100644 index 0000000..03e5344 Binary files /dev/null and b/examples/graphicsview/weatheranchorlayout/images/place.jpg differ diff --git a/examples/graphicsview/weatheranchorlayout/images/tabbar.jpg b/examples/graphicsview/weatheranchorlayout/images/tabbar.jpg new file mode 100644 index 0000000..7777662 Binary files /dev/null and b/examples/graphicsview/weatheranchorlayout/images/tabbar.jpg differ diff --git a/examples/graphicsview/weatheranchorlayout/images/title.jpg b/examples/graphicsview/weatheranchorlayout/images/title.jpg new file mode 100644 index 0000000..fa84c81 Binary files /dev/null and b/examples/graphicsview/weatheranchorlayout/images/title.jpg differ diff --git a/examples/graphicsview/weatheranchorlayout/images/weather-few-clouds.png b/examples/graphicsview/weatheranchorlayout/images/weather-few-clouds.png new file mode 100644 index 0000000..eea6ce6 Binary files /dev/null and b/examples/graphicsview/weatheranchorlayout/images/weather-few-clouds.png differ diff --git a/examples/graphicsview/weatheranchorlayout/main.cpp b/examples/graphicsview/weatheranchorlayout/main.cpp new file mode 100644 index 0000000..fd5d9c6 --- /dev/null +++ b/examples/graphicsview/weatheranchorlayout/main.cpp @@ -0,0 +1,274 @@ +/**************************************************************************** +** +** 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 examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +class PixmapWidget : public QGraphicsLayoutItem +{ + +public: + PixmapWidget(const QPixmap &pix) : QGraphicsLayoutItem() + { + original = new QGraphicsPixmapItem(pix); + setGraphicsItem(original); + original->show(); + r = QRectF(QPointF(0, 0), pix.size()); + } + + ~PixmapWidget() + { + setGraphicsItem(0); + delete original; + } + + void setZValue(qreal z) + { + original->setZValue(z); + } + + void setGeometry (const QRectF &rect) + { + original->scale(rect.width() / r.width(), rect.height() / r.height()); + original->setPos(rect.x(), rect.y()); + r = rect; + } + +protected: + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const + { + Q_UNUSED(constraint); + QSizeF sh; + switch (which) { + case Qt::MinimumSize: + sh = QSizeF(0, 0); + break; + case Qt::PreferredSize: + sh = QSizeF(50, 50); + break; + case Qt::MaximumSize: + sh = QSizeF(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + break; + } + return sh; + } + +private: + QGraphicsPixmapItem *original; + QRectF r; +}; + + +class PlaceWidget : public QGraphicsWidget +{ + Q_OBJECT + +public: + PlaceWidget(const QPixmap &pix) : QGraphicsWidget(), original(pix), scaled(pix) + { + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*) + { + QPointF reflection = QPointF(); + reflection.setY(scaled.height() + 2); + + painter->drawPixmap(QPointF(), scaled); + + QPixmap tmp(scaled.size()); + QPainter p(&tmp); + + // create gradient + QPoint p1(scaled.width() / 2, 0); + QPoint p2(scaled.width() / 2, scaled.height()); + QLinearGradient linearGrad(p1, p2); + linearGrad.setColorAt(0, QColor(0, 0, 0, 0)); + linearGrad.setColorAt(0.65, QColor(0, 0, 0, 127)); + linearGrad.setColorAt(1, QColor(0, 0, 0, 255)); + + // apply 'mask' + p.setBrush(linearGrad); + p.fillRect(0, 0, tmp.width(), tmp.height(), QBrush(linearGrad)); + p.fillRect(0, 0, tmp.width(), tmp.height(), QBrush(linearGrad)); + + // paint the image flipped + p.setCompositionMode(QPainter::CompositionMode_DestinationOver); + p.drawPixmap(0, 0, QPixmap::fromImage(scaled.toImage().mirrored(false, true))); + p.end(); + + painter->drawPixmap(reflection, tmp); + } + + void resizeEvent(QGraphicsSceneResizeEvent *event) + { + QSize newSize = event->newSize().toSize(); + newSize.setHeight(newSize.height() / 2); + scaled = original.scaled(newSize); + } + + QRectF boundingRect() const + { + QSize size(scaled.width(), scaled.height() * 2 + 2); + return QRectF(QPointF(0, 0), size); + } + +private: + QPixmap original; + QPixmap scaled; +}; + + +static QGraphicsProxyWidget *createItem(const QString &name = "Unnamed") +{ + QGraphicsProxyWidget *w = new QGraphicsProxyWidget; + w->setWidget(new QPushButton(name)); + w->setData(0, name); + w->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + return w; +} + +int main(int argc, char **argv) +{ + Q_INIT_RESOURCE(weatheranchorlayout); + + QApplication app(argc, argv); + + QGraphicsScene scene; + scene.setSceneRect(0, 0, 800, 480); + +#ifdef DEBUG_MODE + QGraphicsProxyWidget *title = createItem("Title"); + QGraphicsProxyWidget *place = createItem("Place"); + QGraphicsProxyWidget *sun = createItem("Sun"); + QGraphicsProxyWidget *details = createItem("Details"); + QGraphicsProxyWidget *tabbar = createItem("Tabbar"); +#else + // pixmaps widgets + PixmapWidget *title = new PixmapWidget(QPixmap(":/images/title.jpg")); + PlaceWidget *place = new PlaceWidget(QPixmap(":/images/place.jpg")); + PixmapWidget *details = new PixmapWidget(QPixmap(":/images/5days.jpg")); + PixmapWidget *sun = new PixmapWidget(QPixmap(":/images/weather-few-clouds.png")); + PixmapWidget *tabbar = new PixmapWidget(QPixmap(":/images/tabbar.jpg")); +#endif + + + // setup sizes + title->setPreferredSize(QSizeF(348, 45)); + title->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + + place->setPreferredSize(QSizeF(96, 72)); + place->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + + details->setMinimumSize(QSizeF(200, 112)); + details->setPreferredSize(QSizeF(200, 112)); + details->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + + tabbar->setPreferredSize(QSizeF(70, 24)); + tabbar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + + sun->setPreferredSize(QSizeF(128, 97)); + sun->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + sun->setZValue(9999); + + // start anchor layout + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setSpacing(0); + + // setup the main widget + QGraphicsWidget *w = new QGraphicsWidget(0, Qt::Window); + QPalette p; + p.setColor(QPalette::Window, Qt::black); + w->setPalette(p); + w->setPos(20, 20); + w->setLayout(l); + + // vertical anchors + QGraphicsAnchor *anchor = l->addAnchor(title, Qt::AnchorTop, l, Qt::AnchorTop); + anchor = l->addAnchor(place, Qt::AnchorTop, title, Qt::AnchorBottom); + anchor->setSpacing(12); + anchor = l->addAnchor(place, Qt::AnchorBottom, l, Qt::AnchorBottom); + anchor->setSpacing(12); + + anchor = l->addAnchor(sun, Qt::AnchorTop, title, Qt::AnchorTop); + anchor = l->addAnchor(sun, Qt::AnchorBottom, l, Qt::AnchorVerticalCenter); + + anchor = l->addAnchor(tabbar, Qt::AnchorTop, title, Qt::AnchorBottom); + anchor->setSpacing(5); + anchor = l->addAnchor(details, Qt::AnchorTop, tabbar, Qt::AnchorBottom); + anchor->setSpacing(2); + anchor = l->addAnchor(details, Qt::AnchorBottom, l, Qt::AnchorBottom); + anchor->setSpacing(12); + + // horizontal anchors + anchor = l->addAnchor(l, Qt::AnchorLeft, title, Qt::AnchorLeft); + anchor = l->addAnchor(title, Qt::AnchorRight, l, Qt::AnchorRight); + + anchor = l->addAnchor(place, Qt::AnchorLeft, l, Qt::AnchorLeft); + anchor->setSpacing(15); + anchor = l->addAnchor(place, Qt::AnchorRight, details, Qt::AnchorLeft); + anchor->setSpacing(35); + + anchor = l->addAnchor(sun, Qt::AnchorLeft, place, Qt::AnchorHorizontalCenter); + anchor = l->addAnchor(sun, Qt::AnchorRight, l, Qt::AnchorHorizontalCenter); + + anchor = l->addAnchor(tabbar, Qt::AnchorHorizontalCenter, details, Qt::AnchorHorizontalCenter); + anchor = l->addAnchor(details, Qt::AnchorRight, l, Qt::AnchorRight); + + // QGV setup + scene.addItem(w); + scene.setBackgroundBrush(Qt::white); + QGraphicsView *view = new QGraphicsView(&scene); + view->show(); + + return app.exec(); +} + +#include "main.moc" diff --git a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro new file mode 100644 index 0000000..8b1803b --- /dev/null +++ b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro @@ -0,0 +1,16 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Tue May 12 15:22:25 2009 +###################################################################### + +# Input +SOURCES += main.cpp +RESOURCES += weatheranchorlayout.qrc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/weatheranchorlayout +sources.files = $$SOURCES $$HEADERS $$RESOURCES weatheranchorlayout.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/weatheranchorlayout +INSTALLS += target sources + +TARGET = weatheranchorlayout_example +CONFIG += console diff --git a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.qrc b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.qrc new file mode 100644 index 0000000..e39f8c0 --- /dev/null +++ b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.qrc @@ -0,0 +1,10 @@ + + + images/5days.jpg + images/title.jpg + images/place.jpg + images/tabbar.jpg + images/details.jpg + images/weather-few-clouds.png + + -- cgit v0.12 From aa58293b57a05cd52b36ba14a05958dceb65c603 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 5 Nov 2009 14:21:36 +1000 Subject: Cascade delete to cleanup autotest properly. Task-number: QTBUG-5373 --- tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index e045c10..8c840cd 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -184,8 +184,8 @@ void tst_QSqlRelationalTableModel::dropTestTables( QSqlDatabase db ) << qTableName("casetest1" ); tst_Databases::safeDropTables( db, tableNames ); - db.exec("DROP SCHEMA "+qTableName("QTBUG_5373")); - db.exec("DROP SCHEMA "+qTableName("QTBUG_5373_s2")); + db.exec("DROP SCHEMA "+qTableName("QTBUG_5373")+" CASCADE"); + db.exec("DROP SCHEMA "+qTableName("QTBUG_5373_s2")+" CASCADE"); } void tst_QSqlRelationalTableModel::init() -- cgit v0.12 From b91f1a2f749586014e8b28c6766015ff6ba62ee7 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 5 Nov 2009 10:25:12 +1000 Subject: Modify QGLShader and QGLShaderProgram in response to API review Reviewed-by: Sarah Smith --- demos/boxes/scene.cpp | 34 +-- .../snippets/code/src_opengl_qglshaderprogram.cpp | 15 +- examples/opengl/hellogl_es2/glwidget.cpp | 30 ++- examples/opengl/textures/glwidget.cpp | 12 +- .../gl2paintengineex/qglengineshadermanager.cpp | 26 +- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 4 +- src/opengl/qglshaderprogram.cpp | 298 ++++++++++++--------- src/opengl/qglshaderprogram.h | 43 +-- src/opengl/qwindowsurface_gl.cpp | 2 +- 9 files changed, 257 insertions(+), 207 deletions(-) diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp index a06e8a1..06dc0f9 100644 --- a/demos/boxes/scene.cpp +++ b/demos/boxes/scene.cpp @@ -552,14 +552,15 @@ void Scene::initGL() { m_box = new GLRoundedBox(0.25f, 1.0f, 10); - m_vertexShader = new QGLShader(":/res/boxes/basic.vsh", QGLShader::VertexShader); + m_vertexShader = new QGLShader(QGLShader::Vertex); + m_vertexShader->compileSourceFile(QLatin1String(":/res/boxes/basic.vsh")); QStringList list; list << ":/res/boxes/cubemap_posx.jpg" << ":/res/boxes/cubemap_negx.jpg" << ":/res/boxes/cubemap_posy.jpg" << ":/res/boxes/cubemap_negy.jpg" << ":/res/boxes/cubemap_posz.jpg" << ":/res/boxes/cubemap_negz.jpg"; m_environment = new GLTextureCube(list, qMin(1024, m_maxTextureSize)); - m_environmentShader = new QGLShader(QGLShader::FragmentShader); - m_environmentShader->compile(environmentShaderText); + m_environmentShader = new QGLShader(QGLShader::Fragment); + m_environmentShader->compileSourceCode(environmentShaderText); m_environmentProgram = new QGLShaderProgram; m_environmentProgram->addShader(m_vertexShader); m_environmentProgram->addShader(m_environmentShader); @@ -616,7 +617,8 @@ void Scene::initGL() files = QDir(":/res/boxes/").entryInfoList(filter, QDir::Files | QDir::Readable); foreach (QFileInfo file, files) { QGLShaderProgram *program = new QGLShaderProgram; - QGLShader* shader = new QGLShader(file.absoluteFilePath(), QGLShader::FragmentShader); + QGLShader* shader = new QGLShader(QGLShader::Fragment); + shader->compileSourceFile(file.absoluteFilePath()); // The program does not take ownership over the shaders, so store them in a vector so they can be deleted afterwards. program->addShader(m_vertexShader); program->addShader(shader); @@ -638,9 +640,9 @@ void Scene::initGL() m_programs << program; m_renderOptions->addShader(file.baseName()); - program->enable(); + program->bind(); m_cubemaps << ((program->uniformLocation("env") != -1) ? new GLRenderTargetCube(qMin(256, m_maxTextureSize)) : 0); - program->disable(); + program->release(); } if (m_programs.size() == 0) @@ -697,12 +699,12 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) // Don't render the environment if the environment texture can't be set for the correct sampler. if (glActiveTexture) { m_environment->bind(); - m_environmentProgram->enable(); + m_environmentProgram->bind(); m_environmentProgram->setUniformValue("tex", GLint(0)); m_environmentProgram->setUniformValue("env", GLint(1)); m_environmentProgram->setUniformValue("noise", GLint(2)); m_box->draw(); - m_environmentProgram->disable(); + m_environmentProgram->release(); m_environment->unbind(); } @@ -730,14 +732,14 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) else m_environment->bind(); } - m_programs[i]->enable(); + m_programs[i]->bind(); m_programs[i]->setUniformValue("tex", GLint(0)); m_programs[i]->setUniformValue("env", GLint(1)); m_programs[i]->setUniformValue("noise", GLint(2)); m_programs[i]->setUniformValue("view", view); m_programs[i]->setUniformValue("invView", invView); m_box->draw(); - m_programs[i]->disable(); + m_programs[i]->release(); if (glActiveTexture) { if (m_dynamicCubemap && m_cubemaps[i]) @@ -760,14 +762,14 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) m_environment->bind(); } - m_programs[m_currentShader]->enable(); + m_programs[m_currentShader]->bind(); m_programs[m_currentShader]->setUniformValue("tex", GLint(0)); m_programs[m_currentShader]->setUniformValue("env", GLint(1)); m_programs[m_currentShader]->setUniformValue("noise", GLint(2)); m_programs[m_currentShader]->setUniformValue("view", view); m_programs[m_currentShader]->setUniformValue("invView", invView); m_box->draw(); - m_programs[m_currentShader]->disable(); + m_programs[m_currentShader]->release(); if (glActiveTexture) { if (m_dynamicCubemap) @@ -1046,9 +1048,9 @@ void Scene::setColorParameter(const QString &name, QRgb color) { // set the color in all programs foreach (QGLShaderProgram *program, m_programs) { - program->enable(); + program->bind(); program->setUniformValue(program->uniformLocation(name), QColor(color)); - program->disable(); + program->release(); } } @@ -1056,9 +1058,9 @@ void Scene::setFloatParameter(const QString &name, float value) { // set the color in all programs foreach (QGLShaderProgram *program, m_programs) { - program->enable(); + program->bind(); program->setUniformValue(program->uniformLocation(name), value); - program->disable(); + program->release(); } } diff --git a/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp b/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp index 2997297..9a15f19 100644 --- a/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp +++ b/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp @@ -40,32 +40,32 @@ ****************************************************************************/ //! [0] -QGLShader shader(QGLShader::VertexShader); -shader.compile(code); +QGLShader shader(QGLShader::Vertex); +shader.compileSourceCode(code); QGLShaderProgram program(context); program.addShader(shader); program.link(); -program.enable(); +program.bind(); //! [0] //! [1] -program.addShader(QGLShader::VertexShader, +program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec4 vertex;\n" "attribute mediump mat4 matrix;\n" "void main(void)\n" "{\n" " gl_Position = matrix * vertex;\n" "}"); -program.addShader(QGLShader::FragmentShader, +program.addShaderFromSourceCode(QGLShader::Fragment, "uniform mediump vec4 color;\n" "void main(void)\n" "{\n" " gl_FragColor = color;\n" "}"); program.link(); -program.enable(); +program.bind(); int vertexLocation = program.attributeLocation("vertex"); int matrixLocation = program.attributeLocation("matrix"); @@ -84,9 +84,12 @@ QColor color(0, 255, 0, 255); QMatrix4x4 pmvMatrix; pmvMatrix.ortho(rect()); +program.enableAttributeArray(vertexLocation); program.setAttributeArray(vertexLocation, triangleVertices, 3); program.setUniformValue(matrixLocation, pmvMatrix); program.setUniformValue(colorLocation, color); glDrawArrays(GL_TRIANGLES, 0, 3); + +program.disableAttributeArray(vertexLocation); //! [2] diff --git a/examples/opengl/hellogl_es2/glwidget.cpp b/examples/opengl/hellogl_es2/glwidget.cpp index a31c34a..08e887a 100644 --- a/examples/opengl/hellogl_es2/glwidget.cpp +++ b/examples/opengl/hellogl_es2/glwidget.cpp @@ -92,6 +92,8 @@ void GLWidget::showBubbles(bool bubbles) void GLWidget::paintQtLogo() { + program1.enableAttributeArray(normalAttr1); + program1.enableAttributeArray(vertexAttr1); program1.setAttributeArray(vertexAttr1, vertices.constData()); program1.setAttributeArray(normalAttr1, normals.constData()); glDrawArrays(GL_TRIANGLES, 0, vertices.size()); @@ -159,6 +161,10 @@ void GLWidget::paintTexturedCube() program2.setUniformValue(textureUniform2, 0); // use texture unit 0 + program2.enableAttributeArray(vertexAttr2); + program2.enableAttributeArray(normalAttr2); + program2.enableAttributeArray(texCoordAttr2); + glDrawArrays(GL_TRIANGLES, 0, 36); program2.disableAttributeArray(vertexAttr2); @@ -173,7 +179,7 @@ void GLWidget::initializeGL () glGenTextures(1, &m_uiTexture); m_uiTexture = bindTexture(QImage(":/qt.png")); - QGLShader *vshader1 = new QGLShader(QGLShader::VertexShader, this); + QGLShader *vshader1 = new QGLShader(QGLShader::Vertex, this); const char *vsrc1 = "attribute highp vec4 vertex;\n" "attribute mediump vec3 normal;\n" @@ -188,16 +194,16 @@ void GLWidget::initializeGL () " color = clamp(color, 0.0, 1.0);\n" " gl_Position = matrix * vertex;\n" "}\n"; - vshader1->compile(vsrc1); + vshader1->compileSourceCode(vsrc1); - QGLShader *fshader1 = new QGLShader(QGLShader::FragmentShader, this); + QGLShader *fshader1 = new QGLShader(QGLShader::Fragment, this); const char *fsrc1 = "varying mediump vec4 color;\n" "void main(void)\n" "{\n" " gl_FragColor = color;\n" "}\n"; - fshader1->compile(fsrc1); + fshader1->compileSourceCode(fsrc1); program1.addShader(vshader1); program1.addShader(fshader1); @@ -207,7 +213,7 @@ void GLWidget::initializeGL () normalAttr1 = program1.attributeLocation("normal"); matrixUniform1 = program1.uniformLocation("matrix"); - QGLShader *vshader2 = new QGLShader(QGLShader::VertexShader); + QGLShader *vshader2 = new QGLShader(QGLShader::Vertex); const char *vsrc2 = "attribute highp vec4 vertex;\n" "attribute highp vec4 texCoord;\n" @@ -222,9 +228,9 @@ void GLWidget::initializeGL () " gl_Position = matrix * vertex;\n" " texc = texCoord;\n" "}\n"; - vshader2->compile(vsrc2); + vshader2->compileSourceCode(vsrc2); - QGLShader *fshader2 = new QGLShader(QGLShader::FragmentShader); + QGLShader *fshader2 = new QGLShader(QGLShader::Fragment); const char *fsrc2 = "varying highp vec4 texc;\n" "uniform sampler2D tex;\n" @@ -235,7 +241,7 @@ void GLWidget::initializeGL () " color = color * 0.2 + color * 0.8 * angle;\n" " gl_FragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n" "}\n"; - fshader2->compile(fsrc2); + fshader2->compileSourceCode(fsrc2); program2.addShader(vshader2); program2.addShader(fshader2); @@ -284,15 +290,15 @@ void GLWidget::paintGL() modelview.translate(0.0f, -0.2f, 0.0f); if (qtLogo) { - program1.enable(); + program1.bind(); program1.setUniformValue(matrixUniform1, modelview); paintQtLogo(); - program1.disable(); + program1.release(); } else { - program2.enable(); + program2.bind(); program1.setUniformValue(matrixUniform2, modelview); paintTexturedCube(); - program2.disable(); + program2.release(); } glDisable(GL_DEPTH_TEST); diff --git a/examples/opengl/textures/glwidget.cpp b/examples/opengl/textures/glwidget.cpp index 6efd31a..0f50e2d 100644 --- a/examples/opengl/textures/glwidget.cpp +++ b/examples/opengl/textures/glwidget.cpp @@ -99,7 +99,7 @@ void GLWidget::initializeGL() #define PROGRAM_VERTEX_ATTRIBUTE 0 #define PROGRAM_TEXCOORD_ATTRIBUTE 1 - QGLShader *vshader = new QGLShader(QGLShader::VertexShader, this); + QGLShader *vshader = new QGLShader(QGLShader::Vertex, this); const char *vsrc = "attribute highp vec4 vertex;\n" "attribute mediump vec4 texCoord;\n" @@ -110,9 +110,9 @@ void GLWidget::initializeGL() " gl_Position = matrix * vertex;\n" " texc = texCoord;\n" "}\n"; - vshader->compile(vsrc); + vshader->compileSourceCode(vsrc); - QGLShader *fshader = new QGLShader(QGLShader::FragmentShader, this); + QGLShader *fshader = new QGLShader(QGLShader::Fragment, this); const char *fsrc = "uniform sampler2D texture;\n" "varying mediump vec4 texc;\n" @@ -120,7 +120,7 @@ void GLWidget::initializeGL() "{\n" " gl_FragColor = texture2D(texture, texc.st);\n" "}\n"; - fshader->compile(fsrc); + fshader->compileSourceCode(fsrc); program = new QGLShaderProgram(this); program->addShader(vshader); @@ -129,7 +129,7 @@ void GLWidget::initializeGL() program->bindAttributeLocation("texCoord", PROGRAM_TEXCOORD_ATTRIBUTE); program->link(); - program->enable(); + program->bind(); program->setUniformValue("texture", 0); #endif @@ -163,6 +163,8 @@ void GLWidget::paintGL() m.rotate(zRot / 16.0f, 0.0f, 0.0f, 1.0f); program->setUniformValue("matrix", m); + program->enableAttributeArray(PROGRAM_VERTEX_ATTRIBUTE); + program->enableAttributeArray(PROGRAM_TEXCOORD_ATTRIBUTE); program->setAttributeArray (PROGRAM_VERTEX_ATTRIBUTE, vertices.constData()); program->setAttributeArray diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 40a6241..8a8f483 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -169,14 +169,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) source.clear(); source.append(qShaderSnippets[MainVertexShader]); source.append(qShaderSnippets[PositionOnlyVertexShader]); - vertexShader = new QGLShader(QGLShader::VertexShader, context, this); - vertexShader->compile(source); + vertexShader = new QGLShader(QGLShader::Vertex, context, this); + vertexShader->compileSourceCode(source); source.clear(); source.append(qShaderSnippets[MainFragmentShader]); source.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); - fragShader = new QGLShader(QGLShader::FragmentShader, context, this); - fragShader->compile(source); + fragShader = new QGLShader(QGLShader::Fragment, context, this); + fragShader->compileSourceCode(source); simpleShaderProg = new QGLShaderProgram(context, this); simpleShaderProg->addShader(vertexShader); @@ -192,14 +192,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) source.clear(); source.append(qShaderSnippets[MainWithTexCoordsVertexShader]); source.append(qShaderSnippets[UntransformedPositionVertexShader]); - vertexShader = new QGLShader(QGLShader::VertexShader, context, this); - vertexShader->compile(source); + vertexShader = new QGLShader(QGLShader::Vertex, context, this); + vertexShader->compileSourceCode(source); source.clear(); source.append(qShaderSnippets[MainFragmentShader]); source.append(qShaderSnippets[ImageSrcFragmentShader]); - fragShader = new QGLShader(QGLShader::FragmentShader, context, this); - fragShader->compile(source); + fragShader = new QGLShader(QGLShader::Fragment, context, this); + fragShader->compileSourceCode(source); blitShaderProg = new QGLShaderProgram(context, this); blitShaderProg->addShader(vertexShader); @@ -243,14 +243,14 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS source.append(qShaderSnippets[prog.compositionFragShader]); if (prog.maskFragShader) source.append(qShaderSnippets[prog.maskFragShader]); - QGLShader* fragShader = new QGLShader(QGLShader::FragmentShader, ctxGuard.context(), this); - fragShader->compile(source); + QGLShader* fragShader = new QGLShader(QGLShader::Fragment, ctxGuard.context(), this); + fragShader->compileSourceCode(source); source.clear(); source.append(qShaderSnippets[prog.mainVertexShader]); source.append(qShaderSnippets[prog.positionVertexShader]); - QGLShader* vertexShader = new QGLShader(QGLShader::VertexShader, ctxGuard.context(), this); - vertexShader->compile(source); + QGLShader* vertexShader = new QGLShader(QGLShader::Vertex, ctxGuard.context(), this); + vertexShader->compileSourceCode(source); #if defined(QT_DEBUG) // Name the shaders for easier debugging @@ -673,7 +673,7 @@ bool QGLEngineShaderManager::useCorrectShaderProg() currentShaderProg = sharedShaders->findProgramInCache(requiredProgram); if (currentShaderProg) { - currentShaderProg->program->enable(); + currentShaderProg->program->bind(); if (useCustomSrc) customSrcStage->setUniforms(currentShaderProg->program); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index a9744b3..d20700f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -246,7 +246,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray); glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray); - pex->shaderManager->blitProgram()->enable(); + pex->shaderManager->blitProgram()->bind(); pex->shaderManager->blitProgram()->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT); pex->shaderManager->setDirty(); @@ -395,7 +395,7 @@ void QGL2PaintEngineExPrivate::setBrush(const QBrush* brush) void QGL2PaintEngineExPrivate::useSimpleShader() { - shaderManager->simpleProgram()->enable(); + shaderManager->simpleProgram()->bind(); shaderManager->setDirty(); if (matrixDirty) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index e28c382..b4191dc 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE The following example creates a vertex shader program using the supplied source \c{code}. Once compiled and linked, the shader program is activated in the current QGLContext by calling - QGLShaderProgram::enable(): + QGLShaderProgram::bind(): \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 0 @@ -125,11 +125,11 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QGLShader::ShaderTypeBits + \enum QGLShader::ShaderTypeBit This enum specifies the type of QGLShader that is being created. - \value VertexShader Vertex shader written in the OpenGL Shading Language (GLSL). - \value FragmentShader Fragment shader written in the OpenGL Shading Language (GLSL). + \value Vertex Vertex shader written in the OpenGL Shading Language (GLSL). + \value Fragment Fragment shader written in the OpenGL Shading Language (GLSL). */ #ifndef GL_FRAGMENT_SHADER @@ -211,7 +211,7 @@ bool QGLShaderPrivate::create() return false; if (qt_resolve_glsl_extensions(const_cast(context))) { GLuint shader; - if (shaderType == QGLShader::VertexShader) + if (shaderType == QGLShader::Vertex) shader = glCreateShader(GL_VERTEX_SHADER); else shader = glCreateShader(GL_FRAGMENT_SHADER); @@ -266,14 +266,14 @@ void QGLShaderPrivate::deleteShader() /*! Constructs a new QGLShader object of the specified \a type and attaches it to \a parent. If shader programs are not supported, - QGLShaderProgram::hasShaderPrograms() will return false. + QGLShaderProgram::hasOpenGLShaderPrograms() will return false. - This constructor is normally followed by a call to compile() - or compileFile(). + This constructor is normally followed by a call to compileSourceCode() + or compileSourceFile(). The shader will be associated with the current QGLContext. - \sa compile(), compileFile() + \sa compileSourceCode(), compileSourceFile() */ QGLShader::QGLShader(QGLShader::ShaderType type, QObject *parent) : QObject(*new QGLShaderPrivate(QGLContext::currentContext(), type), parent) @@ -283,45 +283,19 @@ QGLShader::QGLShader(QGLShader::ShaderType type, QObject *parent) } /*! - Constructs a new QGLShader object of the specified \a type from the - source code in \a fileName and attaches it to \a parent. - If the shader could not be loaded, then isCompiled() will return false. - - The shader will be associated with the current QGLContext. - - \sa isCompiled() -*/ -QGLShader::QGLShader - (const QString& fileName, QGLShader::ShaderType type, QObject *parent) - : QObject(*new QGLShaderPrivate(QGLContext::currentContext(), type), parent) -{ - Q_D(QGLShader); - if (d->create() && !compileFile(fileName)) - d->deleteShader(); -} - -static inline const QGLContext *contextOrCurrent(const QGLContext *context) -{ - if (context) - return context; - else - return QGLContext::currentContext(); -} - -/*! Constructs a new QGLShader object of the specified \a type and attaches it to \a parent. If shader programs are not supported, - then QGLShaderProgram::hasShaderPrograms() will return false. + then QGLShaderProgram::hasOpenGLShaderPrograms() will return false. - This constructor is normally followed by a call to compile() - or compileFile(). + This constructor is normally followed by a call to compileSourceCode() + or compileSourceFile(). The shader will be associated with \a context. - \sa compile(), compileFile() + \sa compileSourceCode(), compileSourceFile() */ QGLShader::QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent) - : QObject(*new QGLShaderPrivate(contextOrCurrent(context), type), parent) + : QObject(*new QGLShaderPrivate(context ? context : QGLContext::currentContext(), type), parent) { Q_D(QGLShader); #ifndef QT_NO_DEBUG @@ -334,30 +308,6 @@ QGLShader::QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObj } /*! - Constructs a new QGLShader object of the specified \a type from the - source code in \a fileName and attaches it to \a parent. - If the shader could not be loaded, then isCompiled() will return false. - - The shader will be associated with \a context. - - \sa isCompiled() -*/ -QGLShader::QGLShader - (const QString& fileName, QGLShader::ShaderType type, const QGLContext *context, QObject *parent) - : QObject(*new QGLShaderPrivate(contextOrCurrent(context), type), parent) -{ - Q_D(QGLShader); -#ifndef QT_NO_DEBUG - if (context && !QGLContext::areSharing(context, QGLContext::currentContext())) { - qWarning("QGLShader::QGLShader: \'context\' must be current context or sharing with it."); - return; - } -#endif - if (d->create() && !compileFile(fileName)) - d->deleteShader(); -} - -/*! Deletes this shader. If the shader has been attached to a QGLShaderProgram object, then the actual shader will stay around until the QGLShaderProgram is destroyed. @@ -400,9 +350,9 @@ static const char redefineHighp[] = Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - \sa compileFile() + \sa compileSourceFile() */ -bool QGLShader::compile(const char *source) +bool QGLShader::compileSourceCode(const char *source) { Q_D(QGLShader); if (d->shaderGuard.id()) { @@ -431,7 +381,7 @@ bool QGLShader::compile(const char *source) srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP - if (d->shaderType == FragmentShader) { + if (d->shaderType == Fragment) { src.append(redefineHighp); srclen.append(GLint(sizeof(redefineHighp) - 1)); } @@ -451,11 +401,11 @@ bool QGLShader::compile(const char *source) Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - \sa compileFile() + \sa compileSourceFile() */ -bool QGLShader::compile(const QByteArray& source) +bool QGLShader::compileSourceCode(const QByteArray& source) { - return compile(source.constData()); + return compileSourceCode(source.constData()); } /*! @@ -464,11 +414,11 @@ bool QGLShader::compile(const QByteArray& source) Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - \sa compileFile() + \sa compileSourceFile() */ -bool QGLShader::compile(const QString& source) +bool QGLShader::compileSourceCode(const QString& source) { - return compile(source.toLatin1().constData()); + return compileSourceCode(source.toLatin1().constData()); } /*! @@ -476,9 +426,9 @@ bool QGLShader::compile(const QString& source) and compiles it. Returns true if the file could be opened and the source compiled, false otherwise. - \sa compile() + \sa compileSourceCode() */ -bool QGLShader::compileFile(const QString& fileName) +bool QGLShader::compileSourceFile(const QString& fileName) { QFile file(fileName); if (!file.open(QFile::ReadOnly)) { @@ -487,13 +437,13 @@ bool QGLShader::compileFile(const QString& fileName) } QByteArray contents = file.readAll(); - return compile(contents.constData()); + return compileSourceCode(contents.constData()); } /*! Returns the source code for this shader. - \sa compile() + \sa compileSourceCode() */ QByteArray QGLShader::sourceCode() const { @@ -516,7 +466,7 @@ QByteArray QGLShader::sourceCode() const /*! Returns true if this shader has been compiled; false otherwise. - \sa compile() + \sa compileSourceCode(), compileSourceFile() */ bool QGLShader::isCompiled() const { @@ -527,7 +477,7 @@ bool QGLShader::isCompiled() const /*! Returns the errors and warnings that occurred during the last compile. - \sa compile() + \sa compileSourceCode(), compileSourceFile() */ QString QGLShader::log() const { @@ -666,6 +616,7 @@ bool QGLShaderProgram::init() is deleted. This allows the caller to add the same shader to multiple shader programs. + \sa addShaderFromSourceCode(), addShaderFromSourceFile() \sa removeShader(), link(), removeAllShaders() */ bool QGLShaderProgram::addShader(QGLShader *shader) @@ -705,15 +656,16 @@ bool QGLShaderProgram::addShader(QGLShader *shader) adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first. + \sa addShader(), addShaderFromSourceFile() \sa removeShader(), link(), log(), removeAllShaders() */ -bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const char *source) +bool QGLShaderProgram::addShaderFromSourceCode(QGLShader::ShaderType type, const char *source) { Q_D(QGLShaderProgram); if (!init()) return false; QGLShader *shader = new QGLShader(type, this); - if (!shader->compile(source)) { + if (!shader->compileSourceCode(source)) { d->log = shader->log(); delete shader; return false; @@ -734,11 +686,12 @@ bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const char *source) adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first. + \sa addShader(), addShaderFromSourceFile() \sa removeShader(), link(), log(), removeAllShaders() */ -bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QByteArray& source) +bool QGLShaderProgram::addShaderFromSourceCode(QGLShader::ShaderType type, const QByteArray& source) { - return addShader(type, source.constData()); + return addShaderFromSourceCode(type, source.constData()); } /*! @@ -753,11 +706,12 @@ bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QByteArray& s adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first. + \sa addShader(), addShaderFromSourceFile() \sa removeShader(), link(), log(), removeAllShaders() */ -bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QString& source) +bool QGLShaderProgram::addShaderFromSourceCode(QGLShader::ShaderType type, const QString& source) { - return addShader(type, source.toLatin1().constData()); + return addShaderFromSourceCode(type, source.toLatin1().constData()); } /*! @@ -770,16 +724,16 @@ bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QString& sour adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first. - \sa addShader() + \sa addShader(), addShaderFromSourceCode() */ -bool QGLShaderProgram::addShaderFromFile +bool QGLShaderProgram::addShaderFromSourceFile (QGLShader::ShaderType type, const QString& fileName) { Q_D(QGLShaderProgram); if (!init()) return false; QGLShader *shader = new QGLShader(type, this); - if (!shader->compileFile(fileName)) { + if (!shader->compileSourceFile(fileName)) { d->log = shader->log(); delete shader; return false; @@ -912,14 +866,16 @@ QString QGLShaderProgram::log() const } /*! - Enable use of this shader program in the currently active QGLContext. - Returns true if the program was successfully enabled; false - otherwise. If the shader program has not yet been linked, + Binds this shader program to the active QGLContext and makes + it the current shader program. Any previously bound shader program + is released. This is equivalent to calling \c{glUseProgram()} on + programId(). Returns true if the program was successfully bound; + false otherwise. If the shader program has not yet been linked, or it needs to be re-linked, this function will call link(). - \sa link(), disable() + \sa link(), release() */ -bool QGLShaderProgram::enable() +bool QGLShaderProgram::bind() { Q_D(QGLShaderProgram); GLuint program = d->programGuard.id(); @@ -927,6 +883,12 @@ bool QGLShaderProgram::enable() return false; if (!d->linked && !link()) return false; +#ifndef QT_NO_DEBUG + if (!QGLContext::areSharing(d->programGuard.context(), QGLContext::currentContext())) { + qWarning("QGLShaderProgram::bind: program is not valid in the current context."); + return false; + } +#endif glUseProgram(program); return true; } @@ -935,13 +897,18 @@ bool QGLShaderProgram::enable() #define ctx QGLContext::currentContext() /*! - Disables the active shader program in the current QGLContext. + Releases the active shader program from the current QGLContext. This is equivalent to calling \c{glUseProgram(0)}. - \sa enable() + \sa bind() */ -void QGLShaderProgram::disable() +void QGLShaderProgram::release() { +#ifndef QT_NO_DEBUG + Q_D(QGLShaderProgram); + if (!QGLContext::areSharing(d->programGuard.context(), QGLContext::currentContext())) + qWarning("QGLShaderProgram::release: program is not valid in the current context."); +#endif #if defined(QT_OPENGL_ES_2) glUseProgram(0); #else @@ -1331,22 +1298,26 @@ void QGLShaderProgram::setAttributeValue /*! Sets an array of vertex \a values on the attribute at \a location - in this shader program. The \a size indicates the number of + in this shader program. The \a tupleSize indicates the number of components per vertex (1, 2, 3, or 4), and the \a stride indicates the number of bytes between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray - (int location, const GLfloat *values, int size, int stride) + (int location, const GLfloat *values, int tupleSize, int stride) { Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - glVertexAttribPointer(location, size, GL_FLOAT, GL_FALSE, + glVertexAttribPointer(location, tupleSize, GL_FLOAT, GL_FALSE, stride, values); - glEnableVertexAttribArray(location); } } @@ -1356,7 +1327,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (int location, const QVector2D *values, int stride) @@ -1366,7 +1342,6 @@ void QGLShaderProgram::setAttributeArray if (location != -1) { glVertexAttribPointer(location, 2, GL_FLOAT, GL_FALSE, stride, values); - glEnableVertexAttribArray(location); } } @@ -1376,7 +1351,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (int location, const QVector3D *values, int stride) @@ -1386,7 +1366,6 @@ void QGLShaderProgram::setAttributeArray if (location != -1) { glVertexAttribPointer(location, 3, GL_FLOAT, GL_FALSE, stride, values); - glEnableVertexAttribArray(location); } } @@ -1396,7 +1375,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (int location, const QVector4D *values, int stride) @@ -1406,7 +1390,6 @@ void QGLShaderProgram::setAttributeArray if (location != -1) { glVertexAttribPointer(location, 4, GL_FLOAT, GL_FALSE, stride, values); - glEnableVertexAttribArray(location); } } @@ -1414,17 +1397,22 @@ void QGLShaderProgram::setAttributeArray \overload Sets an array of vertex \a values on the attribute called \a name - in this shader program. The \a size indicates the number of + in this shader program. The \a tupleSize indicates the number of components per vertex (1, 2, 3, or 4), and the \a stride indicates the number of bytes between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray - (const char *name, const GLfloat *values, int size, int stride) + (const char *name, const GLfloat *values, int tupleSize, int stride) { - setAttributeArray(attributeLocation(name), values, size, stride); + setAttributeArray(attributeLocation(name), values, tupleSize, stride); } /*! @@ -1435,7 +1423,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (const char *name, const QVector2D *values, int stride) @@ -1451,7 +1444,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (const char *name, const QVector3D *values, int stride) @@ -1467,7 +1465,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (const char *name, const QVector4D *values, int stride) @@ -1476,10 +1479,42 @@ void QGLShaderProgram::setAttributeArray } /*! + Enables the vertex array at \a location in this shader program + so that the value set by setAttributeArray() on \a location + will be used by the shader program. + + \sa disableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() +*/ +void QGLShaderProgram::enableAttributeArray(int location) +{ + Q_D(QGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + glEnableVertexAttribArray(location); +} + +/*! + \overload + + Enables the vertex array called \a name in this shader program + so that the value set by setAttributeArray() on \a name + will be used by the shader program. + + \sa disableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() +*/ +void QGLShaderProgram::enableAttributeArray(const char *name) +{ + enableAttributeArray(attributeLocation(name)); +} + +/*! Disables the vertex array at \a location in this shader program - that was enabled by a previous call to setAttributeArray(). + that was enabled by a previous call to enableAttributeArray(). - \sa setAttributeArray(), setAttributeValue(), setUniformValue() + \sa enableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() */ void QGLShaderProgram::disableAttributeArray(int location) { @@ -1493,9 +1528,10 @@ void QGLShaderProgram::disableAttributeArray(int location) \overload Disables the vertex array called \a name in this shader program - that was enabled by a previous call to setAttributeArray(). + that was enabled by a previous call to enableAttributeArray(). - \sa setAttributeArray(), setAttributeValue(), setUniformValue() + \sa enableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() */ void QGLShaderProgram::disableAttributeArray(const char *name) { @@ -2363,25 +2399,25 @@ void QGLShaderProgram::setUniformValueArray /*! Sets the uniform variable array at \a location in the current context to the \a count elements of \a values. Each element - has \a size components. The \a size must be 1, 2, 3, or 4. + has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4. \sa setAttributeValue() */ -void QGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, int count, int size) +void QGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize) { Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - if (size == 1) + if (tupleSize == 1) glUniform1fv(location, count, values); - else if (size == 2) + else if (tupleSize == 2) glUniform2fv(location, count, values); - else if (size == 3) + else if (tupleSize == 3) glUniform3fv(location, count, values); - else if (size == 4) + else if (tupleSize == 4) glUniform4fv(location, count, values); else - qWarning() << "QGLShaderProgram::setUniformValue: size" << size << "not supported"; + qWarning() << "QGLShaderProgram::setUniformValue: size" << tupleSize << "not supported"; } } @@ -2390,14 +2426,14 @@ void QGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, Sets the uniform variable array called \a name in the current context to the \a count elements of \a values. Each element - has \a size components. The \a size must be 1, 2, 3, or 4. + has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4. \sa setAttributeValue() */ void QGLShaderProgram::setUniformValueArray - (const char *name, const GLfloat *values, int count, int size) + (const char *name, const GLfloat *values, int count, int tupleSize) { - setUniformValueArray(uniformLocation(name), values, count, size); + setUniformValueArray(uniformLocation(name), values, count, tupleSize); } /*! @@ -2800,7 +2836,7 @@ void QGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x4 * The \a context is used to resolve the GLSL extensions. If \a context is null, then QGLContext::currentContext() is used. */ -bool QGLShaderProgram::hasShaderPrograms(const QGLContext *context) +bool QGLShaderProgram::hasOpenGLShaderPrograms(const QGLContext *context) { #if !defined(QT_OPENGL_ES_2) if (!context) @@ -2825,8 +2861,6 @@ void QGLShaderProgram::shaderDestroyed() removeShader(shader); } -#endif - #ifdef Q_MAC_COMPAT_GL_FUNCTIONS /*! \internal */ void QGLShaderProgram::setUniformValue(int location, QMacCompatGLint value) @@ -2877,4 +2911,6 @@ void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGL } #endif +#endif // !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) + QT_END_NAMESPACE diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index 49c3364..deeaee2 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -63,25 +63,23 @@ class Q_OPENGL_EXPORT QGLShader : public QObject { Q_OBJECT public: - enum ShaderTypeBits + enum ShaderTypeBit { - VertexShader = 0x0001, - FragmentShader = 0x0002 + Vertex = 0x0001, + Fragment = 0x0002 }; - Q_DECLARE_FLAGS(ShaderType, ShaderTypeBits) + Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit) explicit QGLShader(QGLShader::ShaderType type, QObject *parent = 0); - QGLShader(const QString& fileName, QGLShader::ShaderType type, QObject *parent = 0); QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0); - QGLShader(const QString& fileName, QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0); virtual ~QGLShader(); QGLShader::ShaderType shaderType() const; - bool compile(const char *source); - bool compile(const QByteArray& source); - bool compile(const QString& source); - bool compileFile(const QString& fileName); + bool compileSourceCode(const char *source); + bool compileSourceCode(const QByteArray& source); + bool compileSourceCode(const QString& source); + bool compileSourceFile(const QString& fileName); QByteArray sourceCode() const; @@ -114,10 +112,10 @@ public: void removeShader(QGLShader *shader); QList shaders() const; - bool addShader(QGLShader::ShaderType type, const char *source); - bool addShader(QGLShader::ShaderType type, const QByteArray& source); - bool addShader(QGLShader::ShaderType type, const QString& source); - bool addShaderFromFile(QGLShader::ShaderType type, const QString& fileName); + bool addShaderFromSourceCode(QGLShader::ShaderType type, const char *source); + bool addShaderFromSourceCode(QGLShader::ShaderType type, const QByteArray& source); + bool addShaderFromSourceCode(QGLShader::ShaderType type, const QString& source); + bool addShaderFromSourceFile(QGLShader::ShaderType type, const QString& fileName); void removeAllShaders(); @@ -125,8 +123,8 @@ public: bool isLinked() const; QString log() const; - bool enable(); - static void disable(); + bool bind(); + void release(); GLuint programId() const; @@ -159,7 +157,7 @@ public: void setAttributeValue(const char *name, const GLfloat *values, int columns, int rows); void setAttributeArray - (int location, const GLfloat *values, int size, int stride = 0); + (int location, const GLfloat *values, int tupleSize, int stride = 0); void setAttributeArray (int location, const QVector2D *values, int stride = 0); void setAttributeArray @@ -167,13 +165,16 @@ public: void setAttributeArray (int location, const QVector4D *values, int stride = 0); void setAttributeArray - (const char *name, const GLfloat *values, int size, int stride = 0); + (const char *name, const GLfloat *values, int tupleSize, int stride = 0); void setAttributeArray (const char *name, const QVector2D *values, int stride = 0); void setAttributeArray (const char *name, const QVector3D *values, int stride = 0); void setAttributeArray (const char *name, const QVector4D *values, int stride = 0); + + void enableAttributeArray(int location); + void enableAttributeArray(const char *name); void disableAttributeArray(int location); void disableAttributeArray(const char *name); @@ -244,7 +245,7 @@ public: void setUniformValue(const char *name, const GLfloat value[4][4]); void setUniformValue(const char *name, const QTransform& value); - void setUniformValueArray(int location, const GLfloat *values, int count, int size); + void setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize); void setUniformValueArray(int location, const GLint *values, int count); void setUniformValueArray(int location, const GLuint *values, int count); void setUniformValueArray(int location, const QVector2D *values, int count); @@ -260,7 +261,7 @@ public: void setUniformValueArray(int location, const QMatrix4x3 *values, int count); void setUniformValueArray(int location, const QMatrix4x4 *values, int count); - void setUniformValueArray(const char *name, const GLfloat *values, int count, int size); + void setUniformValueArray(const char *name, const GLfloat *values, int count, int tupleSize); void setUniformValueArray(const char *name, const GLint *values, int count); void setUniformValueArray(const char *name, const GLuint *values, int count); void setUniformValueArray(const char *name, const QVector2D *values, int count); @@ -276,7 +277,7 @@ public: void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count); void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count); - static bool hasShaderPrograms(const QGLContext *context = 0); + static bool hasOpenGLShaderPrograms(const QGLContext *context = 0); private Q_SLOTS: void shaderDestroyed(); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index ebe101d..f1f5976 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -625,7 +625,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & QGLShaderProgram *blitProgram = QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram(); - blitProgram->enable(); + blitProgram->bind(); blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/); // The shader manager's blit program does not multiply the -- cgit v0.12 From 40914841ea59d3c7a0c1d0baf5f82af23b79e63f Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 4 Nov 2009 18:30:43 +0100 Subject: Revert last commit to configure, only configure.exe needed the fix Reviewed-By: con --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 611f4bf..9c3e417 100755 --- a/configure +++ b/configure @@ -4185,7 +4185,7 @@ fi if [ -n "$EVALKEY" ]; then cat > "$outpath/src/corelib/global/qconfig_eval.cpp" < Date: Wed, 4 Nov 2009 15:57:33 +0100 Subject: Fixed soft-light composition mode in raster and OpenGL1. Updated the soft-light composition mode implementation in the raster and OpenGL1 engines to use the equations in the SVG specification as of April 2009. Task-number: QTBUG-3193 Reviewed-by: Trond --- src/gui/painting/qdrawhelper.cpp | 22 +- src/opengl/util/composition_mode_softlight.glsl | 24 +- src/opengl/util/fragmentprograms_p.h | 676 ++++++++++++------------ 3 files changed, 371 insertions(+), 351 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 41602a1..4df7f8a 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2386,12 +2386,12 @@ static void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int len } /* - if 2.Sca < Sa - Dca' = Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa) - otherwise if 8.Dca <= Da - Dca' = Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa).(3 - 8.Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) - otherwise - Dca' = (Dca.Sa + ((Dca/Da)^(0.5).Da - Dca).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa) + if 2.Sca <= Sa + Dca' = Dca.(Sa + (2.Sca - Sa).(1 - Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) + otherwise if 2.Sca > Sa and 4.Dca <= Da + Dca' = Dca.Sa + Da.(2.Sca - Sa).(4.Dca/Da.(4.Dca/Da + 1).(Dca/Da - 1) + 7.Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) + otherwise if 2.Sca > Sa and 4.Dca > Da + Dca' = Dca.Sa + Da.(2.Sca - Sa).((Dca/Da)^0.5 - Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) */ static inline int soft_light_op(int dst, int src, int da, int sa) { @@ -2400,13 +2400,11 @@ static inline int soft_light_op(int dst, int src, int da, int sa) const int temp = (src * (255 - da) + dst * (255 - sa)) * 255; if (src2 < sa) - return (dst * ((sa * 255) - (255 - dst_np) * (src2 - sa)) + temp) / 65025; - else if (8 * dst <= da) - return (dst * ((sa * 255) - ((255 - dst_np) * (src2 - sa) * ((3 * 255) - 8 * dst_np)) / 255) + temp) / 65025; + return (dst * (sa * 255 + (src2 - sa) * (255 - dst_np)) + temp) / 65025; + else if (4 * dst <= da) + return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; else { - // sqrt is too expensive to do three times per pixel, so skipping it for now - // a future possibility is to use a LUT - return ((dst * sa * 255) + (int(dst_np) * da - (dst * 255)) * (src2 - sa) + temp) / 65025; + return (dst * sa * 255 + da * (src2 - sa) * (int(sqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; } } diff --git a/src/opengl/util/composition_mode_softlight.glsl b/src/opengl/util/composition_mode_softlight.glsl index 4777b74..e4c1f89 100644 --- a/src/opengl/util/composition_mode_softlight.glsl +++ b/src/opengl/util/composition_mode_softlight.glsl @@ -1,18 +1,22 @@ -// Dca' = 2.Sca < Sa ? -// Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa) : -// (8.Dca <= Da ? -// Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa).(3 - 8.Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) : -// (Dca.Sa + ((Dca/Da)^(0.5).Da - Dca).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa)) +// if 2.Sca <= Sa +// Dca' = Dca.(Sa + (2.Sca - Sa).(1 - Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) +// otherwise if 2.Sca > Sa and 4.Dca <= Da +// Dca' = Dca.Sa + Da.(2.Sca - Sa).(4.Dca/Da.(4.Dca/Da + 1).(Dca/Da - 1) + 7.Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) +// otherwise if 2.Sca > Sa and 4.Dca > Da +// Dca' = Dca.Sa + Da.(2.Sca - Sa).((Dca/Da)^0.5 - Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da + vec4 composite(vec4 src, vec4 dst) { vec4 result; float da = max(dst.a, 0.00001); - result.rgb = mix(dst.rgb * (src.a - (1.0 - dst.rgb / da) * (2.0 * src.rgb - src.a)), - mix(dst.rgb * (src.a - (1.0 - dst.rgb / da) * (2.0 * src.rgb - src.a) * (3.0 - 8.0 * dst.rgb / da)), - (dst.rgb * src.a + (sqrt(dst.rgb / da) * dst.a - dst.rgb) * (2.0 * src.rgb - src.a)), - step(dst.a, 8.0 * dst.rgb)), - step(src.a, 2.0 * src.rgb)) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); + vec3 dst_np = dst.rgb / da; + result.rgb = mix(dst.rgb * (src.a + (2.0 * src.rgb - src.a) * (1.0 - dst_np)), + mix(dst.rgb * src.a + dst.a * (2.0 * src.rgb - src.a) * ((16.0 * dst_np - 12.0) * dst_np + 3.0) * dst_np, + dst.rgb * src.a + dst.a * (2.0 * src.rgb - src.a) * (sqrt(dst_np) - dst_np), + step(dst.a, 4.0 * dst.rgb)), + step(src.a, 2.0 * src.rgb)) + + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); result.a = src.a + dst.a - src.a * dst.a; return result; } diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h index 9154c6e..2241057 100644 --- a/src/opengl/util/fragmentprograms_p.h +++ b/src/opengl/util/fragmentprograms_p.h @@ -519,8 +519,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..3],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -530,30 +530,31 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MUL R0.xy, fragment.position, c[1];\n" "TEX R0, R0, texture[0], 2D;\n" "MAX R1.x, R0.w, c[4].z;\n" - "RCP R1.w, R1.x;\n" - "MUL R1.xyz, R0, R1.w;\n" - "MUL R4.xyz, -R1, c[4].w;\n" - "RSQ R2.x, R1.x;\n" - "RSQ R2.z, R1.z;\n" - "RSQ R2.y, R1.y;\n" - "MAD R1.xyz, -R0, R1.w, c[4].x;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R3.xyz, R0.w, R2, -R0;\n" - "MAD R2.xyz, fragment.color.primary, c[4].y, -fragment.color.primary.w;\n" - "MUL R3.xyz, R2, R3;\n" - "ADD R5.xyz, R4, c[5].x;\n" - "MUL R4.xyz, R1, R2;\n" - "MAD R1.xyz, -R1, R2, fragment.color.primary.w;\n" + "RCP R1.x, R1.x;\n" + "MUL R2.xyz, R0, R1.x;\n" + "MAD R1.xyz, R2, c[5].x, -c[5].y;\n" + "MAD R3.xyz, R2, R1, c[5].z;\n" + "MAD R1.xyz, fragment.color.primary, c[4].y, -fragment.color.primary.w;\n" + "MUL R4.xyz, R0.w, R1;\n" + "MUL R5.xyz, R4, R3;\n" + "RSQ R1.w, R2.x;\n" + "RSQ R2.w, R2.z;\n" + "RCP R3.x, R1.w;\n" + "RSQ R1.w, R2.y;\n" + "MUL R5.xyz, R2, R5;\n" + "RCP R3.z, R2.w;\n" + "RCP R3.y, R1.w;\n" + "ADD R3.xyz, -R2, R3;\n" + "MUL R3.xyz, R4, R3;\n" + "ADD R2.xyz, -R2, c[4].x;\n" + "MAD R1.xyz, R1, R2, fragment.color.primary.w;\n" "MUL R2.xyz, fragment.color.primary, c[4].y;\n" - "MAD R5.xyz, -R4, R5, fragment.color.primary.w;\n" + "MAD R4.xyz, fragment.color.primary.w, R0, R5;\n" "MAD R3.xyz, fragment.color.primary.w, R0, R3;\n" - "MAD R4.xyz, -R0, R5, R3;\n" + "ADD R5.xyz, R3, -R4;\n" "MUL R3.xyz, R0, c[4].w;\n" - "MUL R5.xyz, R0, R5;\n" "SGE R3.xyz, R3, R0.w;\n" - "MAD R3.xyz, R3, R4, R5;\n" + "MAD R3.xyz, R3, R5, R4;\n" "MAD R3.xyz, -R0, R1, R3;\n" "MUL R1.xyz, R0, R1;\n" "SGE R2.xyz, R2, fragment.color.primary.w;\n" @@ -861,8 +862,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[3] = { program.local[0],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -872,30 +873,31 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MUL R0.xy, fragment.position, c[0];\n" "TEX R0, R0, texture[0], 2D;\n" "MAX R1.x, R0.w, c[1].z;\n" - "RCP R1.w, R1.x;\n" - "MUL R1.xyz, R0, R1.w;\n" - "MUL R4.xyz, -R1, c[1].w;\n" - "RSQ R2.x, R1.x;\n" - "RSQ R2.z, R1.z;\n" - "RSQ R2.y, R1.y;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R3.xyz, R0.w, R2, -R0;\n" - "MAD R2.xyz, fragment.color.primary, c[1].y, -fragment.color.primary.w;\n" - "MUL R3.xyz, R2, R3;\n" + "RCP R1.x, R1.x;\n" + "MUL R2.xyz, R0, R1.x;\n" + "MAD R1.xyz, R2, c[2].x, -c[2].y;\n" + "MAD R3.xyz, R2, R1, c[2].z;\n" + "MAD R1.xyz, fragment.color.primary, c[1].y, -fragment.color.primary.w;\n" + "MUL R4.xyz, R0.w, R1;\n" + "MUL R5.xyz, R4, R3;\n" + "RSQ R1.w, R2.x;\n" + "RCP R3.x, R1.w;\n" + "RSQ R2.w, R2.z;\n" + "RSQ R1.w, R2.y;\n" + "MUL R5.xyz, R2, R5;\n" + "RCP R3.z, R2.w;\n" + "RCP R3.y, R1.w;\n" + "ADD R3.xyz, -R2, R3;\n" + "MUL R3.xyz, R4, R3;\n" + "ADD R2.xyz, -R2, c[1].x;\n" + "MAD R1.xyz, R1, R2, fragment.color.primary.w;\n" + "MUL R2.xyz, fragment.color.primary, c[1].y;\n" + "MAD R4.xyz, fragment.color.primary.w, R0, R5;\n" "MAD R3.xyz, fragment.color.primary.w, R0, R3;\n" - "MAD R1.xyz, -R0, R1.w, c[1].x;\n" - "ADD R5.xyz, R4, c[2].x;\n" - "MUL R4.xyz, R1, R2;\n" - "MAD R1.xyz, -R1, R2, fragment.color.primary.w;\n" - "MAD R5.xyz, -R4, R5, fragment.color.primary.w;\n" - "MAD R4.xyz, -R0, R5, R3;\n" + "ADD R5.xyz, R3, -R4;\n" "MUL R3.xyz, R0, c[1].w;\n" - "MUL R2.xyz, fragment.color.primary, c[1].y;\n" - "MUL R5.xyz, R0, R5;\n" "SGE R3.xyz, R3, R0.w;\n" - "MAD R3.xyz, R3, R4, R5;\n" + "MAD R3.xyz, R3, R5, R4;\n" "MAD R3.xyz, -R0, R1, R3;\n" "MUL R1.xyz, R0, R1;\n" "SGE R2.xyz, R2, fragment.color.primary.w;\n" @@ -1457,7 +1459,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..8],\n" " { 2, 4, 1, 9.9999997e-006 },\n" - " { 8, 3 } };\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -1469,53 +1471,55 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MAD R0.xyz, fragment.position.x, c[2], R0;\n" "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAX R0.w, R1, c[9];\n" - "RCP R2.w, R0.w;\n" - "MUL R5.xyz, R1, R2.w;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" "ADD R0.z, R0, R0.w;\n" "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MOV R0.x, c[9];\n" - "RSQ R2.x, R5.x;\n" - "RSQ R2.z, R5.z;\n" - "RSQ R2.y, R5.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0.z, c[9];\n" + "MUL R0.x, R0, c[9];\n" + "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MAD R0.y, R0.x, R0.x, -R0;\n" + "RSQ R0.y, R0.y;\n" + "RCP R0.y, R0.y;\n" + "ADD R0.y, -R0.x, R0;\n" + "MOV R0.x, c[9];\n" + "MUL R0.x, R0, c[1];\n" + "MAX R0.z, R1.w, c[9].w;\n" + "RCP R0.z, R0.z;\n" + "MUL R3.xyz, R1, R0.z;\n" + "MAD R4.xyz, R3, c[10].x, -c[10].y;\n" + "RCP R0.x, R0.x;\n" + "MUL R0.x, R0.y, R0;\n" "TEX R0, R0, texture[2], 1D;\n" - "MAD R3.xyz, R0, c[9].x, -R0.w;\n" - "MAD R6.xyz, -R5, c[10].x, c[10].y;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R3, R2;\n" - "MAD R4.xyz, R0.w, R1, R2;\n" - "MAD R2.xyz, -R1, R2.w, c[9].z;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" - "MAD R5.xyz, -R1, R6, R4;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R2.xyz, R0, c[9].x, -R0.w;\n" + "MAD R4.xyz, R3, R4, c[10].z;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[9].z;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[9].x;\n" - "MUL R4.xyz, R1, c[10].x;\n" - "SGE R3.xyz, R3, R0.w;\n" - "ADD R2.w, -R1, c[9].z;\n" - "MUL R6.xyz, R1, R6;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "ADD R6.xyz, R4, -R5;\n" + "MUL R4.xyz, R1, c[9].y;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" + "SGE R3.xyz, R3, R0.w;\n" "MUL R2.xyz, R1, R2;\n" + "ADD R2.w, -R1, c[9].z;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "ADD R0.x, -R0.w, c[9].z;\n" @@ -2060,7 +2064,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..5],\n" " { 2, 4, 1, 9.9999997e-006 },\n" - " { 8, 3 } };\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2072,49 +2076,51 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MAD R0.xyz, fragment.position.x, c[2], R0;\n" "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAX R0.w, R1, c[6];\n" - "RCP R2.w, R0.w;\n" - "MUL R5.xyz, R1, R2.w;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" "ADD R0.z, R0, R0.w;\n" "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MOV R0.x, c[6];\n" - "RSQ R2.x, R5.x;\n" - "RSQ R2.z, R5.z;\n" - "RSQ R2.y, R5.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MAD R0.y, R0.x, R0.x, -R0;\n" + "RSQ R0.y, R0.y;\n" + "RCP R0.y, R0.y;\n" + "ADD R0.y, -R0.x, R0;\n" + "MOV R0.x, c[6];\n" + "MUL R0.x, R0, c[1];\n" + "MAX R0.z, R1.w, c[6].w;\n" + "RCP R0.z, R0.z;\n" + "MUL R3.xyz, R1, R0.z;\n" + "MAD R4.xyz, R3, c[7].x, -c[7].y;\n" + "RCP R0.x, R0.x;\n" + "MUL R0.x, R0.y, R0;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R3.xyz, R0, c[6].x, -R0.w;\n" - "MAD R6.xyz, -R5, c[7].x, c[7].y;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R3, R2;\n" - "MAD R4.xyz, R0.w, R1, R2;\n" - "MAD R2.xyz, -R1, R2.w, c[6].z;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "MAD R2.xyz, R0, c[6].x, -R0.w;\n" + "MAD R4.xyz, R3, R4, c[7].z;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[6].z;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[6].x;\n" - "MUL R4.xyz, R1, c[7].x;\n" - "MUL R6.xyz, R1, R6;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "ADD R6.xyz, R4, -R5;\n" + "MUL R4.xyz, R1, c[6].y;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" "SGE R3.xyz, R3, R0.w;\n" @@ -2899,11 +2905,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" - "PARAM c[12] = { program.local[0..7],\n" + "PARAM c[13] = { program.local[0..7],\n" " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" " { 3.141593, 0.15915494, 1, 2 },\n" - " { 9.9999997e-006, 8, 3 } };\n" + " { 9.9999997e-006, 4, 16, 12 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2940,41 +2947,43 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "ADD R0.w, -R0.z, c[10].x;\n" "CMP R0.x, R0, R0.w, R0.z;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MAX R0.y, R1.w, c[11].x;\n" - "RCP R2.w, R0.y;\n" - "MUL R5.xyz, R1, R2.w;\n" - "RSQ R2.x, R5.x;\n" - "RSQ R2.z, R5.z;\n" - "RSQ R2.y, R5.y;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MAX R0.z, R1.w, c[11].x;\n" + "RCP R2.x, R0.z;\n" + "MUL R3.xyz, R1, R2.x;\n" + "MAD R4.xyz, R3, c[11].z, -c[11].w;\n" "ADD R0.x, R0, c[0];\n" "MUL R0.x, R0, c[10].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" - "MAD R3.xyz, R0, c[10].w, -R0.w;\n" - "MAD R6.xyz, -R5, c[11].y, c[11].z;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R3, R2;\n" - "MAD R4.xyz, R0.w, R1, R2;\n" - "MAD R2.xyz, -R1, R2.w, c[10].z;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" - "MAD R5.xyz, -R1, R6, R4;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R2.xyz, R0, c[10].w, -R0.w;\n" + "MAD R4.xyz, R3, R4, c[12].x;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[10].z;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[10].w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[11].y;\n" - "SGE R3.xyz, R3, R0.w;\n" - "ADD R2.w, -R1, c[10].z;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" + "SGE R3.xyz, R3, R0.w;\n" "MUL R2.xyz, R1, R2;\n" + "ADD R2.w, -R1, c[10].z;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "ADD R0.x, -R0.w, c[10].z;\n" @@ -3682,11 +3691,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..4],\n" + "PARAM c[10] = { program.local[0..4],\n" " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" " { 3.141593, 0.15915494, 1, 2 },\n" - " { 9.9999997e-006, 8, 3 } };\n" + " { 9.9999997e-006, 4, 16, 12 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3723,37 +3733,39 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "ADD R0.w, -R0.z, c[7].x;\n" "CMP R0.x, R0, R0.w, R0.z;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MAX R0.y, R1.w, c[8].x;\n" - "RCP R2.w, R0.y;\n" - "MUL R5.xyz, R1, R2.w;\n" - "RSQ R2.x, R5.x;\n" - "RSQ R2.z, R5.z;\n" - "RSQ R2.y, R5.y;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MAX R0.z, R1.w, c[8].x;\n" + "RCP R2.x, R0.z;\n" + "MUL R3.xyz, R1, R2.x;\n" + "MAD R4.xyz, R3, c[8].z, -c[8].w;\n" "ADD R0.x, R0, c[0];\n" "MUL R0.x, R0, c[7].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R3.xyz, R0, c[7].w, -R0.w;\n" - "MAD R6.xyz, -R5, c[8].y, c[8].z;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R3, R2;\n" - "MAD R4.xyz, R0.w, R1, R2;\n" - "MAD R2.xyz, -R1, R2.w, c[7].z;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "MAD R2.xyz, R0, c[7].w, -R0.w;\n" + "MAD R4.xyz, R3, R4, c[9].x;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[7].z;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[7].w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[8].y;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" "SGE R3.xyz, R3, R0.w;\n" @@ -4356,8 +4368,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -4365,13 +4377,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.w, R1, c[8].z;\n" - "RCP R2.w, R0.w;\n" - "MUL R2.xyz, R1, R2.w;\n" - "RSQ R0.w, R2.x;\n" - "MUL R5.xyz, -R2, c[8].w;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" @@ -4379,32 +4384,40 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "RSQ R0.z, R2.y;\n" - "RSQ R0.y, R2.z;\n" - "MAD R2.xyz, -R1, R2.w, c[8].x;\n" - "RCP R3.x, R0.w;\n" - "RCP R3.y, R0.z;\n" - "RCP R3.z, R0.y;\n" + "MUL R1.xy, fragment.position, c[5];\n" + "TEX R1, R1, texture[0], 2D;\n" + "MAX R0.z, R1.w, c[8];\n" + "RCP R0.z, R0.z;\n" + "MUL R3.xyz, R1, R0.z;\n" + "MAD R2.xyz, R3, c[9].x, -c[9].y;\n" "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[2], 1D;\n" - "MAD R4.xyz, R1.w, R3, -R1;\n" - "MAD R3.xyz, R0, c[8].y, -R0.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[9].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R4.xyz, R3, R2, c[9].z;\n" + "MAD R2.xyz, R0, c[8].y, -R0.w;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[8].x;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[8].y;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" "MAD R4.xyz, R0.w, R1, R4;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[8].w;\n" - "SGE R3.xyz, R3, R0.w;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" + "SGE R3.xyz, R3, R0.w;\n" "MUL R2.xyz, R1, R2;\n" + "ADD R2.w, -R1, c[8].x;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "ADD R0.x, -R0.w, c[8];\n" @@ -4815,8 +4828,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -4824,13 +4837,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.w, R1, c[5].z;\n" - "RCP R2.w, R0.w;\n" - "MUL R2.xyz, R1, R2.w;\n" - "RSQ R0.w, R2.x;\n" - "MUL R5.xyz, -R2, c[5].w;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" @@ -4838,28 +4844,36 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "RSQ R0.z, R2.y;\n" - "RSQ R0.y, R2.z;\n" - "MAD R2.xyz, -R1, R2.w, c[5].x;\n" - "RCP R3.x, R0.w;\n" - "RCP R3.y, R0.z;\n" - "RCP R3.z, R0.y;\n" + "MUL R1.xy, fragment.position, c[4];\n" + "TEX R1, R1, texture[0], 2D;\n" + "MAX R0.z, R1.w, c[5];\n" + "RCP R0.z, R0.z;\n" + "MUL R3.xyz, R1, R0.z;\n" + "MAD R2.xyz, R3, c[6].x, -c[6].y;\n" "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R4.xyz, R1.w, R3, -R1;\n" - "MAD R3.xyz, R0, c[5].y, -R0.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[6].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R4.xyz, R3, R2, c[6].z;\n" + "MAD R2.xyz, R0, c[5].y, -R0.w;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[5].x;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[5].y;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" "MAD R4.xyz, R0.w, R1, R4;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[5].w;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" "SGE R3.xyz, R3, R0.w;\n" @@ -5333,8 +5347,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -5342,44 +5356,45 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.x, R1.w, c[8].z;\n" - "RCP R2.w, R0.x;\n" - "MUL R2.xyz, R1, R2.w;\n" - "RSQ R0.w, R2.x;\n" - "RCP R3.x, R0.w;\n" - "RSQ R0.w, R2.y;\n" - "MUL R5.xyz, -R2, c[8].w;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" + "MUL R1.xy, fragment.position, c[5];\n" + "TEX R1, R1, texture[0], 2D;\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "RSQ R0.z, R2.z;\n" - "MAD R2.xyz, -R1, R2.w, c[8].x;\n" - "RCP R3.y, R0.w;\n" - "RCP R3.z, R0.z;\n" + "MAX R0.w, R1, c[8].z;\n" + "RCP R0.w, R0.w;\n" + "MUL R3.xyz, R1, R0.w;\n" + "MAD R2.xyz, R3, c[9].x, -c[9].y;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[2], 2D;\n" - "MAD R4.xyz, R1.w, R3, -R1;\n" - "MAD R3.xyz, R0, c[8].y, -R0.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[9].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R4.xyz, R3, R2, c[9].z;\n" + "MAD R2.xyz, R0, c[8].y, -R0.w;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[8].x;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[8].y;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" "MAD R4.xyz, R0.w, R1, R4;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[8].w;\n" - "SGE R3.xyz, R3, R0.w;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" + "SGE R3.xyz, R3, R0.w;\n" "MUL R2.xyz, R1, R2;\n" + "ADD R2.w, -R1, c[8].x;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "ADD R0.x, -R0.w, c[8];\n" @@ -5768,8 +5783,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -5777,40 +5792,41 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.x, R1.w, c[5].z;\n" - "RCP R2.w, R0.x;\n" - "MUL R2.xyz, R1, R2.w;\n" - "RSQ R0.w, R2.x;\n" - "RCP R3.x, R0.w;\n" - "RSQ R0.w, R2.y;\n" - "MUL R5.xyz, -R2, c[5].w;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" + "MUL R1.xy, fragment.position, c[4];\n" + "TEX R1, R1, texture[0], 2D;\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "RSQ R0.z, R2.z;\n" - "MAD R2.xyz, -R1, R2.w, c[5].x;\n" - "RCP R3.y, R0.w;\n" - "RCP R3.z, R0.z;\n" + "MAX R0.w, R1, c[5].z;\n" + "RCP R0.w, R0.w;\n" + "MUL R3.xyz, R1, R0.w;\n" + "MAD R2.xyz, R3, c[6].x, -c[6].y;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" - "MAD R4.xyz, R1.w, R3, -R1;\n" - "MAD R3.xyz, R0, c[5].y, -R0.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[6].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R4.xyz, R3, R2, c[6].z;\n" + "MAD R2.xyz, R0, c[5].y, -R0.w;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[5].x;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[5].y;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" "MAD R4.xyz, R0.w, R1, R4;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[5].w;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" "SGE R3.xyz, R3, R0.w;\n" @@ -6295,8 +6311,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6304,46 +6320,47 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.w, R0, c[8].z;\n" - "RCP R2.w, R1.w;\n" - "MUL R2.xyz, R0, R2.w;\n" - "RSQ R1.w, R2.x;\n" - "MUL R5.xyz, -R2, c[8].w;\n" - "MUL R1.xyz, fragment.position.y, c[2];\n" - "MAD R1.xyz, fragment.position.x, c[1], R1;\n" - "ADD R1.xyz, R1, c[3];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" "RCP R1.z, R1.z;\n" "MUL R1.xy, R1, R1.z;\n" "MUL R1.xy, R1, c[0];\n" "TEX R1.x, R1, texture[2], 2D;\n" - "RSQ R1.z, R2.y;\n" - "RSQ R1.y, R2.z;\n" - "MAD R2.xyz, -R0, R2.w, c[8].x;\n" - "RCP R3.x, R1.w;\n" - "RCP R3.y, R1.z;\n" - "RCP R3.z, R1.y;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MAX R1.z, R0.w, c[8];\n" + "RCP R1.z, R1.z;\n" + "MUL R3.xyz, R0, R1.z;\n" + "MAD R2.xyz, R3, c[9].x, -c[9].y;\n" "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R4.xyz, R0.w, R3, -R0;\n" - "MAD R3.xyz, R1, c[8].y, -R1.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[9].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R1.w;\n" + "MAD R4.xyz, R3, R2, c[9].z;\n" + "MAD R2.xyz, R1, c[8].y, -R1.w;\n" + "MUL R5.xyz, R0.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[8].x;\n" + "MAD R2.xyz, R2, R3, R1.w;\n" "MUL R3.xyz, R1, c[8].y;\n" - "MAD R6.xyz, -R5, R6, R1.w;\n" + "MAD R5.xyz, R1.w, R0, R6;\n" "MAD R4.xyz, R1.w, R0, R4;\n" - "MAD R5.xyz, -R0, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R0, c[8].w;\n" - "SGE R3.xyz, R3, R1.w;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MUL R6.xyz, R0, R6;\n" "SGE R4.xyz, R4, R0.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R0, R2, R4;\n" + "SGE R3.xyz, R3, R1.w;\n" "MUL R2.xyz, R0, R2;\n" + "ADD R2.w, -R0, c[8].x;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R1, R2.w, R2;\n" "ADD R1.x, -R1.w, c[8];\n" @@ -6755,8 +6772,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6764,42 +6781,43 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.w, R0, c[5].z;\n" - "RCP R2.w, R1.w;\n" - "MUL R2.xyz, R0, R2.w;\n" - "RSQ R1.w, R2.x;\n" - "MUL R5.xyz, -R2, c[5].w;\n" - "MUL R1.xyz, fragment.position.y, c[2];\n" - "MAD R1.xyz, fragment.position.x, c[1], R1;\n" - "ADD R1.xyz, R1, c[3];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" "RCP R1.z, R1.z;\n" "MUL R1.xy, R1, R1.z;\n" "MUL R1.xy, R1, c[0];\n" "TEX R1.x, R1, texture[1], 2D;\n" - "RSQ R1.z, R2.y;\n" - "RSQ R1.y, R2.z;\n" - "MAD R2.xyz, -R0, R2.w, c[5].x;\n" - "RCP R3.x, R1.w;\n" - "RCP R3.y, R1.z;\n" - "RCP R3.z, R1.y;\n" + "MUL R0.xy, fragment.position, c[4];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MAX R1.z, R0.w, c[5];\n" + "RCP R1.z, R1.z;\n" + "MUL R3.xyz, R0, R1.z;\n" + "MAD R2.xyz, R3, c[6].x, -c[6].y;\n" "ADD R1.x, -R1, c[5];\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R4.xyz, R0.w, R3, -R0;\n" - "MAD R3.xyz, R1, c[5].y, -R1.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[6].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R1.w;\n" + "MAD R4.xyz, R3, R2, c[6].z;\n" + "MAD R2.xyz, R1, c[5].y, -R1.w;\n" + "MUL R5.xyz, R0.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[5].x;\n" + "MAD R2.xyz, R2, R3, R1.w;\n" "MUL R3.xyz, R1, c[5].y;\n" - "MAD R6.xyz, -R5, R6, R1.w;\n" + "MAD R5.xyz, R1.w, R0, R6;\n" "MAD R4.xyz, R1.w, R0, R4;\n" - "MAD R5.xyz, -R0, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R0, c[5].w;\n" - "MUL R6.xyz, R0, R6;\n" "SGE R4.xyz, R4, R0.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R0, R2, R4;\n" "MUL R2.xyz, R0, R2;\n" "SGE R3.xyz, R3, R1.w;\n" -- cgit v0.12 From f1a56f4db2f6d6c395ac6e7023b6e9184140d571 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 5 Nov 2009 11:40:27 +0200 Subject: Fixed symbian-abld build problems with xmlpatternsxqts Qmake generators for symbian can't handle .depends for SUBDIRS values, instead relying on the order of subdirs. Reordered the subdirs as a hot fix to get test case to build before qmake can be properly fixed. Also removed duplicate inclusion of xmlpatterns.pri, which was causing compile time warnings due to duplicate MACRO statements in mmps. Reviewed-by: Janne Koskinen --- tests/auto/xmlpatternsxqts/test/test.pro | 2 -- tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/xmlpatternsxqts/test/test.pro b/tests/auto/xmlpatternsxqts/test/test.pro index 603ae65..a69838a 100644 --- a/tests/auto/xmlpatternsxqts/test/test.pro +++ b/tests/auto/xmlpatternsxqts/test/test.pro @@ -24,5 +24,3 @@ win32 { else: DESTDIR = ../release } TARGET = tst_xmlpatternsxqts - -include (../../xmlpatterns.pri) diff --git a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro index a3b13da..39267c8 100644 --- a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro +++ b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro @@ -1,10 +1,10 @@ TEMPLATE = subdirs -SUBDIRS = test contains(QT_CONFIG,xmlpatterns) { SUBDIRS += lib !wince*:lib.file = lib/lib.pro test.depends = lib } +SUBDIRS += test # Needed on the win32-g++ setup and on the test machine arsia. INCLUDEPATH += $$QT_BUILD_TREE/include/QtXmlPatterns/private \ -- cgit v0.12 From e7dc9a35aa7b0e16457526647a8884ff3b4da4fe Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 5 Nov 2009 11:08:11 +0100 Subject: Fix textControl so that it ignores mouse press events when needed This fixes the issue in the itemviews that the selection would not change when clicking on rich text labels. Task-number: QTBUG-4516 Reviewed-by: ogoffart --- src/gui/text/qtextcontrol.cpp | 24 ++++++++++++++---------- src/gui/text/qtextcontrol_p_p.h | 4 ++-- tests/auto/qtableview/tst_qtableview.cpp | 19 +++++++++++++++++++ 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 3f6545c..b727c19 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -911,7 +911,7 @@ void QTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *conte break; case QEvent::MouseButtonPress: { QMouseEvent *ev = static_cast(e); - d->mousePressEvent(ev->button(), matrix.map(ev->pos()), ev->modifiers(), + d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->globalPos()); break; } case QEvent::MouseMove: { @@ -979,7 +979,7 @@ void QTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *conte #ifndef QT_NO_GRAPHICSVIEW case QEvent::GraphicsSceneMousePress: { QGraphicsSceneMouseEvent *ev = static_cast(e); - d->mousePressEvent(ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->screenPos()); break; } case QEvent::GraphicsSceneMouseMove: { @@ -1465,7 +1465,7 @@ QRectF QTextControl::selectionRect() const return selectionRect(d->cursor); } -void QTextControlPrivate::mousePressEvent(Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, +void QTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint &globalPos) { Q_Q(QTextControl); @@ -1479,11 +1479,11 @@ void QTextControlPrivate::mousePressEvent(Qt::MouseButton button, const QPointF cursor.clearSelection(); } } - if (!(button & Qt::LeftButton)) - return; - - if (!((interactionFlags & Qt::TextSelectableByMouse) || (interactionFlags & Qt::TextEditable))) - return; + if (!(button & Qt::LeftButton) || + !((interactionFlags & Qt::TextSelectableByMouse) || (interactionFlags & Qt::TextEditable))) { + e->ignore(); + return; + } cursorIsFocusIndicator = false; const QTextCursor oldSelection = cursor; @@ -1507,8 +1507,10 @@ void QTextControlPrivate::mousePressEvent(Qt::MouseButton button, const QPointF trippleClickTimer.stop(); } else { int cursorPos = q->hitTest(pos, Qt::FuzzyHit); - if (cursorPos == -1) + if (cursorPos == -1) { + e->ignore(); return; + } #if !defined(QT_NO_IM) QTextLayout *layout = cursor.block().layout(); @@ -1519,8 +1521,10 @@ void QTextControlPrivate::mousePressEvent(Qt::MouseButton button, const QPointF button, buttons, modifiers); ctx->mouseHandler(cursorPos - cursor.position(), &ev); } - if (!layout->preeditAreaText().isEmpty()) + if (!layout->preeditAreaText().isEmpty()) { + e->ignore(); return; + } } #endif if (modifiers == Qt::ShiftModifier) { diff --git a/src/gui/text/qtextcontrol_p_p.h b/src/gui/text/qtextcontrol_p_p.h index ca9db9f..66459f6 100644 --- a/src/gui/text/qtextcontrol_p_p.h +++ b/src/gui/text/qtextcontrol_p_p.h @@ -131,10 +131,10 @@ public: QString anchorForCursor(const QTextCursor &anchor) const; void keyPressEvent(QKeyEvent *e); - void mousePressEvent(Qt::MouseButton button, const QPointF &pos, + void mousePressEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, - const QPoint &globalPos = QPoint()); + const QPoint &globalPos); void mouseMoveEvent(Qt::MouseButtons buttons, const QPointF &pos); void mouseReleaseEvent(Qt::MouseButton button, const QPointF &pos); void mouseDoubleClickEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos); diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 227ca6f..f571e8a 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -197,6 +197,7 @@ private slots: void task259308_scrollVerticalHeaderSwappedSections(); void task191545_dragSelectRows(); void taskQTBUG_5062_spansInconsistency(); + void taskQTBUG_4516_clickOnRichTextLabel(); void mouseWheel_data(); void mouseWheel(); @@ -3885,6 +3886,24 @@ void tst_QTableView::taskQTBUG_5062_spansInconsistency() VERIFY_SPANS_CONSISTENCY(&view); } +void tst_QTableView::taskQTBUG_4516_clickOnRichTextLabel() +{ + QTableView view; + QStandardItemModel model(5,5); + view.setModel(&model); + QLabel label("rich text"); + label.setTextFormat(Qt::RichText); + view.setIndexWidget(model.index(1,1), &label); + view.setCurrentIndex(model.index(0,0)); + QCOMPARE(view.currentIndex(), model.index(0,0)); + + QTest::mouseClick(&label, Qt::LeftButton); + QCOMPARE(view.currentIndex(), model.index(1,1)); + + +} + + void tst_QTableView::changeHeaderData() { QTableView view; -- cgit v0.12 From ec13cf30f10dabce37af3ce9d6763066e8cf4cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 5 Nov 2009 11:21:31 +0100 Subject: Removed the FBO stacking behaviour and the test attached to it. Having this behaviour in QGLFrameBufferObject complicates alot of things and isn't really necessary. Reviewed-by: Tom Cooksey --- src/opengl/qglframebufferobject.cpp | 33 +++--------- src/opengl/qglframebufferobject_p.h | 4 +- tests/auto/qgl/tst_qgl.cpp | 105 ------------------------------------ 3 files changed, 9 insertions(+), 133 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 7374594..5295b6d 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -361,9 +361,6 @@ void QGLFBOGLPaintDevice::beginPaint() if (QGLContext::currentContext() != context()) context()->makeCurrent(); - // We let QFBO track the previously bound FBO rather than doing it - // ourselves here. This has the advantage that begin/release & bind/end - // work as expected. wasBound = fbo->isBound(); if (!wasBound) fbo->bind(); @@ -896,17 +893,11 @@ bool QGLFramebufferObject::bind() QGL_FUNC_CONTEXT; if (!ctx) return false; // Context no longer exists. + const QGLContext *current = QGLContext::currentContext(); glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->fbo()); d->valid = d->checkFramebufferStatus(); - const QGLContext *context = QGLContext::currentContext(); - if (d->valid && context) { - Q_ASSERT(QGLContextPrivate::contextGroup(context) == QGLContextPrivate::contextGroup(ctx)); - // Save the previous setting to automatically restore in release(). - if (context->d_ptr->current_fbo != d->fbo()) { - d->previous_fbo = context->d_ptr->current_fbo; - context->d_ptr->current_fbo = d->fbo(); - } - } + if (d->valid && current) + current->d_ptr->current_fbo = d->fbo(); return d->valid; } @@ -917,30 +908,20 @@ bool QGLFramebufferObject::bind() framebuffer. Returns true upon success, false otherwise. - Since 4.6: if another QGLFramebufferObject instance was already bound - to the current context when bind() was called, then this function will - automatically re-bind it to the current context. - \sa bind() */ bool QGLFramebufferObject::release() { if (!isValid()) return false; - Q_D(QGLFramebufferObject); QGL_FUNC_CONTEXT; if (!ctx) return false; // Context no longer exists. - const QGLContext *context = QGLContext::currentContext(); - if (context) { - Q_ASSERT(QGLContextPrivate::contextGroup(context) == QGLContextPrivate::contextGroup(ctx)); - // Restore the previous setting for stacked framebuffer objects. - if (d->previous_fbo != context->d_ptr->current_fbo) { - context->d_ptr->current_fbo = d->previous_fbo; - glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->previous_fbo); - } - d->previous_fbo = 0; + const QGLContext *current = QGLContext::currentContext(); + if (current) { + current->d_ptr->current_fbo = 0; + glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); } return true; diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index 122c42e..c341459 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -127,7 +127,8 @@ private: class QGLFramebufferObjectPrivate { public: - QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_stencil_buffer(0), color_buffer(0), valid(false), previous_fbo(0), engine(0) {} + QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_stencil_buffer(0) + , color_buffer(0), valid(false), engine(0) {} ~QGLFramebufferObjectPrivate() {} void init(QGLFramebufferObject *q, const QSize& sz, @@ -143,7 +144,6 @@ public: QGLFramebufferObjectFormat format; uint valid : 1; QGLFramebufferObject::Attachment fbo_attachment; - GLuint previous_fbo; mutable QPaintEngine *engine; QGLFBOGLPaintDevice glDevice; diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index e9f0476..c680dec 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -82,7 +82,6 @@ private slots: void glPBufferRendering(); void glWidgetReparent(); void glWidgetRenderPixmap(); - void stackedFBOs(); void colormap(); void fboFormat(); void testDontCrashOnDanglingResources(); @@ -1226,110 +1225,6 @@ void tst_QGL::glWidgetRenderPixmap() QCOMPARE(fb, reference); } - -// When using multiple FBOs at the same time, unbinding one FBO should re-bind the -// previous. I.e. It should be possible to have a stack of FBOs where pop'ing there -// top re-binds the one underneeth. -void tst_QGL::stackedFBOs() -{ - if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) - QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle); - - QGLWidget glw; - glw.show(); - -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&glw); -#endif - QTest::qWait(200); - - glw.makeCurrent(); - - // No multisample with combined depth/stencil attachment: - QGLFramebufferObjectFormat fboFormat; - fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil); - - // Don't complicate things by using NPOT: - QGLFramebufferObject *fbo1 = new QGLFramebufferObject(128, 128, fboFormat); - QGLFramebufferObject *fbo2 = new QGLFramebufferObject(128, 128, fboFormat); - QGLFramebufferObject *fbo3 = new QGLFramebufferObject(128, 128, fboFormat); - - glClearColor(1.0, 0.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - fbo1->bind(); - glClearColor(1.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - fbo2->bind(); - glClearColor(0.0, 1.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - fbo3->bind(); - glClearColor(0.0, 0.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - glScissor(32, 32, 64, 64); - glEnable(GL_SCISSOR_TEST); - glClearColor(0.0, 1.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - fbo3->release(); - - // Scissor rect & test should be left untouched by the fbo release... - glClearColor(0.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - fbo2->release(); - - glClearColor(1.0, 1.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - fbo1->release(); - - glClearColor(1.0, 1.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - glw.swapBuffers(); - - QImage widgetFB = glw.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32); - QImage fb1 = fbo1->toImage().convertToFormat(QImage::Format_RGB32); - QImage fb2 = fbo2->toImage().convertToFormat(QImage::Format_RGB32); - QImage fb3 = fbo3->toImage().convertToFormat(QImage::Format_RGB32); - - delete fbo1; - delete fbo2; - delete fbo3; - - QImage widgetReference(widgetFB.size(), widgetFB.format()); - QImage fb1Reference(fb1.size(), fb1.format()); - QImage fb2Reference(fb2.size(), fb2.format()); - QImage fb3Reference(fb3.size(), fb3.format()); - - QPainter widgetReferencePainter(&widgetReference); - QPainter fb1ReferencePainter(&fb1Reference); - QPainter fb2ReferencePainter(&fb2Reference); - QPainter fb3ReferencePainter(&fb3Reference); - - widgetReferencePainter.fillRect(0, 0, widgetReference.width(), widgetReference.height(), Qt::magenta); - fb1ReferencePainter.fillRect(0, 0, fb1Reference.width(), fb1Reference.height(), Qt::red); - fb2ReferencePainter.fillRect(0, 0, fb2Reference.width(), fb2Reference.height(), Qt::green); - fb3ReferencePainter.fillRect(0, 0, fb3Reference.width(), fb3Reference.height(), Qt::blue); - - // Flip y-coords to match GL for the widget (which can be any size) - widgetReferencePainter.fillRect(32, glw.height() - 96, 64, 64, Qt::yellow); - fb1ReferencePainter.fillRect(32, 32, 64, 64, Qt::white); - fb2ReferencePainter.fillRect(32, 32, 64, 64, Qt::black); - fb3ReferencePainter.fillRect(32, 32, 64, 64, Qt::cyan); - - widgetReferencePainter.end(); - fb1ReferencePainter.end(); - fb2ReferencePainter.end(); - fb3ReferencePainter.end(); - - QCOMPARE(widgetFB, widgetReference); - QCOMPARE(fb1, fb1Reference); - QCOMPARE(fb2, fb2Reference); - QCOMPARE(fb3, fb3Reference); -} - - class ColormapExtended : public QGLColormap { public: -- cgit v0.12 From c93ca96552b70a6bd7332aec3504485e82d4d032 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 5 Nov 2009 10:52:55 +0100 Subject: Stylesheet: Fix lineedit size with an empty stylesheet with some styles Now passes tst_QStyleSheetStyle::emptyStyleSheet with gtk style Somehow there were some wrong and uneeded default padding for the QLineEdit with some styles Task-number: QTBUG-5434 Reviewed-by: axis --- src/gui/styles/qstylesheetstyle_default.cpp | 43 ----------------------------- 1 file changed, 43 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle_default.cpp b/src/gui/styles/qstylesheetstyle_default.cpp index 406633e..f79f8e0 100644 --- a/src/gui/styles/qstylesheetstyle_default.cpp +++ b/src/gui/styles/qstylesheetstyle_default.cpp @@ -203,49 +203,6 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const ADD_STYLE_RULE; } - /*QLineEdit[style="QCleanlooksStyle"] { - padding-top: 2px; - padding-bottom: 2px; - }*/ - if (baseStyle()->inherits("QCleanlooksStyle")) - { - SET_ELEMENT_NAME(QLatin1String("QLineEdit")); - ADD_BASIC_SELECTOR; - ADD_SELECTOR; - - - SET_PROPERTY(QLatin1String("padding-top"), PaddingTop); - ADD_VALUE(Value::Identifier, QString::fromLatin1("2px")); - ADD_DECLARATION; - - SET_PROPERTY(QLatin1String("padding-bottom"), PaddingBottom); - ADD_VALUE(Value::Identifier, QString::fromLatin1("2px")); - ADD_DECLARATION; - - ADD_STYLE_RULE; - } - - /*QLineEdit[style="QWindowsXPStyle"], - QLineEdit[style="QWindowsVistaStyle"], - QLineEdit[style="QGtkStyle"] { - padding-top: 1px; - padding-bottom: 1px; - }*/ - if (baseStyle()->inherits("QWindowsXPStyle") || baseStyle()->inherits("QGtkStyle")) - { - SET_ELEMENT_NAME(QLatin1String("QLineEdit")); - - SET_PROPERTY(QLatin1String("padding-top"), PaddingTop); - ADD_VALUE(Value::Identifier, QString::fromLatin1("1px")); - ADD_DECLARATION; - - SET_PROPERTY(QLatin1String("padding-bottom"), PaddingBottom); - ADD_VALUE(Value::Identifier, QString::fromLatin1("1px")); - ADD_DECLARATION; - - ADD_STYLE_RULE; - } - /*QFrame { border: native; }*/ -- cgit v0.12 From ff87ab95b42c87528c4dff16382a5894c6ddd4c3 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 5 Nov 2009 11:44:17 +0100 Subject: Fix autotest to match API changes --- tests/auto/qanimationgroup/tst_qanimationgroup.cpp | 84 +++++++++++----------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp index 81c51ed..b4e4a49 100644 --- a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp +++ b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp @@ -165,9 +165,9 @@ void tst_QAnimationGroup::emptyGroup() QCOMPARE(groupStateChangedSpy.count(), 2); - QCOMPARE(qVariantValue(groupStateChangedSpy.at(0).at(1)), + QCOMPARE(qVariantValue(groupStateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(groupStateChangedSpy.at(1).at(1)), + QCOMPARE(qVariantValue(groupStateChangedSpy.at(1).first()), QAnimationGroup::Stopped); QCOMPARE(group.state(), QAnimationGroup::Stopped); @@ -180,9 +180,9 @@ void tst_QAnimationGroup::emptyGroup() group.start(); - QCOMPARE(qVariantValue(groupStateChangedSpy.at(2).at(1)), + QCOMPARE(qVariantValue(groupStateChangedSpy.at(2).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(groupStateChangedSpy.at(3).at(1)), + QCOMPARE(qVariantValue(groupStateChangedSpy.at(3).first()), QAnimationGroup::Stopped); QCOMPARE(group.state(), QAnimationGroup::Stopped); @@ -259,54 +259,54 @@ void tst_QAnimationGroup::setCurrentTime() QCOMPARE(notTimeDriven->state(), QAnimationGroup::Stopped); QCOMPARE(loopsForever->state(), QAnimationGroup::Stopped); - QCOMPARE(group.currentTime(), 1); - QCOMPARE(sequence->currentTime(), 1); - QCOMPARE(a1_s_o1->currentTime(), 1); - QCOMPARE(a2_s_o1->currentTime(), 0); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 1); - QCOMPARE(a1_s_o3->currentTime(), 0); - QCOMPARE(a1_p_o1->currentTime(), 1); - QCOMPARE(a1_p_o2->currentTime(), 1); - QCOMPARE(a1_p_o3->currentTime(), 1); - QCOMPARE(notTimeDriven->currentTime(), 1); - QCOMPARE(loopsForever->currentTime(), 1); + QCOMPARE(group.currentLoopTime(), 1); + QCOMPARE(sequence->currentLoopTime(), 1); + QCOMPARE(a1_s_o1->currentLoopTime(), 1); + QCOMPARE(a2_s_o1->currentLoopTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 1); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); + QCOMPARE(a1_p_o1->currentLoopTime(), 1); + QCOMPARE(a1_p_o2->currentLoopTime(), 1); + QCOMPARE(a1_p_o3->currentLoopTime(), 1); + QCOMPARE(notTimeDriven->currentLoopTime(), 1); + QCOMPARE(loopsForever->currentLoopTime(), 1); // Current time = 250 group.setCurrentTime(250); - QCOMPARE(group.currentTime(), 250); - QCOMPARE(sequence->currentTime(), 250); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 0); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(a1_s_o3->currentTime(), 0); - QCOMPARE(a1_p_o1->currentTime(), 250); - QCOMPARE(a1_p_o2->currentTime(), 0); + QCOMPARE(group.currentLoopTime(), 250); + QCOMPARE(sequence->currentLoopTime(), 250); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 0); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(a1_s_o3->currentLoopTime(), 0); + QCOMPARE(a1_p_o1->currentLoopTime(), 250); + QCOMPARE(a1_p_o2->currentLoopTime(), 0); QCOMPARE(a1_p_o2->currentLoop(), 1); - QCOMPARE(a1_p_o3->currentTime(), 250); - QCOMPARE(notTimeDriven->currentTime(), 250); - QCOMPARE(loopsForever->currentTime(), 0); + QCOMPARE(a1_p_o3->currentLoopTime(), 250); + QCOMPARE(notTimeDriven->currentLoopTime(), 250); + QCOMPARE(loopsForever->currentLoopTime(), 0); QCOMPARE(loopsForever->currentLoop(), 1); QCOMPARE(sequence->currentAnimation(), a2_s_o1); // Current time = 251 group.setCurrentTime(251); - QCOMPARE(group.currentTime(), 251); - QCOMPARE(sequence->currentTime(), 251); - QCOMPARE(a1_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentTime(), 1); + QCOMPARE(group.currentLoopTime(), 251); + QCOMPARE(sequence->currentLoopTime(), 251); + QCOMPARE(a1_s_o1->currentLoopTime(), 250); + QCOMPARE(a2_s_o1->currentLoopTime(), 1); QCOMPARE(a2_s_o1->currentLoop(), 0); - QCOMPARE(a3_s_o1->currentTime(), 0); - QCOMPARE(sequence2->currentTime(), 251); - QCOMPARE(a1_s_o2->currentTime(), 250); - QCOMPARE(a1_s_o3->currentTime(), 1); - QCOMPARE(a1_p_o1->currentTime(), 250); - QCOMPARE(a1_p_o2->currentTime(), 1); + QCOMPARE(a3_s_o1->currentLoopTime(), 0); + QCOMPARE(sequence2->currentLoopTime(), 251); + QCOMPARE(a1_s_o2->currentLoopTime(), 250); + QCOMPARE(a1_s_o3->currentLoopTime(), 1); + QCOMPARE(a1_p_o1->currentLoopTime(), 250); + QCOMPARE(a1_p_o2->currentLoopTime(), 1); QCOMPARE(a1_p_o2->currentLoop(), 1); - QCOMPARE(a1_p_o3->currentTime(), 250); - QCOMPARE(notTimeDriven->currentTime(), 251); - QCOMPARE(loopsForever->currentTime(), 1); + QCOMPARE(a1_p_o3->currentLoopTime(), 250); + QCOMPARE(notTimeDriven->currentLoopTime(), 251); + QCOMPARE(loopsForever->currentLoopTime(), 1); QCOMPARE(sequence->currentAnimation(), a2_s_o1); } @@ -356,7 +356,7 @@ void tst_QAnimationGroup::addChildTwice() parent->addAnimation(subGroup); QCOMPARE(parent->animationCount(), 1); - parent->clearAnimations(); + parent->clear(); QCOMPARE(parent->animationCount(), 0); -- cgit v0.12 From b2c60696dd54656c1a0d588342cc3c7beee70876 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 5 Nov 2009 11:48:31 +0100 Subject: Fixed Q3DockArea::setAcceptDockWindow which didn't work at all Task-number: QTBUG-2026 Reviewed-by: ogoffart --- src/qt3support/widgets/q3dockarea.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt3support/widgets/q3dockarea.cpp b/src/qt3support/widgets/q3dockarea.cpp index bb34622..fbe235e 100644 --- a/src/qt3support/widgets/q3dockarea.cpp +++ b/src/qt3support/widgets/q3dockarea.cpp @@ -1139,7 +1139,7 @@ void Q3DockArea::setAcceptDockWindow(Q3DockWindow *dw, bool accept) { if (accept) forbiddenWidgets.removeAll(dw); - else if (forbiddenWidgets.contains(dw)) + else if (!forbiddenWidgets.contains(dw)) forbiddenWidgets.append(dw); } -- cgit v0.12 From 4bf7f90a27377f439e86d6175e5e3cdebd131be0 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Thu, 5 Nov 2009 12:12:22 +0100 Subject: Always set a clip on the painter in QGraphicsView. This allows items to check painter->clipRegion() to find out what the imposed clip is, in order to cull elements that don't need to be painted. This is an alternative approach to getting the same information from QStyleOptionGraphicsItem::exposedRect. It's better because it's a pull operation, but it's slightly worse because it doesn't include the complete system clip, and because QRegion has integer resolution only (whereas QGraphicsItem's coordinate uses qreal. A better approach may be to access QPainter's combined clip region; this option is open for future versions of Qt. Original patch by Warwick (which is why he's on reviewed-by), but the patch was modified to operate in device instead of logical coordinates. Reviewed-by: jasplin Reviewed-by: Warwick Allison --- src/gui/graphicsview/qgraphicsview.cpp | 3 ++ tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 72 ++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index c88f678..d1dd26f 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -3252,10 +3252,13 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // Determine the exposed region d->exposedRegion = event->region(); + if (d->exposedRegion.isEmpty()) + d->exposedRegion = viewport()->rect(); QRectF exposedSceneRect = mapToScene(d->exposedRegion.boundingRect()).boundingRect(); // Set up the painter QPainter painter(viewport()); + painter.setClipRect(event->rect(), Qt::IntersectClip); #ifndef QT_NO_RUBBERBAND if (d->rubberBanding && !d->rubberBandRect.isEmpty()) painter.save(); diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index f07453c..9c6aa39 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -217,6 +217,7 @@ private slots: void update(); void inputMethodSensitivity(); void inputContextReset(); + void defaultClipIntersectToView(); // task specific tests below me void task172231_untransformableItems(); @@ -3692,6 +3693,77 @@ void tst_QGraphicsView::inputContextReset() QCOMPARE(inputContext.resets, 0); } +class ViewClipTester : public QGraphicsView +{ +public: + ViewClipTester(QGraphicsScene *scene = 0) + : QGraphicsView(scene) + { } + QRegion clipRegion; + +protected: + void drawBackground(QPainter *painter, const QRectF &rect) + { + clipRegion = painter->clipRegion(); + } +}; + +class ItemClipTester : public QGraphicsRectItem +{ +public: + ItemClipTester() : QGraphicsRectItem(0, 0, 20, 20) + { + setBrush(Qt::blue); + } + QRegion clipRegion; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) + { + clipRegion = painter->clipRegion(); + QGraphicsRectItem::paint(painter, option, widget); + } +}; + +void tst_QGraphicsView::defaultClipIntersectToView() +{ + QGraphicsScene scene; + ItemClipTester *tester = new ItemClipTester; + scene.addItem(tester); + + ViewClipTester view(&scene); + view.setAlignment(Qt::AlignTop | Qt::AlignLeft); + view.setFrameStyle(0); + view.resize(200, 200); + view.show(); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view); + + QRect viewRect(0, 0, 200, 200); + QCOMPARE(view.clipRegion, QRegion(viewRect)); + QCOMPARE(tester->clipRegion, QRegion(viewRect)); + + view.viewport()->update(0, 0, 5, 5); + view.viewport()->update(10, 10, 5, 5); + qApp->processEvents(); + viewRect = QRect(0, 0, 15, 15); + QCOMPARE(view.clipRegion, QRegion(viewRect)); + QCOMPARE(tester->clipRegion, QRegion(viewRect)); + + view.scale(2, 2); + qApp->processEvents(); + + viewRect.moveTop(-viewRect.height()); + viewRect = QRect(0, 0, 100, 100); + QCOMPARE(view.clipRegion, QRegion(viewRect)); + QCOMPARE(tester->clipRegion, QRegion(viewRect)); + + view.viewport()->update(0, 0, 5, 5); + view.viewport()->update(10, 10, 5, 5); + qApp->processEvents(); + viewRect = QRect(0, 0, 8, 8); + QCOMPARE(view.clipRegion, QRegion(viewRect)); + QCOMPARE(tester->clipRegion, QRegion(viewRect)); +} + void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() { QGraphicsView view; -- cgit v0.12 From 8513a37e7fe236cdb476236f1c8448b64f9aed28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 5 Nov 2009 13:17:34 +0200 Subject: QS60Style: Checked menu check indicators are not shown QS60Style does not draw checked menu indicators at all. This is due to that it initializes used style option with style option's base class. Therefore relevant data for menu item indicator is not copied. Task-number: QTBUG-4717 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index c0a1f76..845ab3e 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1676,18 +1676,18 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (!styleHint(SH_UnderlineShortcut, menuItem, widget)) text_flags |= Qt::TextHideMnemonic; - QRect iconRect = - subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); - QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); - if ((option->state & State_Selected) && (option->state & State_Enabled)) QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); + QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); + QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); + //todo: move the vertical spacing stuff into subElementRect const int vSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing); if (checkable){ + const int hSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); QStyleOptionMenuItem optionCheckBox; - optionCheckBox.QStyleOption::operator=(*menuItem); + optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem); optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); const int moveByX = optionCheckBox.rect.width()+vSpacing; @@ -1696,6 +1696,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, iconRect.translate(moveByX, 0); iconRect.setWidth(iconRect.width()+vSpacing); textRect.setWidth(textRect.width()-moveByX-vSpacing); + optionCheckBox.rect.translate(vSpacing/2, hSpacing/2); } else { textRect.setWidth(textRect.width()-moveByX); iconRect.setWidth(iconRect.width()+vSpacing); -- cgit v0.12 From c13ebfd7296ca5e2c60f142b7041dd8f417de6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 5 Nov 2009 13:39:26 +0200 Subject: QProgressBar is drawn stretched in QS60Style Style draws the ends of scrollbar as too wide, causing the themegraphic to stratch which looks horrible. Task-number: QTBUG-5445 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 845ab3e..0b126a6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -831,6 +831,11 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag pixelMetric(QStyle::PM_SliderControlThickness), Qt::IgnoreAspectRatio); break; + case QS60StyleEnums::SP_QgnGrafBarFrameSideL: + case QS60StyleEnums::SP_QgnGrafBarFrameSideR: + result.setWidth(pixelMetric(PM_Custom_FrameCornerWidth)); + break; + case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed: case QS60StyleEnums::SP_QsnCpScrollHandleTopPressed: case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed: -- cgit v0.12 From 70c1c87a3df52e510413c3e8512d9e55df00e7bd Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 3 Nov 2009 11:56:11 +0100 Subject: Implemented QSwipeGesture recognizer using touch events. Reviewed-by: Bradley T. Hughes --- examples/gestures/imagegestures/imagewidget.cpp | 18 +-- src/gui/kernel/qgesture_p.h | 8 +- src/gui/kernel/qgesturemanager.cpp | 1 + src/gui/kernel/qstandardgestures.cpp | 153 +++++++++++++++++++++++- src/gui/kernel/qstandardgestures_p.h | 9 ++ 5 files changed, 176 insertions(+), 13 deletions(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index df8f56d..96400c4 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -103,12 +103,12 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) //! [gesture event handler] bool ImageWidget::gestureEvent(QGestureEvent *event) { - if (QGesture *pan = event->gesture(Qt::PanGesture)) + if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) + swipeTriggered(static_cast(swipe)); + else if (QGesture *pan = event->gesture(Qt::PanGesture)) panTriggered(static_cast(pan)); if (QGesture *pinch = event->gesture(Qt::PinchGesture)) pinchTriggered(static_cast(pinch)); - if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) - swipeTriggered(static_cast(swipe)); return true; } //! [gesture event handler] @@ -154,12 +154,14 @@ void ImageWidget::pinchTriggered(QPinchGesture *gesture) //! [swipe function] void ImageWidget::swipeTriggered(QSwipeGesture *gesture) { - if (gesture->horizontalDirection() == QSwipeGesture::Left + if (gesture->state() == Qt::GestureFinished) { + if (gesture->horizontalDirection() == QSwipeGesture::Left || gesture->verticalDirection() == QSwipeGesture::Up) - goPrevImage(); - else - goNextImage(); - update(); + goPrevImage(); + else + goNextImage(); + update(); + } } //! [swipe function] diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index ae2e287..a571bdb 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -136,13 +136,19 @@ public: QSwipeGesturePrivate() : horizontalDirection(QSwipeGesture::NoDirection), verticalDirection(QSwipeGesture::NoDirection), - swipeAngle(0) + swipeAngle(0), + started(false), speed(0) { } QSwipeGesture::SwipeDirection horizontalDirection; QSwipeGesture::SwipeDirection verticalDirection; qreal swipeAngle; + + QPoint lastPositions[3]; + bool started; + qreal speed; + QTime time; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 628892d..662a64b 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -90,6 +90,7 @@ QGestureManager::QGestureManager(QObject *parent) #else registerGestureRecognizer(new QPanGestureRecognizer); registerGestureRecognizer(new QPinchGestureRecognizer); + registerGestureRecognizer(new QSwipeGestureRecognizer); #if defined(Q_OS_WIN) registerGestureRecognizer(new QWinNativePanGestureRecognizer); #endif diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index dfd49eb..79346ed 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -45,6 +45,7 @@ #include "qevent.h" #include "qwidget.h" #include "qabstractscrollarea.h" +#include "qdebug.h" QT_BEGIN_NAMESPACE @@ -66,7 +67,9 @@ QGesture *QPanGestureRecognizer::create(QObject *target) return new QPanGesture; } -QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, + QObject *, + QEvent *event) { QPanGesture *q = static_cast(state); QPanGesturePrivate *d = q->d_func(); @@ -155,7 +158,9 @@ QGesture *QPinchGestureRecognizer::create(QObject *target) return new QPinchGesture; } -QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, + QObject *, + QEvent *event) { QPinchGesture *q = static_cast(state); QPinchGesturePrivate *d = q->d_func(); @@ -199,8 +204,9 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, Q d->centerPoint = centerPoint; d->changeFlags |= QPinchGesture::CenterPointChanged; - const qreal scaleFactor = QLineF(p1.pos(), p2.pos()).length() - / QLineF(d->startPosition[0], d->startPosition[1]).length(); + const qreal scaleFactor = + QLineF(p1.pos(), p2.pos()).length() + / QLineF(d->startPosition[0], d->startPosition[1]).length(); if (d->isNewSequence) { d->lastScaleFactor = scaleFactor; } else { @@ -256,4 +262,143 @@ void QPinchGestureRecognizer::reset(QGesture *state) QGestureRecognizer::reset(state); } +// +// QSwipeGestureRecognizer +// + +QSwipeGestureRecognizer::QSwipeGestureRecognizer() +{ +} + +QGesture *QSwipeGestureRecognizer::create(QObject *target) +{ + if (target && target->isWidgetType()) { + static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); + } + return new QSwipeGesture; +} + +QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state, + QObject *, + QEvent *event) +{ + QSwipeGesture *q = static_cast(state); + QSwipeGesturePrivate *d = q->d_func(); + + const QTouchEvent *ev = static_cast(event); + + QGestureRecognizer::Result result; + + switch (event->type()) { + case QEvent::TouchBegin: { + d->speed = 1; + d->time = QTime::currentTime(); + d->started = true; + result = QGestureRecognizer::MayBeGesture; + break; + } + case QEvent::TouchEnd: { + if (q->state() != Qt::NoGesture) { + result = QGestureRecognizer::FinishGesture; + } else { + result = QGestureRecognizer::CancelGesture; + } + break; + } + case QEvent::TouchUpdate: { + if (!d->started) + result = QGestureRecognizer::CancelGesture; + else if (ev->touchPoints().size() == 3) { + QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0); + QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); + QTouchEvent::TouchPoint p3 = ev->touchPoints().at(2); + + if (d->lastPositions[0].isNull()) { + d->lastPositions[0] = p1.startScreenPos().toPoint(); + d->lastPositions[1] = p2.startScreenPos().toPoint(); + d->lastPositions[2] = p3.startScreenPos().toPoint(); + } + d->hotSpot = p1.screenPos(); + d->isHotSpotSet = true; + + int xDistance = (p1.screenPos().x() - d->lastPositions[0].x() + + p2.screenPos().x() - d->lastPositions[1].x() + + p3.screenPos().x() - d->lastPositions[2].x()) / 3; + int yDistance = (p1.screenPos().y() - d->lastPositions[0].y() + + p2.screenPos().y() - d->lastPositions[1].y() + + p3.screenPos().y() - d->lastPositions[2].y()) / 3; + + const int distance = xDistance >= yDistance ? xDistance : yDistance; + int elapsedTime = d->time.msecsTo(QTime::currentTime()); + if (!elapsedTime) + elapsedTime = 1; + d->speed = 0.9 * d->speed + distance / elapsedTime; + d->time = QTime::currentTime(); + d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle(); + + static const int MoveThreshold = 50; + if (xDistance > MoveThreshold || yDistance > MoveThreshold) { + // measure the distance to check if the direction changed + d->lastPositions[0] = p1.screenPos().toPoint(); + d->lastPositions[1] = p2.screenPos().toPoint(); + d->lastPositions[2] = p3.screenPos().toPoint(); + QSwipeGesture::SwipeDirection horizontal = + xDistance > 0 ? QSwipeGesture::Right : QSwipeGesture::Left; + QSwipeGesture::SwipeDirection vertical = + yDistance > 0 ? QSwipeGesture::Down : QSwipeGesture::Up; + if (d->verticalDirection == QSwipeGesture::NoDirection) + d->verticalDirection = vertical; + if (d->horizontalDirection == QSwipeGesture::NoDirection) + d->horizontalDirection = horizontal; + if (d->verticalDirection != vertical || d->horizontalDirection != horizontal) { + // the user has changed the direction! + result = QGestureRecognizer::CancelGesture; + } + result = QGestureRecognizer::TriggerGesture; + } else { + if (q->state() != Qt::NoGesture) + result = QGestureRecognizer::TriggerGesture; + else + result = QGestureRecognizer::MayBeGesture; + } + } else if (ev->touchPoints().size() > 3) { + result = QGestureRecognizer::CancelGesture; + } else { // less than 3 touch points + if (d->started && (ev->touchPointStates() & Qt::TouchPointPressed)) + result = QGestureRecognizer::CancelGesture; + else if (d->started) + result = QGestureRecognizer::Ignore; + else + result = QGestureRecognizer::MayBeGesture; + } + break; + } + case QEvent::MouseButtonPress: + case QEvent::MouseMove: + case QEvent::MouseButtonRelease: + result = QGestureRecognizer::Ignore; + break; + default: + result = QGestureRecognizer::Ignore; + break; + } + return result; +} + +void QSwipeGestureRecognizer::reset(QGesture *state) +{ + QSwipeGesture *q = static_cast(state); + QSwipeGesturePrivate *d = q->d_func(); + + d->verticalDirection = d->horizontalDirection = QSwipeGesture::NoDirection; + d->swipeAngle = 0; + + d->lastPositions[0] = d->lastPositions[1] = d->lastPositions[2] = QPoint(); + d->started = false; + d->speed = 0; + d->time = QTime(); + + QGestureRecognizer::reset(state); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index e6f346c..90f995d 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -74,7 +74,16 @@ public: QPinchGestureRecognizer(); QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; +class QSwipeGestureRecognizer : public QGestureRecognizer +{ +public: + QSwipeGestureRecognizer(); + + QGesture *create(QObject *target); QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; -- cgit v0.12 From 847be4eadc3bfc92daad728ce9f70e658e380556 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 4 Nov 2009 14:37:45 +0100 Subject: Improved pinch gesture. Made sure we emit the same values for the pinch gesture as on Mac. Reviewed-by: trustme --- src/gui/kernel/qstandardgestures.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 79346ed..a0055a1 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -216,7 +216,13 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor; d->changeFlags |= QPinchGesture::ScaleFactorChanged; - const qreal rotationAngle = -line.angle(); + qreal angle = QLineF(p1.screenPos(), p2.screenPos()).angle(); + if (angle > 180) + angle -= 360; + qreal startAngle = QLineF(p1.startScreenPos(), p2.startScreenPos()).angle(); + if (startAngle > 180) + startAngle -= 360; + const qreal rotationAngle = startAngle - angle; if (d->isNewSequence) d->lastRotationAngle = rotationAngle; else -- cgit v0.12 From f4450efb6fbc9fd0e592d5bc3bce37d5bf272984 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 4 Nov 2009 16:16:33 +0100 Subject: Small improvement in the imagegesture example. We don't actually need to fill the backgroup in the example as it will be done by Qt. And when double-clicked we need to reset the scale factor properly. Reviewed-by: trustme --- examples/gestures/imagegestures/imagewidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index 96400c4..80bd6a6 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -76,7 +76,6 @@ bool ImageWidget::event(QEvent *event) void ImageWidget::paintEvent(QPaintEvent*) { QPainter p(this); - p.fillRect(rect(), Qt::white); float iw = currentImage.width(); float ih = currentImage.height(); @@ -95,6 +94,7 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) { rotationAngle = 0; scaleFactor = 1; + currentStepScaleFactor = 1; verticalOffset = 0; horizontalOffset = 0; update(); -- cgit v0.12 From 6777135b2cacd3a72a60ff372749837b67762fbe Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 4 Nov 2009 19:26:40 +0100 Subject: Implemented Tap and TapAndHold gestures. Added QGesture objects and gesture recognizers based on touch events. Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qgesture.cpp | 66 +++++++++++++++ src/gui/kernel/qgesture.h | 34 ++++++++ src/gui/kernel/qgesture_p.h | 26 ++++++ src/gui/kernel/qgesturemanager.cpp | 5 +- src/gui/kernel/qstandardgestures.cpp | 153 +++++++++++++++++++++++++++++++++++ src/gui/kernel/qstandardgestures_p.h | 20 +++++ 6 files changed, 303 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 4edf8a9..88c04e2 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -667,4 +667,70 @@ void QSwipeGesture::setSwipeAngle(qreal value) d_func()->swipeAngle = value; } +/*! + \class QTapGesture + \since 4.6 + \brief The QTapGesture class describes a tap gesture made by the user. + \ingroup gestures + + \sa {Gestures Programming}, QPanGesture, QPinchGesture +*/ + +/*! + \property QTapGesture::position + \brief the position of the tap +*/ + +/*! + \internal +*/ +QTapGesture::QTapGesture(QObject *parent) + : QGesture(*new QTapGesturePrivate, parent) +{ + d_func()->gestureType = Qt::TapGesture; +} + +QPointF QTapGesture::position() const +{ + return d_func()->position; +} + +void QTapGesture::setPosition(const QPointF &value) +{ + d_func()->position = value; +} +/*! + \class QTapAndHoldGesture + \since 4.6 + \brief The QTapAndHoldGesture class describes a tap-and-hold (aka LongTap) + gesture made by the user. + \ingroup gestures + + \sa {Gestures Programming}, QPanGesture, QPinchGesture +*/ + +/*! + \property QTapAndHoldGesture::position + \brief the position of the tap +*/ + +/*! + \internal +*/ +QTapAndHoldGesture::QTapAndHoldGesture(QObject *parent) + : QGesture(*new QTapAndHoldGesturePrivate, parent) +{ + d_func()->gestureType = Qt::TapAndHoldGesture; +} + +QPointF QTapAndHoldGesture::position() const +{ + return d_func()->position; +} + +void QTapAndHoldGesture::setPosition(const QPointF &value) +{ + d_func()->position = value; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index dd322ad..f995d7b 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -219,6 +219,40 @@ public: friend class QSwipeGestureRecognizer; }; +class QTapGesturePrivate; +class Q_GUI_EXPORT QTapGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QTapGesture) + + Q_PROPERTY(QPointF position READ position WRITE setPosition) + +public: + QTapGesture(QObject *parent = 0); + + QPointF position() const; + void setPosition(const QPointF &pos); + + friend class QTapGestureRecognizer; +}; + +class QTapAndHoldGesturePrivate; +class Q_GUI_EXPORT QTapAndHoldGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QTapAndHoldGesture) + + Q_PROPERTY(QPointF position READ position WRITE setPosition) + +public: + QTapAndHoldGesture(QObject *parent = 0); + + QPointF position() const; + void setPosition(const QPointF &pos); + + friend class QTapAndHoldGestureRecognizer; +}; + QT_END_NAMESPACE Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy) diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index a571bdb..2537f47 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -151,6 +151,32 @@ public: QTime time; }; +class QTapGesturePrivate : public QGesturePrivate +{ + Q_DECLARE_PUBLIC(QTapGesture) + +public: + QTapGesturePrivate() + { + } + + QPointF position; +}; + +class QTapAndHoldGesturePrivate : public QGesturePrivate +{ + Q_DECLARE_PUBLIC(QTapAndHoldGesture) + +public: + QTapAndHoldGesturePrivate() + : timerId(0) + { + } + + QPointF position; + int timerId; +}; + QT_END_NAMESPACE #endif // QGESTURE_P_H diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 662a64b..375116f 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -91,9 +91,12 @@ QGestureManager::QGestureManager(QObject *parent) registerGestureRecognizer(new QPanGestureRecognizer); registerGestureRecognizer(new QPinchGestureRecognizer); registerGestureRecognizer(new QSwipeGestureRecognizer); + registerGestureRecognizer(new QTapGestureRecognizer); +#endif #if defined(Q_OS_WIN) registerGestureRecognizer(new QWinNativePanGestureRecognizer); -#endif +#else + registerGestureRecognizer(new QTapAndHoldGestureRecognizer); #endif } diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index a0055a1..3cc1b4b 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -407,4 +407,157 @@ void QSwipeGestureRecognizer::reset(QGesture *state) QGestureRecognizer::reset(state); } +// +// QTapGestureRecognizer +// + +QTapGestureRecognizer::QTapGestureRecognizer() +{ +} + +QGesture *QTapGestureRecognizer::create(QObject *target) +{ + if (target && target->isWidgetType()) { + static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); + } + return new QTapGesture; +} + +QGestureRecognizer::Result QTapGestureRecognizer::recognize(QGesture *state, + QObject *, + QEvent *event) +{ + QTapGesture *q = static_cast(state); + QTapGesturePrivate *d = q->d_func(); + + const QTouchEvent *ev = static_cast(event); + + QGestureRecognizer::Result result = QGestureRecognizer::CancelGesture; + + switch (event->type()) { + case QEvent::TouchBegin: { + d->position = ev->touchPoints().at(0).pos(); + result = QGestureRecognizer::TriggerGesture; + break; + } + case QEvent::TouchUpdate: + case QEvent::TouchEnd: { + if (q->state() != Qt::NoGesture && ev->touchPoints().size() == 1) { + QTouchEvent::TouchPoint p = ev->touchPoints().at(0); + QPoint delta = p.pos().toPoint() - p.startPos().toPoint(); + enum { TapRadius = 40 }; + if (delta.manhattanLength() <= TapRadius) { + if (event->type() == QEvent::TouchEnd) + result = QGestureRecognizer::FinishGesture; + else + result = QGestureRecognizer::TriggerGesture; + } + } + break; + } + case QEvent::MouseButtonPress: + case QEvent::MouseMove: + case QEvent::MouseButtonRelease: + result = QGestureRecognizer::Ignore; + break; + default: + result = QGestureRecognizer::Ignore; + break; + } + return result; +} + +void QTapGestureRecognizer::reset(QGesture *state) +{ + QTapGesture *q = static_cast(state); + QTapGesturePrivate *d = q->d_func(); + + d->position = QPointF(); + + QGestureRecognizer::reset(state); +} + +// +// QTapAndHoldGestureRecognizer +// + +QTapAndHoldGestureRecognizer::QTapAndHoldGestureRecognizer() +{ +} + +QGesture *QTapAndHoldGestureRecognizer::create(QObject *target) +{ + if (target && target->isWidgetType()) { + static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); + } + return new QTapAndHoldGesture; +} + +QGestureRecognizer::Result +QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object, + QEvent *event) +{ + QTapAndHoldGesture *q = static_cast(state); + QTapAndHoldGesturePrivate *d = q->d_func(); + + if (object == state && event->type() == QEvent::Timer) { + q->killTimer(d->timerId); + d->timerId = 0; + return QGestureRecognizer::Ignore | QGestureRecognizer::ConsumeEventHint; + } + + const QTouchEvent *ev = static_cast(event); + + QGestureRecognizer::Result result = QGestureRecognizer::CancelGesture; + + enum { TimerInterval = 2000 }; + enum { TapRadius = 40 }; + + switch (event->type()) { + case QEvent::TouchBegin: + d->position = ev->touchPoints().at(0).pos(); + if (d->timerId) + q->killTimer(d->timerId); + d->timerId = q->startTimer(TimerInterval); + result = QGestureRecognizer::TriggerGesture; + break; + case QEvent::TouchEnd: + if (d->timerId) + result = QGestureRecognizer::CancelGesture; + else + result = QGestureRecognizer::FinishGesture; + break; + case QEvent::TouchUpdate: + if (q->state() != Qt::NoGesture && ev->touchPoints().size() == 1) { + QTouchEvent::TouchPoint p = ev->touchPoints().at(0); + QPoint delta = p.pos().toPoint() - p.startPos().toPoint(); + if (delta.manhattanLength() <= TapRadius) + result = QGestureRecognizer::TriggerGesture; + } + break; + case QEvent::MouseButtonPress: + case QEvent::MouseMove: + case QEvent::MouseButtonRelease: + result = QGestureRecognizer::Ignore; + break; + default: + result = QGestureRecognizer::Ignore; + break; + } + return result; +} + +void QTapAndHoldGestureRecognizer::reset(QGesture *state) +{ + QTapAndHoldGesture *q = static_cast(state); + QTapAndHoldGesturePrivate *d = q->d_func(); + + d->position = QPointF(); + if (d->timerId) + q->killTimer(d->timerId); + d->timerId = 0; + + QGestureRecognizer::reset(state); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index 90f995d..8fea2bc 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -88,6 +88,26 @@ public: void reset(QGesture *state); }; +class QTapGestureRecognizer : public QGestureRecognizer +{ +public: + QTapGestureRecognizer(); + + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + +class QTapAndHoldGestureRecognizer : public QGestureRecognizer +{ +public: + QTapAndHoldGestureRecognizer(); + + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + QT_END_NAMESPACE #endif // QSTANDARDGESTURES_P_H -- cgit v0.12 From 75da4b5855c63b41060886c7b8ed7856888e4e35 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 5 Nov 2009 12:46:12 +0100 Subject: Fixed pinching in the imagegestures example. When the gesture finishes it might not necessery set the ScaleFactorChanged flag. Also fixed the touch-event based pinch gesture. Reviewed-by: trustme --- examples/gestures/imagegestures/imagewidget.cpp | 11 +++++------ src/gui/kernel/qstandardgestures.cpp | 8 ++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index 80bd6a6..afa0185 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -141,12 +141,11 @@ void ImageWidget::pinchTriggered(QPinchGesture *gesture) } if (changeFlags & QPinchGesture::ScaleFactorChanged) { qreal value = gesture->property("scaleFactor").toReal(); - if (gesture->state() == Qt::GestureFinished) { - scaleFactor *= currentStepScaleFactor; - currentStepScaleFactor = 1; - } else { - currentStepScaleFactor = value; - } + currentStepScaleFactor = value; + } + if (gesture->state() == Qt::GestureFinished) { + scaleFactor *= currentStepScaleFactor; + currentStepScaleFactor = 1; } update(); } diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 3cc1b4b..0ea4764 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -205,7 +205,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, d->changeFlags |= QPinchGesture::CenterPointChanged; const qreal scaleFactor = - QLineF(p1.pos(), p2.pos()).length() + QLineF(p1.screenPos(), p2.screenPos()).length() / QLineF(d->startPosition[0], d->startPosition[1]).length(); if (d->isNewSequence) { d->lastScaleFactor = scaleFactor; @@ -236,7 +236,10 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, result = QGestureRecognizer::TriggerGesture; } else { d->isNewSequence = true; - result = QGestureRecognizer::MayBeGesture; + if (q->state() == Qt::NoGesture) + result = QGestureRecognizer::Ignore; + else + result = QGestureRecognizer::FinishGesture; } break; } @@ -264,6 +267,7 @@ void QPinchGestureRecognizer::reset(QGesture *state) d->totalRotationAngle = d->lastRotationAngle = d->rotationAngle = 0; d->isNewSequence = true; + d->startPosition[0] = d->startPosition[1] = QPointF(); QGestureRecognizer::reset(state); } -- cgit v0.12 From 8927e54d9ab5dda2c1f8e0e17988ad37ab0e4b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 5 Nov 2009 13:11:38 +0100 Subject: Make configure warn on incompatible gcc / SDK. Print a warning if configure was called with the 10.4u SDK option on Snow Leopard with the default mkspec. The 10.4u SDK does not support gcc 4.2. --- configure | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configure b/configure index 611f4bf..76e6802 100755 --- a/configure +++ b/configure @@ -3022,6 +3022,18 @@ else CFG_FRAMEWORK=no fi +# Print a warning if configure was called with the 10.4u SDK option on Snow Leopard +# with the default mkspec. The 10.4u SDK does not support gcc 4.2. +if [ "$PLATFORM_MAC" = "yes" ] && [ '!' -z "$CFG_SDK" ]; then + # get the darwin version. 10.0.0 and up means snow leopard. + VERSION=`uname -r | tr '.' ' ' | awk '{print $1}'` + if [ "$VERSION" -gt 9 ] && [ "$CFG_SDK" == "/Developer/SDKs/MacOSX10.4u.sdk/" ] && [ "$PLATFORM" == "macx-g++" ]; then + echo + echo "WARNING: The 10.4u SDK does not support gcc 4.2. Configure with -platform macx-g++40. " + echo + fi +fi + # x11 tests are done after qmake is built -- cgit v0.12 From 23390af0bfb8828e0e58819a5ad2249f34e12205 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 5 Nov 2009 13:48:28 +0100 Subject: Another fix for the registration of the animations --- src/corelib/animation/qabstractanimation.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 0cdc40c..d46ac92 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -348,13 +348,16 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) state = newState; QWeakPointer guard(q); - //unregistration of the animation must always happen before calls to + //(un)registration of the animation must always happen before calls to //virtual function (updateState) to ensure a correct state of the timer + bool isTopLevel = !group || group->state() == QAbstractAnimation::Stopped; if (oldState == QAbstractAnimation::Running) { if (newState == QAbstractAnimation::Paused && hasRegisteredTimer) QUnifiedTimer::instance()->ensureTimerUpdate(); //the animation, is not running any more QUnifiedTimer::instance()->unregisterAnimation(q); + } else { + QUnifiedTimer::instance()->registerAnimation(q, isTopLevel); } q->updateState(newState, oldState); @@ -371,8 +374,6 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) break; case QAbstractAnimation::Running: { - bool isTopLevel = !group || group->state() == QAbstractAnimation::Stopped; - QUnifiedTimer::instance()->registerAnimation(q, isTopLevel); // this ensures that the value is updated now that the animation is running if (oldState == QAbstractAnimation::Stopped) { -- cgit v0.12 From 0d637ac6a852fb098e1945446536d1b15f5d8660 Mon Sep 17 00:00:00 2001 From: ck Date: Thu, 5 Nov 2009 13:54:19 +0100 Subject: Assistant: Look for document encoding in XML headers as well. Task-number: QTBUG-1770 Reviewed-by: kh1 Conflicts: tools/assistant/lib/lib.pro --- tools/assistant/lib/lib.pro | 3 +- tools/assistant/lib/qhelp_global.cpp | 112 +++++++++++++++++++++ tools/assistant/lib/qhelp_global.h | 58 ++--------- tools/assistant/lib/qhelpgenerator.cpp | 2 +- .../lib/qhelpsearchindexwriter_clucene.cpp | 4 +- .../lib/qhelpsearchindexwriter_default.cpp | 2 +- 6 files changed, 124 insertions(+), 57 deletions(-) create mode 100644 tools/assistant/lib/qhelp_global.cpp diff --git a/tools/assistant/lib/lib.pro b/tools/assistant/lib/lib.pro index 011dec2..51933de 100644 --- a/tools/assistant/lib/lib.pro +++ b/tools/assistant/lib/lib.pro @@ -40,7 +40,8 @@ SOURCES += qhelpenginecore.cpp \ qhelpsearchindex_default.cpp \ qhelpsearchindexwriter_default.cpp \ qhelpsearchindexreader_default.cpp \ - qhelpsearchindexreader.cpp + qhelpsearchindexreader.cpp \ + qhelp_global.cpp # access to clucene SOURCES += qhelpsearchindexwriter_clucene.cpp \ diff --git a/tools/assistant/lib/qhelp_global.cpp b/tools/assistant/lib/qhelp_global.cpp new file mode 100644 index 0000000..980de27 --- /dev/null +++ b/tools/assistant/lib/qhelp_global.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** 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 Qt Assistant. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#include "qhelp_global.h" + +QString QHelpGlobal::uniquifyConnectionName(const QString &name, void *pointer) +{ + static int counter = 0; + static QMutex mutex; + + QMutexLocker locker(&mutex); + if (++counter > 1000) + counter = 0; + + return QString::fromLatin1("%1-%2-%3"). + arg(name).arg(long(pointer)).arg(counter); +} + +QString QHelpGlobal::documentTitle(const QString &content) +{ + QString title = QObject::tr("Untitled"); + if (!content.isEmpty()) { + int start = content.indexOf(QLatin1String(""), 0, Qt::CaseInsensitive) + 7; + int end = content.indexOf(QLatin1String(""), 0, Qt::CaseInsensitive); + if ((end - start) > 0) { + title = content.mid(start, end - start); + if (Qt::mightBeRichText(title) || title.contains(QLatin1Char('&'))) { + QTextDocument doc; + doc.setHtml(title); + title = doc.toPlainText(); + } + } + } + return title; +} + +QString QHelpGlobal::codecFromData(const QByteArray &data) +{ + QString codec = codecFromXmlData(data); + if (codec.isEmpty()) + codec = codecFromHtmlData(data); + return codec.isEmpty() ? QLatin1String("utf-8") : codec; +} + +QString QHelpGlobal::codecFromHtmlData(const QByteArray &data) +{ + QString content = QString::fromUtf8(data.constData(), data.size()); + int start = content.indexOf(QLatin1String(" 0) { + int end; + QRegExp r(QLatin1String("charset=([^\"\\s]+)")); + while (start != -1) { + end = content.indexOf(QLatin1Char('>'), start) + 1; + const QString &meta = content.mid(start, end - start).toLower(); + if (r.indexIn(meta) != -1) + return r.cap(1); + start = content.indexOf(QLatin1String(".*")); + return encodingExp.exactMatch(content) ? encodingExp.cap(1) : QString(); +} diff --git a/tools/assistant/lib/qhelp_global.h b/tools/assistant/lib/qhelp_global.h index 723d867..4e31d67 100644 --- a/tools/assistant/lib/qhelp_global.h +++ b/tools/assistant/lib/qhelp_global.h @@ -45,9 +45,6 @@ #include #include #include -#include -#include -#include QT_BEGIN_HEADER @@ -65,56 +62,13 @@ QT_MODULE(Help) class QHelpGlobal { public: - static QString uniquifyConnectionName(const QString &name, void *pointer) - { - static int counter = 0; - static QMutex mutex; + static QString uniquifyConnectionName(const QString &name, void *pointer); + static QString documentTitle(const QString &content); + static QString codecFromData(const QByteArray &data); - QMutexLocker locker(&mutex); - if (++counter > 1000) - counter = 0; - - return QString::fromLatin1("%1-%2-%3") - .arg(name).arg(long(pointer)).arg(counter); - }; - - static QString documentTitle(const QString &content) - { - QString title = QObject::tr("Untitled"); - if (!content.isEmpty()) { - int start = content.indexOf(QLatin1String(""), 0, Qt::CaseInsensitive) + 7; - int end = content.indexOf(QLatin1String(""), 0, Qt::CaseInsensitive); - if ((end - start) > 0) { - title = content.mid(start, end - start); - if (Qt::mightBeRichText(title) || title.contains(QLatin1Char('&'))) { - QTextDocument doc; - doc.setHtml(title); - title = doc.toPlainText(); - } - } - } - return title; - }; - - static QString charsetFromData(const QByteArray &data) - { - QString content = QString::fromUtf8(data.constData(), data.size()); - int start = - content.indexOf(QLatin1String(" 0) { - int end; - QRegExp r(QLatin1String("charset=([^\"\\s]+)")); - while (start != -1) { - end = content.indexOf(QLatin1Char('>'), start) + 1; - const QString &meta = content.mid(start, end - start).toLower(); - if (r.indexIn(meta) != -1) - return r.cap(1); - start = content.indexOf(QLatin1String(" Date: Thu, 5 Nov 2009 14:00:03 +0100 Subject: Add changes to change log. --- dist/changes-4.6.0 | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 627760a..7596943 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -67,6 +67,49 @@ QtCore QtGui +- QGraphicsItem + * Fixed bug and improved accuracy of QGraphicsItem::childrenBoundingRect(). + * Many optimizations. + * Introduced QGraphicsItem::ItemHasNoContents + * Introduced QGraphicsItem::ItemSendsGeometryChanges (see Behavioral Changes) + * Introduced QGraphicsItem::focusProxy(), focus proxy support + * Introduced QGraphicsItem::ItemNegativeZStacksBehindParent + * Introduced QGraphicsItem::ItemIsPanel, light-weight window support + * Introduced activation support. + * Introduced QGraphicsItem::stackBefore() + * Cached items are now always invalidated when update() is called. + +- QGraphicsObject + * New class; inherits QGraphicsItem and adds notification signals and property declarations. + +- QGraphicsProxyWidget + * [251407] Fixed window flag handling. Now QGraphicsProxyWidget's flags win. + * Fix Qt::ClickFocus policy + + - QGraphicsScene + * [245317] Fixes to mouse grabbing behavior. + * Fixed delivery of double-click events after explicit grab and then ungrab. + * Rewrote the internal rendering to use a recursive instead of an iterative approach. + * Many optimizations. + * Ensure hover enter events are delivered when an item is pressed. + * Introduced activation support. + * Fixed bugs in initial focus support. + +- QGraphicsTextItem + * Now inherits from QGraphicsObject instead + + - QGraphicsTransform + * New class; eases animation of transformations for QGraphicsItem. + +- QGraphicsView + * Fix mapToScene(QRect) to avoid extra unnecessary adjustments. + * Many optimizations. + * Introduced QGraphicsView::isTransformed() + * [QTBUG-4151] Items with parent that sets ItemClipsChildrenToShape were sometimes invisible. + +- QGraphicsWidget + * Now inherits from QGraphicsObject instead + - QTreeView * [234930] Be able to use :has-children and :has-sibillings in a stylesheet * [252616] Set QStyleOptionViewItemV4::OnlyOne flag when painting spanning columns @@ -86,6 +129,12 @@ QtGui - QComboBox * [220195] Fixed keyboard search when current index is -1 +- QPixmap + * Optimized width(), height(), isNull() and depth(). + +- QRegion + * Minor optimizations. + - QSpinBox * [259226] Fixed setting a stylesheet on a QSpinBox to change the arrow possition -- cgit v0.12 From fc8bada79e686004faf5613202859e79ab49f1ab Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 5 Nov 2009 14:08:35 +0100 Subject: API review from yesterday made a bug appear for the pause animations --- src/corelib/animation/qabstractanimation.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index d46ac92..f967081 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -50,7 +50,7 @@ animations that plug into the rest of the animation framework. The progress of an animation is given by its current time - (currentTime()), which is measured in milliseconds from the start + (currentLoopTime()), which is measured in milliseconds from the start of the animation (0) to its end (duration()). The value is updated automatically while the animation is running. It can also be set directly with setCurrentTime(). @@ -214,6 +214,10 @@ void QUnifiedTimer::restartAnimationTimer() { if (runningLeafAnimations == 0 && !runningPauseAnimations.isEmpty()) { int closestTimeToFinish = closestPauseAnimationTimeToFinish(); + if (closestTimeToFinish < 0) { + qDebug() << runningPauseAnimations; + qDebug() << closestPauseAnimationTimeToFinish(); + } animationTimer.start(closestTimeToFinish, this); isPauseTimerActive = true; } else if (!animationTimer.isActive() || isPauseTimerActive) { @@ -288,9 +292,11 @@ void QUnifiedTimer::registerRunningAnimation(QAbstractAnimation *animation) if (QAbstractAnimationPrivate::get(animation)->isGroup) return; - if (QAbstractAnimationPrivate::get(animation)->isPause) + if (QAbstractAnimationPrivate::get(animation)->isPause) { + if (animation->duration() == -1) + qDebug() << "toto"; runningPauseAnimations << animation; - else + } else runningLeafAnimations++; } @@ -314,9 +320,9 @@ int QUnifiedTimer::closestPauseAnimationTimeToFinish() int timeToFinish; if (animation->direction() == QAbstractAnimation::Forward) - timeToFinish = animation->duration() - animation->currentTime(); + timeToFinish = animation->duration() - animation->currentLoopTime(); else - timeToFinish = animation->currentTime(); + timeToFinish = animation->currentLoopTime(); if (timeToFinish < closestTimeToFinish) closestTimeToFinish = timeToFinish; @@ -737,7 +743,7 @@ void QAbstractAnimation::start(DeletionPolicy policy) signal, and state() returns Stopped. The current time is not changed. If the animation stops by itself after reaching the end (i.e., - currentTime() == duration() and currentLoop() > loopCount() - 1), the + currentLoopTime() == duration() and currentLoop() > loopCount() - 1), the finished() signal is emitted. \sa start(), state() -- cgit v0.12 From 92f54eff85cdff6b66e14cd9117216b9a4dfff26 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 5 Nov 2009 14:11:40 +0100 Subject: Documentation: Embedded hardware acceleration Adding docs on how to use hardware acceleration on Embedded Linux and Windows CE Task-number: QT-1109 Rev-by: Anders Bakken Rev-by: Rhys Weatherley Rev-by: Thomas Hartmann --- doc/src/images/platformHWAcc.png | Bin 0 -> 11068 bytes doc/src/modules.qdoc | 5 +- doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc | 71 +++++ doc/src/platforms/emb-HwAcc-WinCE.qdoc | 69 +++++ doc/src/platforms/emb-directfb-EmbLinux.qdoc | 340 +++++++++++++++++++++ doc/src/platforms/emb-hardwareacceleration.qdocinc | 129 ++++++++ doc/src/platforms/emb-opengl-EmbLinux.qdoc | 164 ++++++++++ doc/src/platforms/emb-opengl.qdocinc | 85 ++++++ doc/src/platforms/emb-openvg-EmbLinux.qdoc | 53 ++++ doc/src/platforms/emb-openvg.qdocinc | 288 +++++++++++++++++ doc/src/platforms/qt-embedded-linux.qdoc | 2 +- doc/src/platforms/wince-introduction.qdoc | 2 +- doc/src/platforms/wince-opengl.qdoc | 70 ++--- doc/src/platforms/wince-openvg.qdoc | 65 ++++ 14 files changed, 1299 insertions(+), 44 deletions(-) create mode 100644 doc/src/images/platformHWAcc.png create mode 100644 doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc create mode 100644 doc/src/platforms/emb-HwAcc-WinCE.qdoc create mode 100644 doc/src/platforms/emb-directfb-EmbLinux.qdoc create mode 100644 doc/src/platforms/emb-hardwareacceleration.qdocinc create mode 100644 doc/src/platforms/emb-opengl-EmbLinux.qdoc create mode 100644 doc/src/platforms/emb-opengl.qdocinc create mode 100644 doc/src/platforms/emb-openvg-EmbLinux.qdoc create mode 100644 doc/src/platforms/emb-openvg.qdocinc create mode 100644 doc/src/platforms/wince-openvg.qdoc diff --git a/doc/src/images/platformHWAcc.png b/doc/src/images/platformHWAcc.png new file mode 100644 index 0000000..76a5a48 Binary files /dev/null and b/doc/src/images/platformHWAcc.png differ diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index ea5a9dc..ac264d0 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -226,10 +226,11 @@ The QtOpenGL module is part of the \l{Qt Full Framework Edition} and the \l{Open Source Versions of Qt}. It is available on Windows, X11, and Mac OS X. - \l{Qt for Embedded Linux} supports OpenGL ES (OpenGL for Embedded Systems). - To be able to use the OpenGL API in \l{Qt for Embedded Linux}, it must be + \l{Qt for Embedded and OpenGL} supports OpenGL ES (OpenGL for Embedded Systems). + \note To be able to use the OpenGL API in \l{Qt for Embedded Linux}, it must be integrated with the Q Window System (QWS). See the \l{Qt for Embedded Linux and OpenGL} documentation for details. + */ /*! diff --git a/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc b/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc new file mode 100644 index 0000000..9c18d87 --- /dev/null +++ b/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + + \page qt-embeddedLinux-accel.html + + \target Hardware Acceleration with Qt for Embedded Linux + + \title Qt for Embedded Linux Hardware Accelerated Graphics + \ingroup qt-embedded-linux + + + \input platforms/emb-hardwareacceleration.qdocinc + +\section1 Supported Hardware Accelerated Graphics APIs + +This list shows which Hardware Accelerated Graphics APIs currently +supported by Qt. + + \table + \header + \o Supported Hardware Accelerated Graphics APIs + \row + \o \l {Qt for Embedded Linux and OpenGL}{OpenGL ES} + \row + \o \l {Qt for Embedded Linux and OpenVG}{OpenVG} + \row + \o \l {Qt for Embedded Linux and DirectFB}{DirectFB} + \endtable + + +*/ diff --git a/doc/src/platforms/emb-HwAcc-WinCE.qdoc b/doc/src/platforms/emb-HwAcc-WinCE.qdoc new file mode 100644 index 0000000..66b6948 --- /dev/null +++ b/doc/src/platforms/emb-HwAcc-WinCE.qdoc @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qt-embeddedWinCE-accel.html + + \target Hardware Acceleration with Qt for Windows CE + + \title Qt for Windows CE Hardware Accelerated Graphics + \ingroup qtce + + + \input platforms/emb-hardwareacceleration.qdocinc + + \section1 Supported Hardware Accelerated Graphics APIs + + This list shows which Hardware Accelerated Graphics APIs currently +supported by Qt. + + \table + \header + \o Supported Hardware Accelerated Graphics APIs + \row + \o \l {Qt for Windows CE and OpenGL ES}{OpenGL ES} + \row + \o \l {Qt for Windows CE and OpenVG}{OpenVG} + \endtable + + + +*/ diff --git a/doc/src/platforms/emb-directfb-EmbLinux.qdoc b/doc/src/platforms/emb-directfb-EmbLinux.qdoc new file mode 100644 index 0000000..b863951 --- /dev/null +++ b/doc/src/platforms/emb-directfb-EmbLinux.qdoc @@ -0,0 +1,340 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qt-embeddedLinux-directfb.html + +\title Qt for Embedded Linux and DirectFB + +\ingroup qt-embedded-linux + +\section1 Introduction + +DirectFB is an open source LGPL licensed project founded by Denis Oliver Kropp +and generally chip vendors start out with the official version and +implement their own plugins to optimize the operations their hardware +supports. + +We recommend using Qt 4.6 with DirectFB. DirectFB support was introduced +already into Qt for Embedded Linux as a labs project for Qt 4.3 and folded +into Qt as a screen driver for Qt 4.4, but not supported fully. In Qt 4.5, +major changes were made to make it work with the optimized raster paint +engine. And in Qt 4.6 these have been further improved. + +\tableofcontents + +\section1 Using DirectFB with Qt +DirectFB is centered around \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBSurface.html}{Surfaces} +which is the equivalent of a QPaintDevice. In the Qt/DirectFB plugin, +DirectFB maps onto either a QPixmap or a QWindowSurface which essentially +means that drawing onto QPixmap or a QWidget can be accelerated and drawing +onto any other paint device (e.g. QImage) cannot. + +\section2 Configure + +When configuring Qt there are two options, from which you can choose: + +\code + ./configure -plugin-gfx-directfb + ./configure -qt-gfx-directfb + +\endcode + +With either mode, Qt will try the following to look for the DirectFB +includes/libs. + +\list + \o Use pkg-config + \o Use directfb-config + \o Check in your qmake.conf +\endlist + +Often the values returned from pkg-config/directfb-config indicates the +locations of the libs/headers on the target rootfs, rather than their +location on your host. The safest option is usually to explicitly populate +these variables in your qmake.conf like this: + +\code + +QT_CFLAGS_DIRECTFB = +/opt/toolchain/gcc4.3_mipsel_linux/usr/include/directfb -D_REENTRANT +QT_LIBS_DIRECTFB = -L/opt/toolchain/gcc4.3_mipsel_linux/usr/lib/-ldirect +-ldirectfb -lfusion + +\note While DirectFB supports a multi-process setup through a +kernel-extension called Fusion this setup is not well tested with Qt. + +\section2 Supported graphics operations + +IDirectFBSurface supports blitting, filling, drawing lines rects etc, but +it does not support everything Qt allows you to do. E.g. painter paths, +polygons, complex transformations, antialiasing, gradients. Some of these +things are handled in newer versions of DirectFB and could be supported by +Qt. They are seemingly optional at the driver level, so you need to have +fall back code paths for older drivers and drivers on which this is not +implemented. + +The QDirectFBPaintEngine is a subclass of the QRasterPaintEngine, thus +essentially supporting everything QRasterPaintEngine supports. This means +that it supports all graphical operations that Qt supports, but certain +operations will have to fall back to software rendering and that should be +avoided due to performance issues. Instead, these operations should be +rendered into a QPixmap once, and then reuse the pixmap. + +Note: Fallbacks to software rendering should be avoided. If unsupported +operations are used, the paint engine must fallback to the +QRasterPaintEngine engine. A good debugging tip is to make Qt warn you when +such fall backs occur, and to disable the fall back and only return. +Debugging options are listed below. + +\section2 DirectFB driver +DirectFB also provides an abstraction for keyboard and mouse drivers. This +simplifies the process of getting the target hardware up and running. It +also brings us to a feature fragmentation issue between different versions +of DirectFB. + +The Qt DirectFB driver currently supports DirectFB versions >= 0.9. Still, +there are large differences in what each actual implementation handles +correctly. It is relatively common not to properly support +\l{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBWindow}{DirectFB +windows}, so Qt needs to handle this case with a different code path. In +addition, certain drivers do not properly support DirectFB's cursor +handling. This means Qt has to have a code path for rendering the cursor +itself when this is the case. Some drivers do not let us create \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceDescription}{preallocated +surfaces} which means we have to have a conditional code path for that +case. + +\section2 Optimize performance using define options + +Qt/DirectFB comes with a number of defines that can be either +uncommented in directfb.pri or added to the QT_DEFINES_DIRECTFB variable in +your qmake.conf. + +\note The defines have been moved from \i +{src/plugins/gfxdrivers/directfb/directfb.pro} to \i +{src/gui/embedded/directfb.pri} + +\code + +#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP| + DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON| + DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS|DRAW_ROUNDED_RECT + + #DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" + #DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" + +\endcode + +As demonstrated above, you need to Qt which drawing operations you want to +warn/disable. Since there are varying implementations of DirectFB from +manufacturer to manufacture, different operations will be optimized. This +require you to define the operations you want to warn about or disable. +These are listed above in the DIRECTFB_DRAWINGOPERATIONS variable. + +Following is a table showing which options you have. + +\table + \header + \o Define option + \o Description + \row + \o QT_DIRECTFB_IMAGECACHE + \o Defining this means that Qt will cache an IDirectFBSurface per +QImage you draw based on its \l +{http://doc.trolltech.com/4.5/qimage.html#cacheKey}{cacheKey}. +Use this define if your application draws many QImages that +remain the same. Note that if you in this situation draw an image and then +change it, by calling bits() or opening a QPainter on it, the cache will +not benefit you. You can control the cache size with the imageCacheSize +connect option. + + \row + \o QT_NO_DIRECTFB_WM + \o If your DirectFB implementation does not support windows, you +have to define this to make Qt work properly. You can test this by checking +if the \l { +http://www.directfb.org/index.php?path=Main%2FDownloads&page=1}{df_window +example} runs well. +This means that all drawing operations onto a QWidget involves +an extra blitting step since Qt essentially first has to draw into an +off-screen buffer and then blit this buffer to the back buffer of the +primary surface. Finally, Qt must flip the back buffer to the front buffer, +which usually involves another blit. Still, blits are usually very fast +with DirectFB. + +To work around this you can make your widget paint on screen, \l +Qt::WA_PaintOnScreen but this comes with other limitations. This should be +avoided if you want more than one full-screen window in your application. +In addition, it will not work without proper DirectFB mouse support from the +layer. Also, see QT_NO_DIRECTFB_LAYER for more. + + \row + \o QT_NO_DIRECTFB_LAYER + \o If your DirectFB display layer cannot be used for e.g. drawing +mouse cursor, creating windows you have to define this. Defining this also +requires defining QT_NO_DIRECTFB_WM and involves making Qt render the +cursor rather than letting DirectFB do it. + + \row + \o QT_NO_DIRECTFB_PALETTE + \o Define this if your DirectFB driver does not support surfaces +with \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBPalette.html}{color +tables}. +The effect of defining this is that Qt will have to convert +images with \l QImage::Format_Indexed8 format to another format before +rendering them. + + \row + \o QT_NO_DIRECTFB_PREALLOCATED + \o Define this if your DirectFB driver does not support creating a +surface with preallocated data. This will make a more frequent use of \l +{http://www.cplusplus.com/reference/clibrary/cstring/memcpy/}{memcpy()} +when drawing images. If you define this, you might want to consider +defining QT_DIRECTFB_IMAGECACHE for better image rendering performance. + + \row + \o QT_NO_DIRECTFB_MOUSE and QT_NO_DIRECTFB_KEYBOARD + \o Define this if your driver does not provide keyboard/mouse +events through \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFB_CreateInputEventBuffer.html}{CreateInputEventBuffer}. +This means that Qt cannot use DirectFB to receive keyboard/mouse events and +if you want such events in your application, you will have to provide +another driver. For more info see \l {Qt for Embedded Linux Pointer +Handling}{Qt for Embedded Linux Pointer Handling} and \l{Qt for Embedded +Linux Character Input}{Qt for Embedded Linux Character Input} + + \row + \o QT_DIRECTFB_TIMING + \o Define this when debugging to get output on stderr about the +frames per second. + + \row + \o QT_NO_DIRECTFB_OPAQUE_DETECTION + \o When blitting a surface Qt has to decide whether to set the \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceBlittingFlags}{DSBLIT_BLEND_ALPHACHANNEL} +flag. If you load an image from file or network data that has a format that +includes an alpha channel, the image might still be completely opaque. +Normally Qt runs through every pixel to check if there really is an alpha +channel there. This involves some overhead but usually pays off in the end +because blitting is cheaper than blending. If you define this Qt will +assume that an image with a format that has alpha channel contains at least +one pixel with an alpha value != 255. + + \row + \o QT_DIRECTFB_SUBSURFACE + \o Defining this enables a mode that tries to minimize overhead from +locking/unlocking surfaces. Note that this currently is experimental. + + \row + \o QT_DIRECTFB_WINDOW_AS_CURSOR + \o Define this if your DirectFB implementation supports windows but +can not render the cursor properly. This involves creating a small top level +window and moving it around when the cursor moves. It does not always +perform well. + + \row + \o QT_NO_DIRECTFB_IMAGEPROVIDER + \o By default Qt will use DirectFB to load QPixmaps from disk/memory. If +your DirectFB implementation does not support this it might make sense to +define this. + + \row + \o QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + \o Define this to make sure Qt always keeps at least one \l +{http://directfb.org/docs/DirectFB_Reference_1_4/IDirectFBImageProvider.html}{IDirectFBImageProvider} +object alive. This is to avoid considerable overhead when the first +IDirectFBImageProvider is created, the last IDirectFBImageProvider is +removed. + +\endtable + +\section2 Unsupported graphics operations + +There are a number of unsupported operations causing fallbacks. DirectFB +does not support the following functions. + + + +\table + \header + \o Functions + \row + \o QPainter::strokePath(const QPainterPath & path, const QPen & pen) + \row + \o QPainter::drawPath(const QPainterPath & path) + \row + \o QPainter::fillPath(const QPainterPath & path, const QBrush & brush) + \row + \o QPainter::drawPoints(const QPointF * points, int pointCount) + \row + \o QPainter::drawEllipse(const QRectF & rectangle) + \row + \o QPainter::drawPolygon(const QPointF * points, int pointCount, + Qt::FillRule fillRule = Qt::OddEvenFill) + \row + \o QPainter::drawText(const QPointF & position, const QString & text) + \row + \o QGradient + \endtable + +\section2 Avoiding fallbacks +To avoid fallbacks make sure that the following points are true: + +\list + \o QPen::isSolid() returns true and uses a color with a one pixel +width. (QPen::width() returns 1. + \o QTransform::TransformationType() <= QTransform::TxScale are not +supported. + \o Clipping must be a simple rectangle or a QRegion. +\endlist + +\section2 When painting images +\note You should use QPixmap instead of QImage. QImages are drawn by +the QRasterPaintEngine. To get a warning for every fallback to the +QRasterPaintEngine, use QT_DIRECTFB_WARN_ON_RASTERFALLBACKS. If +QT_DIRECTFB_DISABLE_RASTERFALLBACKS is defined, DirectFB will only return +instead of falling back to QRasterPaintEngine. Please note that these +defines should only be used when optimizing the application. + +*/ diff --git a/doc/src/platforms/emb-hardwareacceleration.qdocinc b/doc/src/platforms/emb-hardwareacceleration.qdocinc new file mode 100644 index 0000000..3851628 --- /dev/null +++ b/doc/src/platforms/emb-hardwareacceleration.qdocinc @@ -0,0 +1,129 @@ + +\section1 Hardware Acceleration + +When designing applications for embedded devices the choice often stands +between graphics effects and performance. On most devices, you cannot have +both simply because the hardware needed for such operations just is not +there. Still a growing number of devices use hardware dedicated to graphics +operations to improve performance. + +Using graphics acceleration hardware is more power efficient than using the +CPU. The reason for this is that the CPU might require a clock speed that +is up to 20 times higher than the GPU, achieving the same results. E.g. a +typical hardware accelerated mobile graphics unit can rasterize one or two +bilinear texture fetches in one cycle, while a software implementation +takes easily more than 20 cycles. Graphics hardware generally have a much +lower clock speed and memory bandwidth and different level of acceleration +than desktop GPUs. One example is that many GPUs leave out transformation +and lighting from the graphics pipeline and only implements rasterization. + +So the key to write good applications for devices is therefore to limit the +wow factor down to what the target hardware can handle, and to take +advantage of any graphics dedicated hardware. Qt provides several ways to +both render advanced effects on the screen and speed up your application +using hardware accelerated graphics. + +\tableofcontents + +\section2 Qt for Embedded Graphics pipeline + +Qt uses QPainter for all graphics operations. By using the same API +regardless of platform, the code can be reused on different devices. +QPainter use different paint engines implemented in the QPaintEngine API to +do the actual painting. + +The QPaintEngine API provides paint engines for each window system and +painting framework supported by Qt. In regards to Qt for Embedded, this +also includes implementations for OpenGL ES versions 1.1 and 2.0, as well +as OpenVG and DirectFB(Embedded Linux only). + +By using one of these paint engines, you will be able to improve the +graphics performance of your Qt application. However, if the graphics +operations used are not supported, this might as well be a trap, slowing +down your application significantly. This all depends on what kind of +graphics operations that are supported by the target devices hardware +configuration. + +\image platformHWAcc.png + +The paint engine will direct all graphics operations supported by the +devices hardware to the GPU, and from there they are sent to the +framebuffer. Unsupported graphics operations falls back to the +QRasterPaintEngine and are handled by the CPU before sent to the +framebuffer. In the end, the operating system sends the paint updates off +to the screen/display. The fallback operation is quite expensive in regards +to memory consumption, and should be avoided. + +\section2 Hardware configuration requirements + +Before implementing any application using hardware acceleration, it is wise +to get an overview of what kind of hardware accelerated graphics operations +that are available for the target device. + +\note On devices with no hardware acceleration, Qt will use +QRasterPaintEngine, which handles the acceleration using software. On +devices supporting OpenGL ES, OpenVG or DirectFB(not supported by Windows +CE), Qt will use the +respective paint engines to accelerate painting. However, hardware +configurations that only support a limited set of hardware acceleration +features, might slow the application graphics down rather than speeding it +up when using unsupported operations that must fall back to the raster +engine. + +\section3 Different architectures + +Based on the architecture used in a device we can make a recommendation on +which hardware acceleration techniques to use. There are mainly two +different architectures on embedded devices. These are devices with a +Unified Memory Architecture (UMA), and devices with dedicated graphics +memory. Generally, high-end devices will have dedicated graphics memory. +Low-end devices will just use system memory, sometimes reserving a memory +region and sometimes not. + +In addition to this, we can categorize the devices into five types based on +the different graphics operations supported by their hardware. + +\list 1 + \o No support for graphics acceleration. + \o Support for blitter and alpha blending. + \o Support for path based 2D vector graphics. + \o Support for fixed function 3D graphics. + \o Support for programmable 3D graphics. +\endlist + +Based on these characteristics the table below recommends which paint +engines to use with the different types of hardware configurations. + +\section3 Recommended use of hardware acceleration based on hardware + + \table + \header + \o Type + \o UMA + \o Non-UMA + \row + \o \bold {None} + \o Qt Raster Engine + \o Qt Raster Engine + \row + \o \bold {Blitter} + \o DirectFB + \o DirectFB + \row + \o \bold {2D Vector} + \o OpenVG + \o OpenVG + \row + \o \bold {Fixed 3D} + \o OpenGL (ES) 1.x + \o OpenGL (ES) 1.x + \row + \o \bold {Programmable 3D} + \o OpenGL (ES) 2.x + \o OpenGL (ES) 2.x + + \endtable + +\note Since the DirectFB API is quite primitive, the raster paint engine +handles most of the operations. +\note Blitter and Alpha blending is currently not supported on Windows CE. diff --git a/doc/src/platforms/emb-opengl-EmbLinux.qdoc b/doc/src/platforms/emb-opengl-EmbLinux.qdoc new file mode 100644 index 0000000..bede2ca --- /dev/null +++ b/doc/src/platforms/emb-opengl-EmbLinux.qdoc @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qt-embeddedLinux-opengl.html + +\title Qt for Embedded Linux and OpenGL + +\ingroup qt-embedded-linux + +\input platforms/emb-opengl.qdocinc + +\section1 Using OpenGL with Qt for Embedded Linux +Qt for Embedded Linux provides support for integrating OpenGL ES for +drawing into a QGLWidget. The current implementation supports OpenGL and 2D +painting within a QGLWidget. Using OpenGL to accelerate regular widgets and +compositing top-level windows with OpenGL are not currently supported. + +\note OpenGL rendering only works with QGLWidget under QWS. Regular +widgets cannot currently support it. + +\section2 Configure + +It is recommended that Qt for Embedded Linux is configured with the +\c{-DQT_QWS_CLIENTBLIT} and \c{-DQT_NO_QWS_CURSOR} options for optimum +performance. OpenGL is rendered direct to the screen and these options +prevent Qt for Embedded Linux from trying to do its own non-OpenGL +compositing on the QGLWidget contents. + +\section2 Using OpenGL to Implement Window Compositing and Effects + +Compositing effects can be simulated by adjusting the opacity and other +parameters of the items within a QGraphicsView canvas on a QGLWidget +viewport. + +While Qt for Embedded Linux does include a complete windowing system, +using OpenGL to composite regular window surfaces can be quite difficult. +Most of Qt for Embedded Linux assumes that the window surface is a plain +raster memory buffer, with QGLWidget being the sole exception. +The need to constantly re-upload the raster memory buffers into OpenGL +textures for compositing can have a significant impact on performance, +which is why we do not recommend implementing that form of compositing. +We intend to address this problem in future versions of Qt. + +\section1 Integrating OpenGL/ES into Qt for Embedded Linux +\section2 Reference Integration +The reference integration for OpenGL into Qt for Embedded Linux is for the +PowerVR chipset from \l{http://www.imgtec.com/}{Imagination Technologies}. +It consists of two components: \c{pvreglscreen}, which provides the Qt for +Embedded Linux screen driver, and \c{QWSWSEGL}, which implements a plug-in +to the PowerVR EGL implementation to implement low-level OpenGL drawing +surfaces. + +\section2 Integrating Other Chipsets +In this section, we discuss the essential features of the reference +integration that need to be provided for any other chipset integration. + +The QtOpenGL module assumes that a QGLWidget can be represented +by an \c EGLNativeWindowType value in some underlying window system +implementation, and that \c{eglSwapBuffers()} is sufficient to copy +the contents of the native window to the screen when requested. + +However, many EGL implementations do not have a pre-existing window system. +Usually only a single full-screen window is provided, and everything else +must be simulated some other way. This can be a problem because +of QtOpenGL's assumptions. We intend to address these assumptions in a +future version of Qt, but for now, it is the responsibility of the integrator +to provide a rudimentary window system within the EGL implementation. +This is the purpose of \c{QWSWSEGL} in the reference integration. + +If it isn't possible for the EGL implementation to provide a rudimentary +window system, then full-screen windows using QGLWidget can be supported, +but very little else. + +The screen driver needs to inherit from QGLScreen and perform the +following operations in its constructor: + +\snippet src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp 0 + +The \c{setSurfaceFunctions()} call supplies an object that takes care +of converting Qt paint devices such as widgets and pixmaps into +\c EGLNativeWindowType and \c EGLNativePixmapType values. Here we +only support native windows. Because OpenGL rendering is direct to +the screen, we also indicate that client blit is supported. + +Next, we override the \c{createSurface()} functions in QGLScreen: + +\snippet src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp 1 + +Even if Qt for Embedded Linux is used in single-process mode, it is +necessary to create both client-side and server-side versions of the +window surface. In our case, the server-side is just a stub because +the client side directly renders to the screen. + +Note that we only create a \c{PvrEglWindowSurface} if the widget is a +QGLWidget. All other widgets use the normal raster processing. +It can be tempting to make \c{createSurface()} create an OpenGL +window surface for other widget types as well. This has not been +extensively tested and we do not recommend its use at this time. + +The other main piece is the creation of the \c EGLNativeWindowType +value for the widget. This is done in the \c{createNativeWindow()} +override: + +\snippet src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp 2 + +The details of what needs to be placed in this function will vary +from chipset to chipset. The simplest is to return the native window +handle corresponding to the "root" full-screen window: + +\code +*native = rootWindowHandle; +return true; +\endcode + +The most common value for \c rootWindowHandle is zero, but this may +not always be the case. Consult the chipset documentation for the +actual value to use. The important thing is that whatever value is +returned must be suitable for passing to the \c{eglCreateWindowSurface()} +function of the chipset's EGL implementation. + +In the case of PowerVR, the rudimentary window system in \c{QWSWSEGL} +provides a \c PvrQwsDrawable object to represent the \c EGLNativeWindowType +value for the widget. + +*/ diff --git a/doc/src/platforms/emb-opengl.qdocinc b/doc/src/platforms/emb-opengl.qdocinc new file mode 100644 index 0000000..dac5379 --- /dev/null +++ b/doc/src/platforms/emb-opengl.qdocinc @@ -0,0 +1,85 @@ +\section1 Introduction + +\l {http://www.opengl.org}{OpenGL} is an industry standard API for +2D/3D graphics. It provides a powerful, low-level interface between +software and acceleration hardware, and it is operating system and +window system independent. \l {http://www.khronos.org/opengles}{OpenGL ES} +is a subset of the \l {http://www.opengl.org}{OpenGL} standard. Because it +is designed for use with embedded systems, it has a smaller, more +constrained API. + +\l {http://www.khronos.org/opengles/1_X}{OpenGL ES version 1.x} is designed for +fixed function hardware, while its successor \l +{http://www.khronos.org/opengles/2_X}{OpenGL ES version 2.x} is designed for +programmable hardware. It is worth noting that there is a significant +difference between the two, and that they are not compatible with each +other. OpenGL ES 1.x limits processing to a pre-defined set of fixed +options for drawing and lighting objects. OpenGL 2.x has a significantly +shorter graphics pipeline than 1.x. Instead of using function +transformation and a fragment pipeline, 2.x uses the \l +{http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf}{OpenGL +ES Shading Language (GLSL ES)}. Instead of using the pre-defined functions, +the programmer writes small shader programs telling the hardware in detail +how to render each object. + +The \l {QtOpenGL module} offers classes that make it easy to draw 3D +graphics in GUI applications using OpenGL ES. Qt provides a plugin that +integrates both OpenGL ES versions \l +{http://www.khronos.org/opengles/1_X}{1.x} and \l +{http://www.khronos.org/opengles/2_X}{2.x} with Qt for Embedded. However, +Qt for Embedded can be adapted to a wide range of OpenGL versions. + +To translate QPainter operations into OpenGL ES calls (there are actually +two subclasses, one for OpenGL/ES 1.1 and another for OpenGL/ES 2.0), Qt +uses a subclass of QPaintEngine. This specialized paint engine can be used +to improve 2D rendering performance on appropriate hardware. It can also +overlay controls and decorations onto 3D scenes drawn using OpenGL. + +\tableofcontents + +\section1 Using OpenGL ES with Qt +To use OpenGL-enabled widgets in a Qt for Embedded application, all that is +required is to subclass QGLWidget and draw into instances of the subclass +with standard OpenGL functions. The current implementation only +supports OpenGL ES and 2D painting within a QGLWidget. Using OpenGL ES to +accelerate regular widgets as well as compositing top-level windows with +OpenGL ES are not currently supported. These issues will be addressed in +future versions of Qt. + +\note The OpenGL paint engine is not currently supported in regular +widgets. However, any application that uses QGraphicsView can set a +QGLWidget as the viewport and obtain access to the OpenGL paint engine that +way: + +\code + QGraphicsView view(&scene); + view.setViewport(new QGLWidget()); + view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + view.setFrameStyle(0); + view.showFullScreen(); +\endcode + +It is recommended that the QGraphicsView::FullViewportUpdate flag +be set because the default double-buffered behavior of QGLWidget +does not support partial updates. It is also recommended that the +window be shown full-screen because that usually has the best +performance on current OpenGL ES implementations. + +Once a QGraphicsView has been initialized as above, regular widgets +can be added to the canvas using QGraphicsProxyWidget if the +application requires them. + +\note OpenGL ES 2.X does not support PBuffers, so QGLPixelBuffer will not +work. In this case, QGLFramebufferObject should be used instead. However, +OpenGL ES 1.X does not support Framebuffer objects, with the exception of +some OpenGL ES 1.X extensions. In this case, please use QGLPixelBuffer. + +\note On most embedded hardware, the OpenGL implementation is +actually \l{http://www.khronos.org/opengles/1_X/}{OpenGL/ES 1.1} or +\l{http://www.khronos.org/opengles/2_X/}{OpenGL/ES 2.0}. When painting +within a QGLWidget::paintGL() override, it is necessary to limit the +application to only the features that are present in the OpenGL/ES +implementation. + diff --git a/doc/src/platforms/emb-openvg-EmbLinux.qdoc b/doc/src/platforms/emb-openvg-EmbLinux.qdoc new file mode 100644 index 0000000..abdb617 --- /dev/null +++ b/doc/src/platforms/emb-openvg-EmbLinux.qdoc @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qt-embeddedLinux-openvg.html + +\title Qt for Embedded Linux and OpenVG + +\ingroup qt-embedded-linux + +\input platforms/emb-openvg.qdocinc + + + +*/ diff --git a/doc/src/platforms/emb-openvg.qdocinc b/doc/src/platforms/emb-openvg.qdocinc new file mode 100644 index 0000000..37ccb9c --- /dev/null +++ b/doc/src/platforms/emb-openvg.qdocinc @@ -0,0 +1,288 @@ +\section1 Introduction + +\l {http://www.khronos.org/openvg}{OpenVG} is a standard API from the +\l{http://www.khronos.org/openvg}{Khronos Group} for accelerated 2D vector +graphics and raster graphics. It is a dedicated API for 2D graphics on +mobile devices. It is therefore more likely to be a better alternative for +2D acceleration than OpenGL/ES. + +\tableofcontents + +\section1 Using OpenVG with Qt +The QtOpenVG plugin provides support for OpenVG painting. OpenVG is +optimized for 2D vector operations, and closely matches the functionality +in QPainter. To translate QPainter operations into OpenVG calls, Qt uses a +subclass of QPaintEngine. Unlike with OpenGL ES, OpenVG can be used for +acceleration of regular widgets. It can therefore be an excellent substitute +for the default raster-based QPaintEngine on hardware that supports the +OpenVG API. + +\section2 Configure +OpenVG support can be enabled by passing the \c{-openvg} option to +configure. It is assumed that the following qmake variables are set to +appropriate values in the qmake.conf file for your platform: + + \list + \o QMAKE_INCDIR_OPENVG + \o QMAKE_LIBDIR_OPENVG + \o QMAKE_LIBS_OPENVG + \endlist + +Most OpenVG implementations are based on EGL, so the following variables +may also need to be set: + + \list + \o QMAKE_INCDIR_EGL + \o QMAKE_LIBDIR_EGL + \o QMAKE_LIBS_EGL + \endlist + +See \l{qmake Variable Reference} for more information on these variables. + +\section2 Supported OpenVG Engines + +Two kinds of OpenVG engines are currently supported: EGL based, and engines +built on top of OpenGL such as +\l{http://sourceforge.net/projects/shivavg}{ShivaVG}. EGL based engines are +preferred. + +It is assumed that the EGL implementation has some way to turn a +QWidget::winId() into an EGL rendering surface with +\c{eglCreateWindowSurface()}. If this is not the case, then modifications +may be needed to the code under \c{src/gui/egl} and +\c{src/plugins/graphicssystems/openvg} to accomodate the EGL +implementation. + +The ShivaVG graphics system under \c{src/plugins/graphicssystems/shivavg} +is an example of how to integrate a non-EGL implementation of OpenVG into +Qt. It is currently only supported with Qt/X11 and being an example only, +the resulting screen output may not be as good as with other OpenVG +engines. + +\section1 Using the OpenVG graphics system + +Once the graphics system plugin has been built and installed, applications +can be run as follows to use the plugin: + + \code + app -graphicssystem OpenVG + \endcode + +If ShivaVG is being used, then substitute \c ShivaVG instead of \c OpenVG +in the line above. + +If the plugin fails to load, try setting the \c QT_DEBUG_PLUGINS +environment variable to 1 and try again. Usually the plugin cannot be +loaded because Qt cannot locate it in the directory +\c{plugins/graphicssystems} within the Qt installation, or the dynamic +library path does not include the directory containing the system's \c +libOpenVG.so library. + +\section2 Supported features + +\table + \header + \o Feature + \o Description + + \row + \o Context modes + \o The default configuration is "single-context" mode, where a single +EGLContext object is used for all drawing, regardless of the surface. +Multiple EGLSurfaces are created, one for each window surface or pixmap. +eglMakeCurrent() is called with the same EGLContext every time, but a +different EGLSurface. + +Single-context mode is necessary for QPixmapData to be implemented in terms +of a VGImage. If single-context mode is not enabled, then QPixmapData will +use the fallback QRasterPixmapData implementation, which is less efficient +performance-wise. + +Single-context mode can be disabled with the QVG_NO_SINGLE_CONTEXT +define if the OpenVG engine does not support one context with multiple +surfaces. + + \row + \o Transformation matrices + \o All affine and projective transformation matrices are supported. + +QVGPaintEngine will use the engine to accelerate affine transformation +matrices only. When a projective transformation matrix is used, +QVGPaintEngine will transform the coordinates before passing them to the +engine. This will probably incur a performance penalty. + +Pixmaps and images are always transformed by the engine, because OpenVG +specifies that projective transformations must work for images. + +It is recommended that client applications should avoid using projective +transformations for non-image elements in performance critical code. + + \row + \o Composition modes + \o The following composition modes are supported: + +\list +\o QPainter::CompositionMode_SourceOver +\o QPainter::CompositionMode_DestinationOver +\o QPainter::CompositionMode_Source +\o QPainter::CompositionMode_SourceIn +\o QPainter::CompositionMode_DestinationIn +\o QPainter::CompositionMode_Plus +\o QPainter::CompositionMode_Multiply +\o QPainter::CompositionMode_Screen +\o QPainter::CompositionMode_Darken +\o QPainter::CompositionMode_Lighten +\endlist + +The other members of QPainter::CompositionMode are not supported +because OpenVG 1.1 does not have an equivalent in its \c VGBlendMode +enumeration. Any attempt to set an unsupported mode will result in +the actual mode being set to QPainter::CompositionMode_SourceOver. +Client applications should avoid using unsupported modes. + + \row + \o Pens and brushes + \o All pen styles are supported, including cosmetic pens. + +All brush styles are supported except for conical gradients, which are not +supported by OpenVG 1.1. Conical gradients will be converted into a solid +color brush corresponding to the first color in the gradient's color ramp. + +Affine matrices are supported for brush transforms, but not projective +matrices. + + + \row + \o Rectangles, lines, and points + \o Rectangles, lines, and rounded rectangles use cached VGPath +objects to try to accelerate drawing operations. vgModifyPathCoords() is +used to modify the co-ordinates in the cached VGPath object each time +fillRect(), drawRects(), drawLines(), or drawRoundedRect() is called. + +If the engine does not implement vgModifyPathCoords() properly, then the +QVG_NO_MODIFY_PATH define can be set to disable path caching. This will +incur a performance penalty. + +Points are implemented as lines from the point to itself. The cached line +drawing VGPath object is used when drawing points. + + \row + \o Polygons and Ellipses + \o Polygon and ellipse drawing creates a new VGPath object every +time drawPolygon() or drawEllipse() is called. If the client application +is making heavy use of these functions, the constant creation and +destruction of VGPath objects could have an impact on performance. + +If a projective transformation is active, ellipses are converted into cubic +curves prior to transformation, which may further impact performance. + +Client applications should avoid polygon and ellipse drawing in performance +critical code if possible. + + \row + \o Other Objects + \o Most other objects (arcs, pies, etc) use drawPath(), which takes +a QPainterPath argument. The default implementation in QPainterEngineEx +converts the QPainterPath into a QVectorPath and then calls draw(), which +in turn converts the QVectorPath into a VGPath for drawing. + +To reduce the overhead, we have overridden drawPath() in QVGPaintEngine to +convert QPainterPath's directly into VGPath's. This should help improve +performance compared to the default implementation. + +Client applications should try to avoid these types of objects in +performance critical code because of the QPainterPath to VGPath conversion +cost. + + \row + \o Clipping + \o Clipping with QRect, QRectF, and QRegion objects is supported on +all OpenVG engines with vgMask() if the transformation matrix is the +identity or a simple origin translation. + +Clipping with an arbitrary QPainterPath, or setting the clip region when +the transformation matrix is simple, is supported only if the OpenVG engine +has the vgRenderToMask() function (OpenVG 1.1 and higher). + +The QVG_NO_RENDER_TO_MASK define will disable the use of vgRenderToMask(). + +The QVG_SCISSOR_CLIP define will disable clipping with vgMask() or +vgRenderToMask() and instead use the scissor rectangle list to perform +clipping. Clipping with an arbitrary QPainterPath will not be supported. + +The QVG_SCISSOR_CLIP define should only be used if the OpenVG engine does +not support vgMask() or vgRenderToMask(). + + \row + \o Opacity + \o Opacity is supported for all drawing operations. Solid color +pens, solid color brushes, gradient brushes, and image drawing with +drawPixmap() and drawImage() will probably have the best performance +compared to other kinds of pens and brushes. + + \row + \o Text Drawing + \o If OpenVG 1.1 is used, the paint engine will use VG fonts to +cache glyphs while drawing. If the engine does not support VG fonts +correctly, QVG_NO_DRAW_GLYPHS can be defined to disable this mode. Text +drawing performance will suffer if VG fonts are not used. + +By default, image-based glyphs are used. If QVG_NO_IMAGE_GLYPHS is defined, +then path-based glyphs will be used instead. QVG_NO_IMAGE_GLYPHS is ignored +if QVG_NO_DRAW_GLYPHS is defined. + +If path-based glyphs are used, then the OpenVG engine will need to support +hinting to render text with good results. Image-based glyphs avoids the +need for hinting and will usually give better results than path-based +glyphs. + + \row + \o Pixmaps + \o In single-context mode, pixmaps will be implemented using +VGImage unless QVG_NO_PIXMAP_DATA is defined. + +QVGPixmapData will convert QImage's into VGImage's when the application +calls drawPixmap(), and the pixmap will be kept in VGImage form for the +lifetime of the QVGPixmapData object. When the application tries to paint +into a QPixmap with QPainter, the data will be converted back into a QImage +and the raster paint engine will be used to render into the QImage. + +This arrangement optimizes for the case of drawing the same static pixmap +over and over (e.g. for icons), but does not optimize the case of drawing +into pixmaps. + +Bitmaps must use QRasterPixmapData. They are not accelerated with VGImage +at present. + + \row + \o Pixmap filters + \o Convolution, colorize, drop shadow, and blur filters are +accelerated using OpenVG operations. + +\endtable + +\section2 Known issues + +Performance of copying the contents of an OpenVG-rendered window to the +screen needs platform-specific work in the QVGWindowSurface class. + +Clipping with arbitrary non-rectangular paths only works on engines that +support vgRenderToMask(). Simple rectangular paths are supported on all +engines that correctly implement vgMask(). + +The paint engine is not yet thread-safe, so it is not recommended for use +in threaded Qt applications that draw from multiple threads. Drawing should +be limited to the main GUI thread. + +Performance of projective matrices for non-image drawing is not as good +as for affine matrices. + +QPixmap's are implemented as VGImage objects so that they can be quickly +rendered with drawPixmap(). Rendering into a QPixmap using QPainter will +use the default Qt raster paint engine on a QImage copy of the QPixmap, and +will not be accelerated. This issue may be addressed in a future version +of the engine. + +ShivaVG support is highly experimental and limited to Qt/X11. It is +provided as an example of how to integrate a non-EGL engine. + diff --git a/doc/src/platforms/qt-embedded-linux.qdoc b/doc/src/platforms/qt-embedded-linux.qdoc index 21cbf3b..a6524d7 100644 --- a/doc/src/platforms/qt-embedded-linux.qdoc +++ b/doc/src/platforms/qt-embedded-linux.qdoc @@ -96,7 +96,7 @@ \o \l {Qt for Embedded Linux Pointer Handling}{Pointer Handling} \o \l {Qt for Embedded Linux Character Input}{Character Input} \o \l {Qt for Embedded Linux Display Management}{Display Management} - \o \l {Qt for Embedded Linux and OpenGL}{OpenGL} + \o \l {Qt for Embedded Linux Hardware Accelerated Graphics}{Hardware Accelerated Graphics} \o \l {Qt for Embedded Linux Fonts}{Fonts} \endlist diff --git a/doc/src/platforms/wince-introduction.qdoc b/doc/src/platforms/wince-introduction.qdoc index 46ecbf6..886b084 100644 --- a/doc/src/platforms/wince-introduction.qdoc +++ b/doc/src/platforms/wince-introduction.qdoc @@ -65,7 +65,7 @@ \endlist \o \list - \o \l {Windows CE OpenGL ES}{OpenGL ES} + \o \l {Qt for Windows CE Hardware Accelerated Graphics}{Hardware Accelerated Graphics} \o \l {Qt Performance Tuning} \o \l {Fine-Tuning Features in Qt} \endlist diff --git a/doc/src/platforms/wince-opengl.qdoc b/doc/src/platforms/wince-opengl.qdoc index 4fc4d7b..0ea2ec6 100644 --- a/doc/src/platforms/wince-opengl.qdoc +++ b/doc/src/platforms/wince-opengl.qdoc @@ -41,58 +41,48 @@ /*! \page windowsce-opengl.html - \title Windows CE OpenGL ES + \title Qt for Windows CE and OpenGL ES \ingroup qtce \brief Information about support for OpenGL ES with Qt for Windows CE. - \section1 Introduction + \input platforms/emb-opengl.qdocinc - \l {http://www.opengl.org}{OpenGL} is an industry standard API for 2D/3D - graphics. It provides a powerful, low-level interface between software - and acceleration hardware, and it is operating system and window system - independent. +\section1 Using OpenGL with Qt for Windows CE +Qt for Windows CE uses EGL 1.1 to embed OpenGL ES windows within the +Windows CE window manager. - \l {http://www.khronos.org/opengles}{OpenGL ES} is a subset of the - \l {http://www.opengl.org}{OpenGL} standard. It is meant for use in - embedded systems. Hence, it has a smaller, more constrained API. +\section2 Configure - Qt for Windows CE uses EGL 1.1 to embed OpenGL ES windows within the - Windows CE window manager. +To configure Qt for Windows Mobile 5.0 and OpenGL ES Common Lite support +you can run \c{configure} like this: - To use OpenGL ES enabled widgets in a Qt for Windows CE application, you - only need to subclass QGLWidget and draw on instances of the subclass with - OpenGL ES functions. - - OpenGL ES includes profiles for floating-point and fixed-point arithmetic. - The floating point profile is called OpenGL ES CM (Common) and the - fixed-point profile is called OpenGL ES CL (Common Lite). - - You can run \c{configure} with the \c{-opengl-es-cm} option for the Common - profile or \c{-opengl-es-cl} for the Common Lite profile. In both cases, - ensure that the \c{lib} and \c{includes} paths include the OpenGL ES - headers and libararies from your SDK. The OpenGL ES lib should be called - either \c{libGLES_CM.lib} for the Common profile or \c{libGLES_CL.lib} - for the Common Lite profile. + \snippet doc/src/snippets/code/doc_src_wince-opengl.qdoc 0 - To configure Qt for Windows Mobile 5.0 and OpenGL ES Common Lite support - you can run \c{configure} like this: +OpenGL ES includes profiles for floating-point and fixed-point arithmetic. +The floating point profile is called OpenGL ES CM (Common) and the +fixed-point profile is called OpenGL ES CL (Common Lite). - \snippet doc/src/snippets/code/doc_src_wince-opengl.qdoc 0 +You can run \c{configure} with the \c{-opengl-es-cm} option for the Common +profile or \c{-opengl-es-cl} for the Common Lite profile. In both cases, +ensure that the \c{lib} and \c{includes} paths include the OpenGL ES +headers and libararies from your SDK. The OpenGL ES lib should be called +either \c{libGLES_CM.lib} for the Common profile or \c{libGLES_CL.lib} for +the Common Lite profile. - The distinction between the Common and Common Lite profiles is important, - because the Common Lite profile has less functionality and only supports a - fixed-point vertex format. +The distinction between the Common and Common Lite profiles is important, +because the Common Lite profile has less functionality and only supports a +fixed-point vertex format. - To start programming with Qt and OpenGL ES on Windows CE, you can start - with the \l{Hello GL ES Example}. This example shows how to use QGLWidget - and QGLPainter with OpenGL ES. It also provides some hints on how to port - OpenGL code to OpenGL ES. +To start programming with Qt and OpenGL ES on Windows CE, you can start +with the \l{Hello GL ES Example}. This example shows how to use QGLWidget +and QGLPainter with OpenGL ES. It also provides some hints on how to port +OpenGL code to OpenGL ES. - \section2 Using OpenGL to Accelerate Normal 2D Painting +\section2 Using OpenGL to Accelerate Normal 2D Painting - Qt provides QOpenGLPaintEngine, a subclass of QPaintEngine that translates - QPainter operations into OpenGL calls. This is especially convenient for - drawing text or QImage objects in an OpenGL ES context. For further - details, refer to the \l{Hello GL ES Example}. +Qt provides QOpenGLPaintEngine, a subclass of QPaintEngine that translates +QPainter operations into OpenGL calls. This is especially convenient for +drawing text or QImage objects in an OpenGL ES context. For further +details, refer to the \l{Hello GL ES Example}. */ diff --git a/doc/src/platforms/wince-openvg.qdoc b/doc/src/platforms/wince-openvg.qdoc new file mode 100644 index 0000000..047c655 --- /dev/null +++ b/doc/src/platforms/wince-openvg.qdoc @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page windowsce-openvg.html + \title Qt for Windows CE and OpenVG + \ingroup qtce + \brief Information about support for OpenVG with Qt for Windows CE. + + \input platforms/emb-openvg.qdocinc + +\section1 Using OpenVG with Qt for Windows CE +Qt for Windows CE uses EGL 1.1 to embed OpenVG windows within the Windows +CE window manager. + +\note Make sure that your Windows CE SDK have a working EGL implementation. +If not, OpenVG will not work. + +\note There is currently no support for Blitting and Alpha blending in Qt +for Windows CE. + +\note To configure Qt for Windows Mobile 5.0 and OpenVG support you can run +\c{configure} like this: + + \snippet doc/src/snippets/code/doc_src_wince-opengl.qdoc 0 + +*/ -- cgit v0.12 From 393f53184a35f380ddd7cf44a0947c2309c373bc Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 5 Nov 2009 14:13:34 +0100 Subject: Revert "Make animation timer slightly more accurate with default interval of 15" The new threashold for using the multimedia timer is 20, so we can get back to 16 ms for the interval. This reverts commit bdcde683bc863d0c574b1e4d64b5a16ba0130596. --- src/corelib/animation/qabstractanimation.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index f967081..edc1503 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -156,8 +156,7 @@ #ifndef QT_NO_ANIMATION -//with 15 ms we get more accuracy on windows (it uses the multimedia timer) -#define DEFAULT_TIMER_INTERVAL 15 +#define DEFAULT_TIMER_INTERVAL 16 #define STARTSTOP_TIMER_DELAY 0 QT_BEGIN_NAMESPACE -- cgit v0.12 From d724b1708149ec8eac0d7f6ad44161d00c66c1b2 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 5 Nov 2009 13:24:58 +0100 Subject: Don't crash in QStateMachine when event transition listens to QApplication instance We can't assert on actually watching the watched object, since we may have installed an event filter on QApplication::instance(), in which case we will filter events for all objects. Reviewed-by: Gunnar --- src/corelib/statemachine/qstatemachine.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index cf951c9..ecf3f9c 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1616,9 +1616,8 @@ void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transitio } void QStateMachinePrivate::handleFilteredEvent(QObject *watched, QEvent *event) -{ - Q_ASSERT(qobjectEvents.contains(watched)); - if (qobjectEvents[watched].contains(event->type())) { +{ + if (qobjectEvents.value(watched).contains(event->type())) { postInternalEvent(new QStateMachine::WrappedEvent(watched, handler->cloneEvent(event))); processEvents(DirectProcessing); } -- cgit v0.12 From d456ac11027f7573aa32745a8bc972d2b83926f4 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 5 Nov 2009 14:17:56 +0100 Subject: Add test for QEventTransition when filtering on a QApplication instance Test for 8ec037effce7f515fffed6b05c011e385fb52593. Reviewed-by: Gunnar --- tests/auto/qstatemachine/tst_qstatemachine.cpp | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 9a2b2ed..fd39515 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -208,6 +208,7 @@ private slots: void task260403_clonedSignals(); void postEventFromOtherThread(); + void eventFilterForApplication(); }; tst_QStateMachine::tst_QStateMachine() @@ -4276,5 +4277,35 @@ void tst_QStateMachine::postEventFromOtherThread() QTRY_COMPARE(finishedSpy.count(), 1); } +void tst_QStateMachine::eventFilterForApplication() +{ + QStateMachine machine; + + QState *s1 = new QState(&machine); + { + machine.setInitialState(s1); + } + + QState *s2 = new QState(&machine); + + QEventTransition *transition = new QEventTransition(QCoreApplication::instance(), + QEvent::ApplicationActivate); + transition->setTargetState(s2); + s1->addTransition(transition); + + machine.start(); + QCoreApplication::processEvents(); + + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s1)); + + QCoreApplication::postEvent(QCoreApplication::instance(), + new QEvent(QEvent::ApplicationActivate)); + QCoreApplication::processEvents(); + + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s2)); +} + QTEST_MAIN(tst_QStateMachine) #include "tst_qstatemachine.moc" -- cgit v0.12 From 2e2c2af0c87c101ead3819e5ee74f7dac7eb6e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 5 Nov 2009 15:26:52 +0200 Subject: QS60Style: Harmonize theme graphic with LineEdit and QTextEdit In S60 the single line and multi line editors have same theme background. We should share one as well. Now we are using fancy notepad graphic with QTextEdit, but it makes QTextEdits to look apart from QLineEdits and in some themes it is styled rather badly (as it is not a central graphic item in a theme). Therefore it is better to use one and same graphic for both widgets. Task-number: QTBUG-5259 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 2 +- src/gui/styles/qs60style_p.h | 1 - src/gui/styles/qs60style_s60.cpp | 14 -------------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 0b126a6..e0fcb92 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -281,7 +281,7 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, drawFrame(SF_ButtonInactive, painter, rect, flags | SF_PointNorth); break; case SE_Editor: - drawFrame(SF_Editor, painter, rect, flags | SF_PointNorth); + drawFrame(SF_FrameLineEdit, painter, rect, flags | SF_PointNorth); break; default: break; diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 54af757..46547bf 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -361,7 +361,6 @@ public: SF_ToolBarButtonPressed, SF_PanelBackground, SF_ButtonInactive, - SF_Editor, }; enum SkinElementFlag { diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 0cd87bd..c2a207c 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -319,16 +319,6 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* 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_QsnFrNotepadCornerTl */ {KAknsIIDQsnFrNotepadContCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrNotepadCornerTr */ {KAknsIIDQsnFrNotepadContCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrNotepadCornerBl */ {KAknsIIDQsnFrNotepadCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrNotepadCornerBr */ {KAknsIIDQsnFrNotepadCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrNotepadSideT */ {KAknsIIDQsnFrNotepadContSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrNotepadSideB */ {KAknsIIDQsnFrNotepadSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrNotepadSideL */ {KAknsIIDQsnFrNotepadSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrNotepadSideR */ {KAknsIIDQsnFrNotepadSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrNotepadCenter */ {KAknsIIDQsnFrNotepadCenter, EDrawIcon, ES60_AllReleases, -1,-1}, - }; QPixmap QS60StyleModeSpecifics::skinnedGraphics( @@ -852,10 +842,6 @@ void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameEleme centerId.Set(KAknsIIDNone); frameId.Set(KAknsIIDQsnFrSetOpt); break; - case QS60StylePrivate::SF_Editor: - centerId.Set(KAknsIIDQsnFrNotepadCenter); - frameId.Set(KAknsIIDQsnFrNotepadCont); - break; default: // center should be correct here frameId.iMinor = centerId.iMinor - 9; -- cgit v0.12 From 9f86dcf0acaeba57728c3d51a1a6e57f8a8445b2 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 5 Nov 2009 14:07:05 +0100 Subject: Fixed crash in QPixmap::resize_helper on mac and x11 Reviewed-by: Trond --- src/gui/image/qpixmap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index c452b9a..dfeea76 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -639,13 +639,13 @@ void QPixmap::resize_helper(const QSize &s) QPixmap pm(QSize(w, h), data ? data->type : QPixmapData::PixmapType); bool uninit = false; #if defined(Q_WS_X11) - QX11PixmapData *x11Data = data->classId() == QPixmapData::X11Class ? static_cast(data.data()) : 0; + QX11PixmapData *x11Data = data && data->classId() == QPixmapData::X11Class ? static_cast(data.data()) : 0; if (x11Data) { pm.x11SetScreen(x11Data->xinfo.screen()); uninit = x11Data->flags & QX11PixmapData::Uninitialized; } #elif defined(Q_WS_MAC) - QMacPixmapData *macData = data->classId() == QPixmapData::MacClass ? static_cast(data.data()) : 0; + QMacPixmapData *macData = data && data->classId() == QPixmapData::MacClass ? static_cast(data.data()) : 0; if (macData) uninit = macData->uninit; #endif -- cgit v0.12 From 4cd683231190443e5243f66098c7322e3808a131 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 5 Nov 2009 14:29:48 +0100 Subject: Documentation: Updating Embedded HW acc. docs Removing redundant file Task-number: QT-1109 --- doc/src/platforms/emb-opengl.qdoc | 230 -------------------------------------- 1 file changed, 230 deletions(-) delete mode 100644 doc/src/platforms/emb-opengl.qdoc diff --git a/doc/src/platforms/emb-opengl.qdoc b/doc/src/platforms/emb-opengl.qdoc deleted file mode 100644 index 2ed5d04..0000000 --- a/doc/src/platforms/emb-opengl.qdoc +++ /dev/null @@ -1,230 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\page qt-embedded-opengl.html - -\title Qt for Embedded Linux and OpenGL -\ingroup qt-embedded-linux - -\section1 Introduction - -\l {http://www.opengl.org}{OpenGL} is an industry standard API for -2D/3D graphics. It provides a powerful, low-level interface between -software and acceleration hardware, and it is operating system and -window system independent. - -\l {http://www.khronos.org/opengles}{OpenGL ES} is a subset -of the \l {http://www.opengl.org}{OpenGL} standard. -Because it is meant for use in embedded systems, it has a smaller, -more constrained API. - -For reference, Nokia provides support for integrating \l -{http://www.khronos.org/opengles}{OpenGL ES} with Qt for Embedded Linux -for drawing into a QGLWidget. - -The current implementation supports OpenGL and 2D painting within a -QGLWidget. Using OpenGL to accelerate regular widgets and compositing -top-level windows with OpenGL are not currently supported. These issues -will be addressed in future versions of Qt. - -It is recommended that Qt for Embedded Linux is configured with the -\c{-DQT_QWS_CLIENTBLIT} and \c{-DQT_NO_QWS_CURSOR} options for optimum -performance. OpenGL is rendered direct to the screen and these options -prevent Qt for Embedded Linux from trying to do its own non-OpenGL -compositing on the QGLWidget contents. - -\section2 Using OpenGL 3D Graphics in Applications - -The \l {QtOpenGL module} offers classes that make it easy to draw 3D -graphics in GUI applications. The module API is cross-platform, so it -is also available on Windows, X11, and Mac OS X. - -To use OpenGL-enabled widgets in a Qt for Embedded Linux application, -all that is required is to subclass the QGLWidget and draw into instances of -the subclass with standard OpenGL functions. - -Note that on most embedded hardware, the OpenGL implementation is -actually \l{http://www.khronos.org/opengles/1_X/}{OpenGL/ES 1.1} or -\l{http://www.khronos.org/opengles/2_X/}{OpenGL/ES 2.0}. When painting -within a QGLWidget::paintGL() override, it is necessary to limit the -application to only the features that are present in the OpenGL/ES -implementation. - -\section2 Using OpenGL to Accelerate Normal 2D Painting - -Qt provides a subclass of QPaintEngine that translates QPainter operations -into OpenGL calls (there are actually two subclasses, one for OpenGL/ES 1.1 -and another for OpenGL/ES 2.0). This specialized paint engine can be used -to improve 2D rendering performance on appropriate hardware. It can also -overlay controls and decorations onto 3D scenes drawn using OpenGL. - -As mentioned above, the OpenGL paint engine is not currently supported -in regular widgets. However, any application that uses QGraphicsView -can set a QGLWidget as the viewport and obtain access to the -OpenGL paint engine that way: - -\code -QGraphicsView view(&scene); -view.setViewport(new QGLWidget); -view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); -view.showFullScreen(); -\endcode - -It is recommended that the QGraphicsView::FullViewportUpdate flag -be set because the default double-buffered behavior of QGLWidget -does not support partial updates. It is also recommended that the -window be shown full-screen because that usually has the best -performance on current OpenGL/ES implementations. - -Once a QGraphicsView has been initialized as above, regular widgets -can be added to the canvas using QGraphicsProxyWidget if the -application requires them. - -\section2 Using OpenGL to Implement Window Compositing and Effects - -Compositing effects can be simulated by adjusting the opacity and -other parameters of the items within a QGraphicsView canvas on a -QGLWidget viewport. - -While Qt for Embedded Linux does include a complete windowing system, -using OpenGL to composite regular window surfaces can be quite difficult. -Most of Qt for Embedded Linux assumes that the window surface is a plain -raster memory buffer, with QGLWidget being the sole exception. -The need to constantly re-upload the raster memory buffers into OpenGL -textures for compositing can have a significant impact on performance, -which is why we do not recommend implementing that form of compositing. -We intend to address this problem in future versions of Qt. - -\section1 Integrating OpenGL/ES into Qt for Embedded Linux - -\section2 Reference Integration - -The reference integration for OpenGL into Qt for Embedded Linux -is for the PowerVR chipset from \l{http://www.imgtec.com/}{Imagination -Technologies}. It consists of two components: \c{pvreglscreen} which -provides the Qt for Embedded Linux screen driver, and \c{QWSWSEGL} -which implements a plug-in to the PowerVR EGL implementation to -implement low-level OpenGL drawing surfaces. - -\section2 Integrating Other Chipsets - -In this section we discuss the essential features of the reference -integration that need to be provided for any other chipset integration. - -The QtOpenGL module assumes that a QGLWidget can be represented -by a \c EGLNativeWindowType value in some underlying window system -implementation, and that \c{eglSwapBuffers()} is sufficient to copy -the contents of the native window to the screen when requested. - -However, many EGL implementations do not have a pre-existing window system. -Usually only a single full-screen window is provided, and everything else -must be simulated some other way. This can be a problem because -of QtOpenGL's assumptions. We intend to address these assumptions in a -future version of Qt, but for now it is the responsibility of the integrator -to provide a rudimentary window system within the EGL implementation. -This is the purpose of \c{QWSWSEGL} in the reference integration. - -If it isn't possible for the EGL implementation to provide a rudimentary -window system, then full-screen windows using QGLWidget can be supported, -but very little else. - -The screen driver needs to inherit from QGLScreen and perform the -following operations in its constructor: - -\snippet src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp 0 - -The \c{setSurfaceFunctions()} call supplies an object that takes care -of converting Qt paint devices such as widgets and pixmaps into -\c EGLNativeWindowType and \c EGLNativePixmapType values. Here we -only support native windows. Because OpenGL rendering is direct to -the screen, we also indicate that client blit is supported. - -Next, we override the \c{createSurface()} functions in QGLScreen: - -\snippet src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp 1 - -Even if Qt for Embedded Linux is used in single-process mode, it is -necessary to create both client-side and server-side versions of the -window surface. In our case, the server-side is just a stub because -the client side directly renders to the screen. - -Note that we only create a \c{PvrEglWindowSurface} if the widget is a -QGLWidget. All other widgets use the normal raster processing. -It can be tempting to make \c{createSurface()} create an OpenGL -window surface for other widget types as well. This has not been -extensively tested and we do not recommend its use at this time. - -The other main piece is the creation of the \c EGLNativeWindowType -value for the widget. This is done in the \c{createNativeWindow()} -override: - -\snippet src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp 2 - -The details of what needs to be placed in this function will vary -from chipset to chipset. The simplest is to return the native window -handle corresponding to the "root" full-screen window: - -\code -*native = rootWindowHandle; -return true; -\endcode - -The most common value for \c rootWindowHandle is zero, but this may -not always be the case. Consult the chipset documentation for the -actual value to use. The important thing is that whatever value is -returned must be suitable for passing to the \c{eglCreateWindowSurface()} -function of the chipset's EGL implementation. - -In the case of PowerVR, the rudimentary window system in \c{QWSWSEGL} -provides a \c PvrQwsDrawable object to represent the \c EGLNativeWindowType -value for the widget. - -\section1 OpenVG Support - -\l {http://www.khronos.org/openvg} {OpenVG} is a dedicated API for 2D -graphics on mobile devices. It is therefore more likely to be a better -alternative for 2D acceleration than OpenGL/ES. Acceleration of -regular widgets is supported with OpenVG, unlike with OpenGL/ES. -See \l{OpenVG Rendering in Qt} for more information on the -OpenVG support in Qt. - -*/ -- cgit v0.12 From 83052dc7c7ddb8169e1e5607a2fb2f9c6097c6f0 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 5 Nov 2009 14:12:55 +0100 Subject: Remove unnessisary QGLFBOGLPaintDevice re-implementations Now QGLFBO doesn't do stacking, QGLPaintDevice's base implementation is ok to use. Reviewed-By: Trond --- src/opengl/qglframebufferobject.cpp | 30 ------------------------------ src/opengl/qglframebufferobject_p.h | 3 --- 2 files changed, 33 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 5295b6d..ddb107e 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -342,36 +342,6 @@ QGLContext *QGLFBOGLPaintDevice::context() const return fboContext; } -void QGLFBOGLPaintDevice::ensureActiveTarget() -{ - if (QGLContext::currentContext() != context()) - context()->makeCurrent(); - - QGLContext* ctx = const_cast(QGLContext::currentContext()); - Q_ASSERT(ctx); - const GLuint fboId = fbo->d_func()->fbo(); - if (ctx->d_func()->current_fbo != fboId) { - ctx->d_func()->current_fbo = fboId; - glBindFramebuffer(GL_FRAMEBUFFER_EXT, fboId); - } -} - -void QGLFBOGLPaintDevice::beginPaint() -{ - if (QGLContext::currentContext() != context()) - context()->makeCurrent(); - - wasBound = fbo->isBound(); - if (!wasBound) - fbo->bind(); -} - -void QGLFBOGLPaintDevice::endPaint() -{ - if (!wasBound) - fbo->release(); -} - bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const { QGL_FUNCP_CONTEXT; diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index c341459..800cb68 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -111,9 +111,6 @@ public: virtual QSize size() const {return fbo->size();} virtual QGLContext* context() const; virtual QGLFormat format() const {return fboFormat;} - virtual void ensureActiveTarget(); - virtual void beginPaint(); - virtual void endPaint(); void setFBO(QGLFramebufferObject* f, QGLFramebufferObject::Attachment attachment); -- cgit v0.12 From 0818c05f22509a4ee9310f1d313460f422d9d32b Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 5 Nov 2009 14:14:52 +0100 Subject: Fix docs for QGLFramebufferObject & add warnings in bind/release Warnings are for binding/releasing when the current context isn't in the same context group as the FBO was created in. Reviewed-By: Trond --- src/opengl/qglframebufferobject.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index ddb107e..d79283e 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -846,13 +846,6 @@ bool QGLFramebufferObject::isValid() const framebuffer to this framebuffer object. Returns true upon success, false otherwise. - Since 4.6: if another QGLFramebufferObject instance was already bound - to the current context, then its handle() will be remembered and - automatically restored when release() is called. This allows multiple - framebuffer rendering targets to be stacked up. It is important that - release() is called on the stacked framebuffer objects in the reverse - order of the calls to bind(). - \sa release() */ bool QGLFramebufferObject::bind() @@ -864,6 +857,13 @@ bool QGLFramebufferObject::bind() if (!ctx) return false; // Context no longer exists. const QGLContext *current = QGLContext::currentContext(); +#ifdef QT_DEBUG + if (!current || + QGLContextPrivate::contextGroup(current) != QGLContextPrivate::contextGroup(ctx)) + { + qWarning("QGLFramebufferObject::bind() called from incompatible context"); + } +#endif glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->fbo()); d->valid = d->checkFramebufferStatus(); if (d->valid && current) @@ -889,6 +889,15 @@ bool QGLFramebufferObject::release() return false; // Context no longer exists. const QGLContext *current = QGLContext::currentContext(); + +#ifdef QT_DEBUG + if (!current || + QGLContextPrivate::contextGroup(current) != QGLContextPrivate::contextGroup(ctx)) + { + qWarning("QGLFramebufferObject::release() called from incompatible context"); + } +#endif + if (current) { current->d_ptr->current_fbo = 0; glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); -- cgit v0.12 From 4488ab7d7a0b9ff72d9614b68a7cdb72286ac2a3 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 5 Nov 2009 14:38:55 +0100 Subject: My changelog for Qt 4.6.0 --- dist/changes-4.6.0 | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 627760a..826dfd9 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -39,6 +39,11 @@ Third party components * Since the 4.6 beta Qt::RenderHint has been moved to QGraphicsBlurEffect::BlurHint. + * Input contexts are not activated for disabled widgets anymore. + + * [250555] Data copied from Mozilla Firefox can now be pasted correctly to + a Qt application. + QtCore - QVariant @@ -64,6 +69,8 @@ QtCore - QTextStream * [221316] Fixed crash on large input. + * Improved reading utf8/utf16/utf32 data by correctly skipping the + ByteOrderMark when reading data by one character at a time. QtGui @@ -106,7 +113,8 @@ QtGui - QWidget * [201649] Added QWidget::previousInFocusChain - + * [254563] Fixed a crash when setting a focus in a widget tree that + contains invisible widgets **************************************************************************** * Platform Specific Changes * @@ -141,6 +149,23 @@ QtGui - KDE Integration: Improved the integration into KDE desktop (loading of KDE palette, usage of KColorDialog and KFileDialog) using the GuiPlatformPlugin + - Fixed pasting the clipboard content to non-Qt application on X11 when the + requested format is image/ppm. Patch by Ritt.K + + - On Windows when a file cannot be accessed (stat()ed), we are now restoring + the error mode to the original value. + + - On X11 Qt now supports the _NET_WM_SYNC protocol. + + - On X11 Qt now supports the SAVE_TARGET protocol that allows to keep + clipboard contents if the application that owns the clipboards exits + + - [QTBUG-4652] On X11 clipboard content can be properly retrieved even when an + application asks the unsupported target. This fixes copying and pasting data + when using Synergy. + + - [QTBUG-4418] Fixed maximizing and restoring a window on Mac. + **************************************************************************** * Tools * **************************************************************************** -- cgit v0.12 From 24675593113167bfffcb4791e9c3e0865a0c3244 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 5 Nov 2009 14:38:35 +0100 Subject: Improve the reliability of tst_QGridLayout::minMaxSize() As indicated by the comments, if the test fails, the timeouts may need to be increased. Since this is failing on the test cluster, where CPU time is limited, doubling the timeouts seems to do the trick. Reviewed-by: Richard Moe Gustavsen --- tests/auto/qgridlayout/tst_qgridlayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qgridlayout/tst_qgridlayout.cpp b/tests/auto/qgridlayout/tst_qgridlayout.cpp index 7c320be..46e2a03 100644 --- a/tests/auto/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/qgridlayout/tst_qgridlayout.cpp @@ -920,9 +920,9 @@ void tst_QGridLayout::minMaxSize() #if defined(Q_WS_X11) qt_x11_wait_for_window_manager(m_toplevel); // wait for the show #endif - QTest::qWait(20); + QTest::qWait(40); m_toplevel->adjustSize(); - QTest::qWait(120); // wait for the implicit adjustSize + QTest::qWait(240); // wait for the implicit adjustSize // If the following fails we might have to wait longer. // If that does not help there is likely a problem with the implicit adjustSize in show() if (!fixedSize.isValid()) { -- cgit v0.12 From 86388f7a5224da867ace47a41ed93982dfed7cfc Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 5 Nov 2009 14:58:43 +0100 Subject: Use fallback stroker for cosmetic strokes with asymetric transforms Reviewed-by: Samuel --- src/gui/painting/qtransform.cpp | 9 ++++++--- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 8118450..1bd5842 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -2214,12 +2214,14 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale) { const QTransform::TransformationType type = transform.type(); if (type <= QTransform::TxTranslate) { - *scale = 1; + if (scale) + *scale = 1; return true; } else if (type == QTransform::TxScale) { const qreal xScale = qAbs(transform.m11()); const qreal yScale = qAbs(transform.m22()); - *scale = qMax(xScale, yScale); + if (scale) + *scale = qMax(xScale, yScale); return qFuzzyCompare(xScale, yScale); } @@ -2227,7 +2229,8 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale) + transform.m21() * transform.m21(); const qreal yScale = transform.m12() * transform.m12() + transform.m22() * transform.m22(); - *scale = qSqrt(qMax(xScale, yScale)); + if (scale) + *scale = qSqrt(qMax(xScale, yScale)); return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index d20700f..1527e72 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1221,6 +1221,9 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) } } +extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp + + void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) { Q_D(QGL2PaintEngineEx); @@ -1231,6 +1234,11 @@ void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) return; QOpenGL2PaintEngineState *s = state(); + if (pen.isCosmetic() && !qt_scaleForTransform(s->transform(), 0)) { + // QTriangulatingStroker class is not meant to support cosmetically sheared strokes. + QPaintEngineEx::stroke(path, pen); + return; + } ensureActive(); -- cgit v0.12 From 089056a8ae16c740616dc2b443694af7ac1853f0 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 5 Nov 2009 15:17:15 +0100 Subject: Set strokes as non-convex by default. Reviewed-by: Samuel --- src/gui/painting/qpaintengineex.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 9e21182..1fb8aab 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -431,6 +431,10 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) // Some engines might decide to optimize for the non-shape hint later on... uint flags = QVectorPath::WindingFill; + + if (path.elementCount() > 2) + flags |= QVectorPath::NonConvexShapeMask; + if (d->stroker.capStyle() == Qt::RoundCap || d->stroker.joinStyle() == Qt::RoundJoin) flags |= QVectorPath::CurvedShapeMask; -- cgit v0.12 From 6d2d9bbff063f082c6010c49523f56dda74fe94e Mon Sep 17 00:00:00 2001 From: ck Date: Thu, 5 Nov 2009 15:33:35 +0100 Subject: Assistant: Reset default homepage on collection file update. Reviewed-by: kh1 --- tools/assistant/tools/assistant/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index 4d7fe10..a721880 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -148,6 +148,8 @@ updateUserCollection(QHelpEngineCore& user, const QHelpEngineCore& caller) caller.customValue(QLatin1String("AboutTexts"))); user.setCustomValue(QLatin1String("AboutImages"), caller.customValue(QLatin1String("AboutImages"))); + user.setCustomValue(QLatin1String("defaultHomepage"), + caller.customValue(QLatin1String("defaultHomepage"))); return true; } -- cgit v0.12 From 154f7142bc264866519257f2d4e62982671e3b12 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 5 Nov 2009 15:58:03 +0100 Subject: update harfbuzz to fix assamese shaping bug Synced harfbuzz to e66916e33821e71ba19479c32108a2be8bb539b2 Task-number: QTBUG-1802 Reviewed-by: Eskil --- src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp | 6 ++++-- src/3rdparty/harfbuzz/tests/shaping/main.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index 48f4f90..df447e6 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -566,7 +566,7 @@ static const unsigned char indicPosition[0xe00-0x900] = { None, None, None, None, None, None, None, None, - None, None, None, None, + Below, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, @@ -1252,7 +1252,9 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // farther than 3 consonants from the end of the syllable. // #### replace the HasReph property by testing if the feature exists in the font! if (form(*uc) == Consonant || (script == HB_Script_Bengali && form(*uc) == IndependentVowel)) { - beginsWithRa = (properties & HasReph) && ((len > 2) && *uc == ra && *(uc+1) == halant); + if ((properties & HasReph) && (len > 2) && + (*uc == ra || *uc == 0x9f0) && *(uc+1) == halant) + beginsWithRa = true; if (beginsWithRa && form(*(uc+2)) == Control) beginsWithRa = false; diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index a7ea417..9b6aa31 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -515,6 +515,12 @@ void tst_QScriptEngine::bengali() { 0x179, 0x151, 0x172, 0x0 } }, { { 0x995, 0x9c7, 0x9d7, 0x0 }, { 0x179, 0x151, 0x17e, 0x0 } }, + { { 0x9b0, 0x9cd, 0x9ad, 0x0 }, + { 0x168, 0x276, 0x0 } }, + { { 0x9f0, 0x9cd, 0x9ad, 0x0 }, + { 0x168, 0x276, 0x0 } }, + { { 0x9f1, 0x9cd, 0x9ad, 0x0 }, + { 0x191, 0x17d, 0x168, 0x0 } }, { {0}, {0} } }; @@ -652,6 +658,12 @@ void tst_QScriptEngine::bengali() { 0x01fe, 0x0 } }, { { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 }, { 0x10b, 0x167, 0x0 } }, + { { 0x9b0, 0x9cd, 0x9ad, 0x0 }, + { 0xa1, 0x167, 0x0 } }, + { { 0x9f0, 0x9cd, 0x9ad, 0x0 }, + { 0xa1, 0x167, 0x0 } }, + { { 0x9f1, 0x9cd, 0x9ad, 0x0 }, + { 0x11c, 0xa1, 0x0 } }, { {0}, {0} } }; -- cgit v0.12 From c4d8d7fd35c8ac7fd2c14208e5e7ca0a35c101e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 5 Nov 2009 16:15:26 +0100 Subject: Switch large file test to using Unbuffered mode ... so we test the file engine directly and detect file-system errors earlier. --- tests/auto/qfile/largefile/tst_largefile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index 53dbc12..8ab3275 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -312,10 +312,10 @@ void tst_LargeFile::createSparseFile() int fd = ::_open_osfhandle((intptr_t)handle, 0); QVERIFY( -1 != fd ); - QVERIFY( largeFile.open(fd, QIODevice::WriteOnly) ); + QVERIFY( largeFile.open(fd, QIODevice::WriteOnly | QIODevice::Unbuffered) ); #else // !Q_OS_WIN largeFile.setFileName("qt_largefile.tmp"); - QVERIFY( largeFile.open(QIODevice::WriteOnly) ); + QVERIFY( largeFile.open(QIODevice::WriteOnly | QIODevice::Unbuffered) ); #endif } -- cgit v0.12 From f7b457e3d72b412b1d5ce080a40f290ab9bf46ab Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 5 Nov 2009 16:32:38 +0100 Subject: Fix a bug in malayalam rendering Updated to harfbuzz e6636cadacf220785fca12b741b4587ff1ee42ec. Fixes a bug with the rendering of samvruthokaram (combination of 0xd41 + 0xd4d) in malayalam. Task-number: Parts of QTBUG-1887 Reviewed-by: Eskil --- src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp | 4 ++++ src/3rdparty/harfbuzz/tests/shaping/main.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index df447e6..3008fca 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -1746,6 +1746,10 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int ++pos; continue; } + if (script == HB_Script_Malayalam && state == Matra && uc[pos-1] == 0x0d41) { + ++pos; + continue; + } goto finish; case Nukta: if (state == Consonant) diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 9b6aa31..41f2dbb 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -979,6 +979,8 @@ void tst_QScriptEngine::malayalam() { 0x5e, 0x34, 0x65, 0x0 } }, { { 0xd15, 0xd57, 0x0 }, { 0x34, 0x65, 0x0 } }, + { { 0xd1f, 0xd4d, 0xd1f, 0xd41, 0xd4d, 0x0 }, + { 0x69, 0x5b, 0x64, 0x0 } }, { {0}, {0} } }; -- cgit v0.12 From 1e964556d61b2f4c7a8a0d251940e17c22790980 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 5 Nov 2009 15:07:32 +0100 Subject: My changelog for merge requests I've merged into 4.6.0 --- dist/changes-4.6.0 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 826dfd9..df7a835 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -23,6 +23,8 @@ information about a particular change. * The minimum required version of the D-Bus reference library is now 0.93. + - [MR#1742] Added new multimedia keys to the Qt::Key enum. + Third party components ---------------------- @@ -166,6 +168,10 @@ QtGui - [QTBUG-4418] Fixed maximizing and restoring a window on Mac. + - [MR#797] Fixed a crash when using QX11EmbedContainer/Widget on x86_64. + + - [MR#1111] Emit workAreaResized when _NET_WORKAREA is changed on X11. + **************************************************************************** * Tools * **************************************************************************** -- cgit v0.12 From 7598ff4a1e0997ffc99995dc652ef2380e7a2b05 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 5 Nov 2009 17:14:34 +0100 Subject: Fix MSVC compiler warning. Forward declare struct QAbstractConcatenable correctly. Reviewed-by: hjk --- src/corelib/tools/qstring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index be95211..74f93a4 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -631,7 +631,7 @@ private: friend class QCharRef; friend class QTextCodec; friend class QStringRef; - friend class QAbstractConcatenable; + friend struct QAbstractConcatenable; friend inline bool qStringComparisonHelper(const QString &s1, const char *s2); friend inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2); public: -- cgit v0.12 From 7efc64e6a8dbf670bbc46243664d44df7acc5892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 5 Nov 2009 17:02:27 +0100 Subject: Add support for GetURL events on Mac OS X GetURL events are delivered by Launch Services to the application if the application is registered as the default handler for the given protocol, and the user for example issues 'open http://foo.com/' in the console or clicks a link in another application. The GetURL event is converted to a QFileOpenEvent, which now has both a QUrl constructor and a url() method. These two new methods work in sync with the file() method, so a QFileOpenEvent constructed from a QUrl will return a valid file name from file() if the URL was a local file. The boolean argument to AEInstallEventHandler decides whether the handler is to be added to the system event dispatch table or the application's event dispatch table. Previously we added it to the system table, but this did not work for the GetURL event. We now use the application event table, which works for all three of the events we register on Carbon. Reviewed-by: Prasanth Ullattil Reviewed-by: Denis Dzyubenko --- dist/changes-4.6.0 | 2 ++ src/gui/kernel/qapplication_mac.mm | 26 +++++++++++++++++-- src/gui/kernel/qcocoaapplicationdelegate_mac.mm | 11 ++++++++ src/gui/kernel/qcocoaapplicationdelegate_mac_p.h | 1 + src/gui/kernel/qevent.cpp | 33 +++++++++++++++++++++--- src/gui/kernel/qevent.h | 2 ++ src/gui/kernel/qevent_p.h | 13 ++++++++++ 7 files changed, 82 insertions(+), 6 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index df7a835..b66a088 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -172,6 +172,8 @@ QtGui - [MR#1111] Emit workAreaResized when _NET_WORKAREA is changed on X11. + - Add support for GetURL events on Mac OS X + **************************************************************************** * Tools * **************************************************************************** diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index 84e0d50..84da56e 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -104,6 +104,7 @@ #include "qdir.h" #include "qdebug.h" #include "qtimer.h" +#include "qurl.h" #include "private/qmacinputcontext_p.h" #include "private/qpaintengine_mac_p.h" #include "private/qcursor_p.h" @@ -966,7 +967,8 @@ struct QMacAppleEventTypeSpec { AEEventID mac_id; } app_apple_events[] = { { kCoreEventClass, kAEQuitApplication }, - { kCoreEventClass, kAEOpenDocuments } + { kCoreEventClass, kAEOpenDocuments }, + { kInternetEventClass, kAEGetURL }, }; #ifndef QT_MAC_USE_COCOA @@ -1201,7 +1203,7 @@ void qt_init(QApplicationPrivate *priv, int) app_proc_ae_handlerUPP = AEEventHandlerUPP(QApplicationPrivate::globalAppleEventProcessor); for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i) AEInstallEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id, - app_proc_ae_handlerUPP, SRefCon(qApp), true); + app_proc_ae_handlerUPP, SRefCon(qApp), false); } if (QApplicationPrivate::app_style) { @@ -1237,6 +1239,10 @@ void qt_init(QApplicationPrivate *priv, int) [cocoaApp setMenu:[qtMenuLoader menu]]; [newDelegate setMenuLoader:qtMenuLoader]; [qtMenuLoader release]; + + NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager]; + [eventManager setEventHandler:newDelegate andSelector:@selector(getUrl:withReplyEvent:) + forEventClass:kInternetEventClass andEventID:kAEGetURL]; } #endif // Register for Carbon tablet proximity events on the event monitor target. @@ -2477,6 +2483,22 @@ OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, Ap default: break; } + } else if (aeClass == kInternetEventClass) { + switch (aeID) { + case kAEGetURL: { + char urlData[1024]; + Size actualSize; + if (AEGetParamPtr(ae, keyDirectObject, typeChar, 0, urlData, + sizeof(urlData) - 1, &actualSize) == noErr) { + urlData[actualSize] = 0; + QFileOpenEvent ev(QUrl(QString::fromUtf8(urlData))); + QApplication::sendSpontaneousEvent(app, &ev); + } + break; + } + default: + break; + } } #ifdef DEBUG_EVENTS qDebug("Qt: internal: %shandled Apple event! %c%c%c%c %c%c%c%c", handled_event ? "(*)" : "", diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index d103cbd..37dcc67 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -83,6 +83,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE @@ -303,5 +304,15 @@ static void cleanupCocoaApplicationDelegate() [self doesNotRecognizeSelector:invocationSelector]; } +- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent +{ + Q_UNUSED(replyEvent); + + NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; + QUrl url(qt_mac_NSStringToQString(urlString)); + QFileOpenEvent qtEvent(url); + qt_sendSpontaneousEvent(qAppInstance(), &qtEvent); +} + @end #endif diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h index 80df645..a137744 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h @@ -123,5 +123,6 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); - (void)setMenuLoader:(QT_MANGLE_NAMESPACE(QCocoaMenuLoader)*)menuLoader; - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader; - (void)setReflectionDelegate:(NSObject *)oldDelegate; +- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent; @end #endif diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ad68aea..ff97405 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2976,13 +2976,13 @@ QShowEvent::~QShowEvent() /*! \class QFileOpenEvent \brief The QFileOpenEvent class provides an event that will be - sent when there is a request to open a file. + sent when there is a request to open a file or a URL. \ingroup events File open events will be sent to the QApplication::instance() - when the operating system requests that a file be opened. This is - a high-level event that can be caused by different user actions + when the operating system requests that a file or URL should be opened. + This is a high-level event that can be caused by different user actions depending on the user's desktop environment; for example, double clicking on an file icon in the Finder on Mac OS X. @@ -2999,12 +2999,27 @@ QShowEvent::~QShowEvent() */ QFileOpenEvent::QFileOpenEvent(const QString &file) : QEvent(FileOpen), f(file) -{} +{ + d = reinterpret_cast(new QFileOpenEventPrivate(QUrl::fromLocalFile(file))); +} + +/*! + \internal + + Constructs a file open event for the given \a url. +*/ +QFileOpenEvent::QFileOpenEvent(const QUrl &url) + : QEvent(FileOpen) +{ + d = reinterpret_cast(new QFileOpenEventPrivate(url)); + f = url.toLocalFile(); +} /*! \internal */ QFileOpenEvent::~QFileOpenEvent() { + delete reinterpret_cast(d); } /*! @@ -3013,6 +3028,16 @@ QFileOpenEvent::~QFileOpenEvent() Returns the file that is being opened. */ +/*! + \fn QUrl QFileOpenEvent::url() const + + Returns the url that is being opened. +*/ +QUrl QFileOpenEvent::url() const +{ + return reinterpret_cast(d)->url; +} + #ifndef QT_NO_TOOLBAR /*! \internal diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index b9512fa..9839269 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -638,9 +638,11 @@ class Q_GUI_EXPORT QFileOpenEvent : public QEvent { public: QFileOpenEvent(const QString &file); + QFileOpenEvent(const QUrl &url); ~QFileOpenEvent(); inline QString file() const { return f; } + QUrl url() const; private: QString f; }; diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 6e6ab01..4aaaa8b 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -43,6 +43,7 @@ #define QEVENT_P_H #include +#include #include QT_BEGIN_NAMESPACE @@ -164,6 +165,18 @@ public: QMap targetWidgets; }; + +class QFileOpenEventPrivate +{ +public: + inline QFileOpenEventPrivate(const QUrl &url) + : url(url) + { + } + + QUrl url; +}; + QT_END_NAMESPACE #endif // QEVENT_P_H -- cgit v0.12 From 16350cb5204255aacc4026bb5e797d3058ccb9ca Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 5 Nov 2009 17:32:42 +0100 Subject: Doc: Added a link to the online version of the Qt book (2nd edition). Reviewed-by: Trust Me --- doc/src/howtos/guibooks.qdoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/howtos/guibooks.qdoc b/doc/src/howtos/guibooks.qdoc index c41d8fa..6e64c09 100644 --- a/doc/src/howtos/guibooks.qdoc +++ b/doc/src/howtos/guibooks.qdoc @@ -52,8 +52,10 @@ GUI Programming with Qt 4, Second Edition}} by Jasmin Blanchette and Mark Summerfield, ISBN 0-13-235416-0. This is the official Qt book written - by two veteran Trolls. The first edition, which is based on Qt 4.1, is available - \l{http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip}{online}. + by two veteran Trolls. The first edition, which is based on Qt 4.1, is + \l{http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip}{available online}. + The second edition, based on Qt 4.3, is + \l{http://www.informit.com/store/product.aspx?isbn=0132354160}{also available online}. \bold{\l{http://www.amazon.com/exec/obidos/ASIN/0385267746/trolltech/t}{The Design of Everyday Things}} by Donald Norman, ISBN 0-38526774-6, is one of the classics of human -- cgit v0.12 From ded84966823eac0ae0275a2a7676d647d4d856ff Mon Sep 17 00:00:00 2001 From: Iain Date: Thu, 5 Nov 2009 19:07:02 +0100 Subject: Initial LFLAGS support for qmake on Symbian OS Reviewed-by: Shane Kearns --- mkspecs/common/symbian/symbian.conf | 21 +++++++++-------- qmake/generators/symbian/symmake.cpp | 44 ++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 1acfefe..79bac42 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -50,17 +50,18 @@ QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< -QMAKE_LINK = g++ -QMAKE_LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl +QMAKE_LINK = +QMAKE_LFLAGS = +QMAKE_LFLAGS.ARMCC = +QMAKE_LFLAGS_EXCEPTIONS_ON = QMAKE_LFLAGS_EXCEPTIONS_OFF = -QMAKE_LFLAGS_RELEASE = -Wl,-s -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console -QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows -QMAKE_LFLAGS_DLL = -shared -QMAKE_LINK_OBJECT_MAX = 10 -QMAKE_LINK_OBJECT_SCRIPT= object_script +QMAKE_LFLAGS_RELEASE = +QMAKE_LFLAGS_DEBUG = +QMAKE_LFLAGS_CONSOLE = +QMAKE_LFLAGS_WINDOWS = +QMAKE_LFLAGS_DLL = +QMAKE_LINK_OBJECT_MAX = +QMAKE_LINK_OBJECT_SCRIPT= QMAKE_LIBS = -llibc -llibm -leuser -llibdl QMAKE_LIBS_CORE = $$QMAKE_LIBS -llibpthread -lefsrv diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 19af1da..8ec4b3f 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -74,6 +74,9 @@ #define MMP_OPTION_CW "OPTION CW" #define MMP_OPTION_ARMCC "OPTION ARMCC" #define MMP_OPTION_GCCE "OPTION GCCE" +#define MMP_LINKEROPTION_CW "LINKEROPTION CW" +#define MMP_LINKEROPTION_ARMCC "LINKEROPTION ARMCC" +#define MMP_LINKEROPTION_GCCE "LINKEROPTION GCCE" #define SIS_TARGET "sis" #define OK_SIS_TARGET "ok_sis" @@ -655,8 +658,7 @@ void SymbianMakefileGenerator::initMmpVariables() // Check MMP_RULES for singleton keywords that are overridden QStringList overridableMmpKeywords; - overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_OPTION_CW) - << QLatin1String(MMP_OPTION_ARMCC) << QLatin1String(MMP_OPTION_GCCE); + overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE); foreach (QString item, project->values("MMP_RULES")) { if (project->values(item).isEmpty()) { @@ -971,6 +973,7 @@ void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) { QString cw, armcc, gcce; + QString cwlink, armlink, gccelink; if (0 != project->values("QMAKE_CXXFLAGS.CW").size()) { cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" ")); @@ -1020,12 +1023,42 @@ void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) gcce.append(" "); } + if (0 != project->values("QMAKE_LFLAGS.CW").size()) { + cwlink.append(project->values("QMAKE_LFLAGS.CW").join(" ")); + cwlink.append(" "); + } + + if (0 != project->values("QMAKE_LFLAGS.ARMCC").size()) { + armlink.append(project->values("QMAKE_LFLAGS.ARMCC").join(" ")); + armlink.append(" "); + } + + if (0 != project->values("QMAKE_LFLAGS.GCCE").size()) { + gccelink.append(project->values("QMAKE_LFLAGS.GCCE").join(" ")); + gccelink.append(" "); + } + + if (0 != project->values("QMAKE_LFLAGS").size()) { + cwlink.append(project->values("QMAKE_LFLAGS").join(" ")); + cwlink.append(" "); + armlink.append(project->values("QMAKE_LFLAGS").join(" ")); + armlink.append(" "); + gccelink.append(project->values("QMAKE_LFLAGS").join(" ")); + gccelink.append(" "); + } + if (!cw.isEmpty() && cw[cw.size()-1] == ' ') cw.chop(1); if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ') armcc.chop(1); if (!gcce.isEmpty() && gcce[gcce.size()-1] == ' ') gcce.chop(1); + if (!cwlink.isEmpty() && cwlink[cwlink.size()-1] == ' ') + cwlink.chop(1); + if (!armlink.isEmpty() && armlink[armlink.size()-1] == ' ') + armlink.chop(1); + if (!gccelink.isEmpty() && gccelink[gccelink.size()-1] == ' ') + gccelink.chop(1); if (!cw.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_CW)) t << MMP_OPTION_CW " " << cw << endl; @@ -1034,6 +1067,13 @@ void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) if (!gcce.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_GCCE)) t << MMP_OPTION_GCCE " " << gcce << endl; + if (!cwlink.isEmpty() && !overriddenMmpKeywords.contains(MMP_LINKEROPTION_CW)) + t << MMP_LINKEROPTION_CW " " << cwlink << endl; + if (!armlink.isEmpty() && !overriddenMmpKeywords.contains(MMP_LINKEROPTION_ARMCC)) + t << MMP_LINKEROPTION_ARMCC " " << armlink << endl; + if (!gccelink.isEmpty() && !overriddenMmpKeywords.contains(MMP_LINKEROPTION_GCCE)) + t << MMP_LINKEROPTION_GCCE " " << gccelink << endl; + t << endl; } -- cgit v0.12 From 80713aab0926e3d2ae9d0345e48c027deca1fbbb Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 5 Nov 2009 19:26:48 +0100 Subject: Doc: Fixed qdoc warnings. Reviewed-by: Trust Me --- doc/src/getting-started/installation.qdoc | 32 +++++++++++++++---------------- doc/src/modules.qdoc | 2 +- doc/src/platforms/qt-embedded.qdoc | 2 +- doc/src/platforms/s60-introduction.qdoc | 10 +++++----- doc/src/platforms/winsystem.qdoc | 12 ++++++++++++ src/corelib/global/qglobal.cpp | 6 ++++++ src/gui/effects/qgraphicseffect.cpp | 18 ++++++++++++++++- src/gui/kernel/qgesture.cpp | 9 --------- src/gui/s60framework/qs60mainappui.cpp | 2 -- src/gui/util/qdesktopservices.cpp | 2 -- 10 files changed, 57 insertions(+), 38 deletions(-) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index e127429..1eefed3 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -498,10 +498,9 @@ in the \l{Qt for Windows CE Requirements} document. */ /*! \page install-Symbian-installer.html - -\title Installing Qt on the Symbian platform using binary package +\title Installing Qt on the Symbian Platform from a Binary Package \ingroup qts60 -\brief How to install Qt on the Symbian platform using the binary package. +\brief How to install Qt on the Symbian platform from a binary package. \note Qt for Symbian platform has some requirements that are given in more detail in the \l{Qt for Symbian platform Requirements} document. @@ -528,9 +527,9 @@ in the \l{Qt for Symbian platform Requirements} document. To run the demos and examples on the emulator, you need to build them first. Open the "Qt for Symbian platform Command Prompt" from the Start menu and type: - + \snippet doc/src/snippets/code/doc_src_installation.qdoc 25 - + To run the demos on the emulator simply navigate to the directory of the demo you want to see and run: @@ -538,7 +537,7 @@ in the \l{Qt for Symbian platform Requirements} document. For more information about building and running Qt programs on the Symbian platform, - see \l{Symbian platform - Introduction to using Qt}. + see \l{Symbian platform - Introduction to Qt}. We hope you will enjoy using Qt. @@ -546,19 +545,18 @@ Symbian platform, */ /*! \page install-Symbian.html - -\title Installing Qt on the Symbian platform +\title Installing Qt on the Symbian Platform \ingroup installation \ingroup qts60 -\brief How to install Qt for the Symbian platform +\brief How to install Qt on the Symbian platform. \note Qt for the Symbian platform has some requirements that are given in more detail -in the \l{Qt for Symbian platform Requirements} document. +in the \l{Qt for Symbian Platform Requirements} document. \note \bold {This document describes how to install and configure Qt for the Symbian platform from scratch. -If you are using pre-built binaries, follow the instructions -\l{Installing Qt on the Symbian platform using binary package}{here}.} +If you are using pre-built binaries, follow the instructions given in the +\l{Installing Qt on the Symbian Platform from a Binary Package} document.} \list 1 @@ -608,7 +606,7 @@ If you are using pre-built binaries, follow the instructions To build Qt for the device, type: \snippet doc/src/snippets/code/doc_src_installation.qdoc 28 - + Congratulations, Qt is now ready to use. \o Running Qt demos @@ -617,7 +615,7 @@ If you are using pre-built binaries, follow the instructions to try out. An excellent starting point is the "fluidlauncher" demo. To run the demo on a real device, you first have to install the Qt libraries on the device: - + \snippet doc/src/snippets/code/doc_src_installation.qdoc 29 \note You will need to supply certificate that allows installation @@ -629,14 +627,14 @@ If you are using pre-built binaries, follow the instructions This will create a self-signed \c fluidlauncher_armv5_urel.sis and install it to your device. - + To run the demos on the emulator simply navigate to the directory of the demo you want to see and run: \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 For more information about building and running Qt programs on the -Symbian platform, see \l{Symbian platform - Introduction to using Qt}. +Symbian platform, see \l{Symbian platform - Introduction to Qt}. We hope you will enjoy using Qt. @@ -956,7 +954,7 @@ Symbian platform, see \l{Symbian platform - Introduction to using Qt}. /*! \page requirements-symbian.html - \title Qt for Symbian platform Requirements + \title Qt for Symbian Platform Requirements \ingroup installation \brief Setting up the Symbian platform environment for Qt. \previouspage General Qt Requirements diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index ac264d0..3abcf7c 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -226,7 +226,7 @@ The QtOpenGL module is part of the \l{Qt Full Framework Edition} and the \l{Open Source Versions of Qt}. It is available on Windows, X11, and Mac OS X. - \l{Qt for Embedded and OpenGL} supports OpenGL ES (OpenGL for Embedded Systems). + \l{Qt for Embedded Linux and OpenGL} supports OpenGL ES (OpenGL for Embedded Systems). \note To be able to use the OpenGL API in \l{Qt for Embedded Linux}, it must be integrated with the Q Window System (QWS). See the \l{Qt for Embedded Linux and OpenGL} documentation for details. diff --git a/doc/src/platforms/qt-embedded.qdoc b/doc/src/platforms/qt-embedded.qdoc index e0c35cc..b38c94f 100644 --- a/doc/src/platforms/qt-embedded.qdoc +++ b/doc/src/platforms/qt-embedded.qdoc @@ -67,7 +67,7 @@ Applications use the appropriate style for the embedded environment and use native features, such as menus, to conform to the native style guidelines. - \o \l{Symbian platform - Introduction to using Qt}{Qt for the Symbian + \o \l{Symbian Platform - Introduction to Qt}{Qt for the Symbian platform} is used to create applications running in existing Symbian platform environments. Applications use the appropriate style for the embedded environment and use native features, such as menus, to conform diff --git a/doc/src/platforms/s60-introduction.qdoc b/doc/src/platforms/s60-introduction.qdoc index 5fd0cbe..0581982 100644 --- a/doc/src/platforms/s60-introduction.qdoc +++ b/doc/src/platforms/s60-introduction.qdoc @@ -42,7 +42,7 @@ /*! \page symbian-with-qt-introduction.html - \title Symbian platform - Introduction to using Qt + \title Symbian Platform - Introduction to Qt \brief An introduction to Qt for Symbian platform developers. \ingroup howto \ingroup qts60 @@ -51,15 +51,15 @@ \section1 Required tools - See \l{Qt for Symbian platform Requirements} to see what tools are + See \l{Qt for Symbian Platform Requirements} to see what tools are required to use Qt for Symbian platform. \section1 Installing Qt and running demos - Follow the instructions found in \l{Installing Qt on the Symbian platform using binary package} to learn how - to install Qt using binary package and how to build and run Qt demos. + Follow the instructions found in \l{Installing Qt on the Symbian platform from a Binary Package} + to learn how to install Qt using a binary package and how to build and run Qt demos. - Follow the instructions found in \l{Installing Qt on the Symbian platform} to learn how to install Qt using + Follow the instructions found in \l{Installing Qt on the Symbian Platform} to learn how to install Qt using using source package and how to build and run the Qt demos. \section1 Building your own applications diff --git a/doc/src/platforms/winsystem.qdoc b/doc/src/platforms/winsystem.qdoc index f427d6e..72e7da6 100644 --- a/doc/src/platforms/winsystem.qdoc +++ b/doc/src/platforms/winsystem.qdoc @@ -43,6 +43,7 @@ \page winsystem.html \title Window System Specific Notes \ingroup platform-specific + \brief Collections of notes about Qt implementations on different window systems. Qt is a cross-platform GUI toolkit, so almost the entire API is the same on all platforms and window systems. If you wish to use @@ -95,4 +96,15 @@ When compiling for this platform, the macro \c{Q_WS_QWS} is defined (the window system is literally the Qt Window System). See the \l{Qt for Embedded Linux} documentation for more information. + + \section1 Qt for Windows CE + + When compiling for this platform, the macro \c{Q_WS_WINCE} is defined. + See the \l{Qt for Windows CE} documentation for more information. + + \section1 Qt for Symbian Platform + + When compiling for this platform, the macro \c{Q_WS_S60} is defined. + See the \l{Symbian Platform - Introduction to Qt} documentation for + more information. */ diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 5578091..62b5409 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1191,6 +1191,10 @@ bool qSharedBuild() \value SV_9_2 Symbian OS v9.2 \value SV_9_3 Symbian OS v9.3 \value SV_9_4 Symbian OS v9.4 + \value SV_SF_1 Symbian^1 + \value SV_SF_2 Symbian^2 + \value SV_SF_3 Symbian^3 + \value SV_SF_4 Symbian^4 \value SV_Unknown An unknown and currently unsupported platform \sa S60Version, WinVersion, MacVersion @@ -1207,6 +1211,8 @@ bool qSharedBuild() \value SV_S60_3_1 S60 3rd Edition Feature Pack 1 \value SV_S60_3_2 S60 3rd Edition Feature Pack 2 \value SV_S60_5_0 S60 5th Edition + \value SV_S60_5_1 S60 5th Edition Feature Pack 1 + \value SV_S60_5_2 S60 5th Edition Feature Pack 2 \value SV_S60_Unknown An unknown and currently unsupported platform \omitvalue SV_S60_None diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index d7e838e..7f83063 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -128,6 +128,19 @@ QT_BEGIN_NAMESPACE */ /*! + \enum QGraphicsEffectSource::PixmapPadMode + + This enum describes how much of the effect will be rendered to a pixmap + created using the pixmap() function. + + \value NoExpandPadMode The pixmap is the size of the widget or graphics item. + \value ExpandToTransparentBorderPadMode The pixmap is expanded to include + the widget or graphics item plus a transparent border. + \value ExpandToEffectRectPadMode The pixmap is expanded to include the widget + or graphics item and the effect. +*/ + +/*! \internal */ QGraphicsEffectSource::QGraphicsEffectSource(QGraphicsEffectSourcePrivate &dd, QObject *parent) @@ -264,6 +277,9 @@ bool QGraphicsEffectSource::isPixmap() const The optional \a offset parameter returns the offset where the pixmap should be painted at using the current painter. + The \a mode determines how much of the effect the pixmap will contain. + By default, the pixmap will contain the whole effect. + The returned pixmap is bound to the current painter's device rectangle when \a system is Qt::DeviceCoordinates. @@ -735,7 +751,7 @@ void QGraphicsBlurEffect::setBlurHint(QGraphicsBlurEffect::BlurHint hint) } /*! - \fn void QGraphicsBlurEffect::blurHintChanged(Qt::BlurHint hint) + \fn void QGraphicsBlurEffect::blurHintChanged(QGraphicsBlurEffect::BlurHint hint) This signal is emitted whenever the effect's blur hint changes. The \a hint parameter holds the effect's new blur hint. diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 4edf8a9..dcec9d3 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -220,15 +220,6 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const */ /*! - \property QPanGesture::totalOffset - \brief the total offset from the first input position to the current input - position - - The total offset measures the total change in position of the user's input - covered by the gesture on the input device. -*/ - -/*! \property QPanGesture::lastOffset \brief the last offset recorded for this gesture diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 3b439a8..4c4c994 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -161,8 +161,6 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type) } /*! - * \fn void QS60MainAppUi::HandleWsEventL(const TWsEvent &event, CCoeControl *destination) - * * \brief Handles raw window server events. * * The event type and information is passed in \a wsEvent, while the receiving control is passed in diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 85b539f..fd84949 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -293,8 +293,6 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) have desktop concept, DesktopLocation returns same path as DocumentsLocation. Rest of the standard locations point to folder on same drive with executable, except that if executable is in ROM the folder from C drive is returned. - - \endcode */ /*! -- cgit v0.12 From c4f5a858edbe764f1e899b6c5201a61982e13061 Mon Sep 17 00:00:00 2001 From: gunnar Date: Thu, 5 Nov 2009 19:53:55 +0100 Subject: Fixed warning in lance on printf with wrong types Reviewed-by: TrustMe --- tests/arthur/common/paintcommands.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp index 475f07d..44deb0e 100644 --- a/tests/arthur/common/paintcommands.cpp +++ b/tests/arthur/common/paintcommands.cpp @@ -974,7 +974,7 @@ void PaintCommands::command_drawPixmap(QRegExp re) if (sh == 0) sh = -1; if (m_verboseMode) - printf(" -(lance) drawPixmap('%s' dim=(%d, %d), depth=%d, (%d, %d, %d, %d), (%d, %d, %d, %d)\n", + printf(" -(lance) drawPixmap('%s' dim=(%d, %d), depth=%d, (%f, %f, %f, %f), (%f, %f, %f, %f)\n", qPrintable(re.cap(1)), pm.width(), pm.height(), pm.depth(), tx, ty, tw, th, sx, sy, sw, sh); @@ -1022,7 +1022,7 @@ void PaintCommands::command_drawImage(QRegExp re) if (sh == 0) sh = -1; if (m_verboseMode) - printf(" -(lance) drawImage('%s' dim=(%d, %d), (%d, %d, %d, %d), (%d, %d, %d, %d)\n", + printf(" -(lance) drawImage('%s' dim=(%d, %d), (%f, %f, %f, %f), (%f, %f, %f, %f)\n", qPrintable(re.cap(1)), im.width(), im.height(), tx, ty, tw, th, sx, sy, sw, sh); m_painter->drawImage(QRectF(tx, ty, tw, th), im, QRectF(sx, sy, sw, sh), Qt::OrderedDither | Qt::OrderedAlphaDither); -- cgit v0.12 From b185b901ea31bfdc2db781e271132d34d0e8ce32 Mon Sep 17 00:00:00 2001 From: gunnar Date: Thu, 5 Nov 2009 19:55:15 +0100 Subject: Fixed bad joins in the new stroker... Normal generation was broken. Reviewed-by: Trustme --- src/opengl/gl2paintengineex/qtriangulatingstroker_p.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index 97eabef..defa3f1 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -129,9 +129,9 @@ inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, fl float pw; if (dx == 0) - pw = m_width / dy; + pw = m_width / qAbs(dy); else if (dy == 0) - pw = m_width / dx; + pw = m_width / qAbs(dx); else pw = m_width / sqrt(dx*dx + dy*dy); @@ -259,8 +259,6 @@ void QTriangulatingStroker::lineTo(const qreal *pts) - - void QTriangulatingStroker::join(const qreal *pts) { // Creates a join to the next segment (m_cx, m_cy) -> (pts[0], pts[1]) -- cgit v0.12 From d57b8e711c312814a55e7bc245b9b44ea4bd854c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 5 Nov 2009 21:17:34 +0100 Subject: Doc: Trivial fix. Reviewed-by: Trust Me --- doc/src/qt4-intro.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 4943984..4911426 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -664,7 +664,7 @@ See the \l{QtMultimedia Module} documentation for more information. - \section1 New Classes, Functions, Macros, etc + \section1 New Classes, Functions, Macros, etc. Links to new classes, functions, macros, and other items introduced in Qt 4.6. -- cgit v0.12 From ef3141ecb2c10db59c1294ccd1ece1208585b290 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 5 Nov 2009 17:49:04 +1000 Subject: Make declarative support in configure.exe auto. Reviewed-by: Warwick Allison --- configure.exe | Bin 1172480 -> 1173504 bytes tools/configure/configureapp.cpp | 6 +++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.exe b/configure.exe index 13d0673..7fe4a93 100755 Binary files a/configure.exe and b/configure.exe differ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 95f271d..d8c2abd 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -249,7 +249,7 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "MULTIMEDIA" ] = "yes"; dictionary[ "DIRECTSHOW" ] = "no"; dictionary[ "WEBKIT" ] = "auto"; - dictionary[ "DECLARATIVE" ] = "no"; + dictionary[ "DECLARATIVE" ] = "auto"; dictionary[ "PLUGIN_MANIFESTS" ] = "yes"; QString version; @@ -2038,6 +2038,8 @@ bool Configure::checkAvailability(const QString &part) available = true; } else if (part == "WEBKIT") { available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++"); + } else if (part == "DECLARATIVE") { + available = QFile::exists(sourcePath + "/src/declarative/qml/qmlcomponent.h"); } return available; @@ -2124,6 +2126,8 @@ void Configure::autoDetection() dictionary["PHONON"] = checkAvailability("PHONON") ? "yes" : "no"; if (dictionary["WEBKIT"] == "auto") dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no"; + if (dictionary["DECLARATIVE"] == "auto") + dictionary["DECLARATIVE"] = checkAvailability("DECLARATIVE") ? "yes" : "no"; // Qt/WinCE remote test application if (dictionary["CETEST"] == "auto") -- cgit v0.12 From faa534e55b9a03dabc44565e45f2f19297edf29d Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 6 Nov 2009 11:39:04 +1000 Subject: Fix bad merge from 4.5 in powervr code --- .../powervr/pvreglscreen/pvreglscreen.cpp | 61 ---------------------- 1 file changed, 61 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index c1410a6..1dec9ea 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -271,67 +271,6 @@ int PvrEglScreen::transformation() const #endif -#ifndef QT_NO_QWS_TRANSFORMED - -static const QScreen *parentScreen - (const QScreen *current, const QScreen *lookingFor) -{ - if (!current) - return 0; - switch (current->classId()) { - case QScreen::ProxyClass: - case QScreen::TransformedClass: { - const QScreen *child = - static_cast(current)->screen(); - if (child == lookingFor) - return current; - else - return parentScreen(child, lookingFor); - } - // Not reached. - - case QScreen::MultiClass: { - QList screens = current->subScreens(); - foreach (QScreen *screen, screens) { - if (screen == lookingFor) - return current; - const QScreen *parent = parentScreen(screen, lookingFor); - if (parent) - return parent; - } - } - break; - - default: break; - } - return 0; -} - -int PvrEglScreen::transformation() const -{ - // We need to search for our parent screen, which is assumed to be - // "Transformed". If it isn't, then there is no transformation. - // There is no direct method to get the parent screen so we need - // to search every screen until we find ourselves. - if (!parent && qt_screen != this) - parent = parentScreen(qt_screen, this); - if (!parent) - return 0; - if (parent->classId() != QScreen::TransformedClass) - return 0; - return 90 * static_cast(parent) - ->transformation(); -} - -#else - -int PvrEglScreen::transformation() const -{ - return 0; -} - -#endif - void PvrEglScreen::sync() { // Put code here to synchronize 2D and 3D operations if necessary. -- cgit v0.12 From 13cd3c7a8975fc6dc72719b5a78d55159ab777a3 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 6 Nov 2009 07:56:56 +0100 Subject: fix painting on Windows CE it seems the timer id ~0 is already used on windows ce or not available at all. This has caused Qt to not receive the timer messages, causing to not update. Task-number: qtbug-5496 Reviewed-by: Gunnar Sletta --- src/corelib/kernel/qeventdispatcher_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index d13e1d1..bce52c6 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -470,7 +470,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) } return 0; } else if (message == WM_TIMER) { - if (wp == ~0u) { + if (wp == ~1u) { KillTimer(d->internalHwnd, wp); int localSerialNumber = d->serialNumber; (void) d->wakeUps.fetchAndStoreRelease(0); @@ -488,7 +488,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) if (GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER) != 0) { // delay the next pass of sendPostedEvents() until we get the special // WM_TIMER, which allows all pending Windows messages to be processed - SetTimer(d->internalHwnd, ~0u, 0, 0); + SetTimer(d->internalHwnd, ~1u, 0, 0); } else { // nothing pending in the queue, let sendPostedEvents go through d->wakeUps.fetchAndStoreRelease(0); -- cgit v0.12 From a34b73f0c4f86cf1c333a31c25f9c05460bca173 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 6 Nov 2009 08:07:20 +0100 Subject: compile fix for QDBusServiceWatcher with namespaced Qt --- src/dbus/qdbusservicewatcher.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp index 4872732..4356d11 100644 --- a/src/dbus/qdbusservicewatcher.cpp +++ b/src/dbus/qdbusservicewatcher.cpp @@ -47,6 +47,8 @@ #include +QT_BEGIN_NAMESPACE + Q_GLOBAL_STATIC_WITH_ARGS(QString, busService, (QLatin1String(DBUS_SERVICE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString, busPath, (QLatin1String(DBUS_PATH_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString, busInterface, (QLatin1String(DBUS_INTERFACE_DBUS))) @@ -371,4 +373,6 @@ void QDBusServiceWatcher::setConnection(const QDBusConnection &connection) d->setConnection(d->servicesWatched, connection, d->watchMode); } +QT_END_NAMESPACE + #include "moc_qdbusservicewatcher.cpp" -- cgit v0.12 From 0b0b31577898305fcc351e98f3ce2bb392869eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 6 Nov 2009 09:10:19 +0100 Subject: Add major Mac changes. --- dist/changes-4.6.0 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 6ad73f6..fe3d8b9 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -222,6 +222,21 @@ QtGui - [MR#1111] Emit workAreaResized when _NET_WORKAREA is changed on X11. - Add support for GetURL events on Mac OS X + +General changes on Mac OS X: + - Mac OS X version support: Support for 10.3(Panther) has been dropped, support for + 10.6(Snow Leopard) has been added. + - The Cocoa port now supports static linking. + - The Cocoa port now supports the Qt3Support library (with the exception of Q3FileDialog) + to ease the transition from Carbon to Cocoa. + - The Cocoa binary packages are now Intel only (universal i386 and x86_64). + - Snow Leopard notes: + - Gcc 4.2 is used by default. Configure with -platform macx-g++40 to select 4.0. + - Using the 10.4u SDK requires gcc 4.0. + - Configuring for the Cocoa port (-cocoa) produces 64-bit binaries by default. + Use the -arch flags to override. + - Building for ppc64 is no longer supported by the gcc tool chain. + - Building for ppc is still supported. **************************************************************************** * Tools * -- cgit v0.12 From dde02a1b8c61c344c20a92a81d25d4c9b522d349 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 6 Nov 2009 09:48:05 +0100 Subject: Animations should only be registered if their new state is running --- src/corelib/animation/qabstractanimation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index edc1503..3b98152 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -361,7 +361,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) QUnifiedTimer::instance()->ensureTimerUpdate(); //the animation, is not running any more QUnifiedTimer::instance()->unregisterAnimation(q); - } else { + } else if (newState == QAbstractAnimation::Running) { QUnifiedTimer::instance()->registerAnimation(q, isTopLevel); } -- cgit v0.12 From a708f07b593359b6bf5732ec444336956e194cda Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 6 Nov 2009 09:55:08 +0100 Subject: add slow mode in private API for testing this was suggested by Michael B --- src/corelib/animation/qabstractanimation.cpp | 6 ++++-- src/corelib/animation/qabstractanimation_p.h | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 3b98152..93ac840 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -165,8 +165,8 @@ Q_GLOBAL_STATIC(QThreadStorage, unifiedTimer) QUnifiedTimer::QUnifiedTimer() : QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), - currentAnimationIdx(0), consistentTiming(false), isPauseTimerActive(false), - runningLeafAnimations(0) + currentAnimationIdx(0), consistentTiming(false), slowMode(false), + isPauseTimerActive(false), runningLeafAnimations(0) { } @@ -193,6 +193,8 @@ void QUnifiedTimer::updateAnimationsTime() // ignore consistentTiming in case the pause timer is active const int delta = (consistentTiming && !isPauseTimerActive) ? timingInterval : time.elapsed() - lastTick; + if slowMode) + delta /= 5; lastTick = time.elapsed(); //we make sure we only call update time if the time has actually changed diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index f989bce..720e68d 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -138,6 +138,9 @@ public: */ void setConsistentTiming(bool consistent) { consistentTiming = consistent; } + //this facilitates fine-tuning of complex animations + void setSlowModeEnabled(bool enabled) { slowMode = enabled; } + /* this is used for updating the currentTime of all animations in case the pause timer is active or, otherwise, only of the animation passed as parameter. @@ -164,6 +167,7 @@ private: int timingInterval; int currentAnimationIdx; bool consistentTiming; + bool slowMode; // bool to indicate that only pause animations are active bool isPauseTimerActive; -- cgit v0.12 From 64d38ba23b4acc46fdb9145f1953315573e3f8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 5 Nov 2009 16:55:36 +0100 Subject: Fixed uninitialized background artifacts in QWidget::render. We need to use isOpaque to check whether the widget has an opaque background, it's not enough to just check the palette (it doesn't check Qt::NoSystemBackground for example). Task-number: QTBUG-5012 Reviewed-by: Gunnar Sletta --- src/gui/kernel/qwidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 386bf71..271b939 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5171,8 +5171,7 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset return; QPixmap pixmap(size); - if (!(renderFlags & QWidget::DrawWindowBackground) - || !q->palette().brush(q->backgroundRole()).isOpaque()) + if (!(renderFlags & QWidget::DrawWindowBackground) || !isOpaque) pixmap.fill(Qt::transparent); q->render(&pixmap, QPoint(), toBePainted, renderFlags); -- cgit v0.12 From 3c0b6de86ce044ce6f3f4a445d1de90b4e7bb1d9 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 6 Nov 2009 10:10:46 +0100 Subject: Updated testcase since soft-light algorithm rewrite. The SVG standard changed the algorithm which implies some changes to the results as well. Reviewed-by: Kim --- tests/auto/qpainter/tst_qpainter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 8ed83cb..bcdbe56 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -4193,9 +4193,9 @@ void tst_QPainter::extendedBlendModes() QVERIFY(testCompositionMode(255, 255, 255, QPainter::CompositionMode_SoftLight)); QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_SoftLight)); - QVERIFY(testCompositionMode(127, 127, 127, QPainter::CompositionMode_SoftLight)); - QVERIFY(testCompositionMode( 63, 63, 86, QPainter::CompositionMode_SoftLight)); - QVERIFY(testCompositionMode(127, 63, 63, QPainter::CompositionMode_SoftLight)); + QVERIFY(testCompositionMode(127, 127, 126, QPainter::CompositionMode_SoftLight)); + QVERIFY(testCompositionMode( 63, 63, 39, QPainter::CompositionMode_SoftLight)); + QVERIFY(testCompositionMode(127, 63, 62, QPainter::CompositionMode_SoftLight)); QVERIFY(testCompositionMode(255, 255, 0, QPainter::CompositionMode_Difference)); QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_Difference)); -- cgit v0.12 From 1e77901a50858cf9243e6d813303d8ce013e4d31 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 6 Nov 2009 10:13:27 +0100 Subject: Revert micro optimization where NoPen == NoBrush as SVG relies on this Reviewed-by: Samuel --- src/gui/painting/qpen.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 1ddadf2..a57450d 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -845,9 +845,7 @@ bool QPen::operator==(const QPen &p) const || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) && pdd->dashPattern == dd->dashPattern)) && p.d->brush == d->brush - && pdd->cosmetic == dd->cosmetic) - || ((p.d->style == Qt::NoPen || p.d->brush.style() == Qt::NoBrush) - && (d->style == Qt::NoPen || d->brush.style() == Qt::NoBrush)); + && pdd->cosmetic == dd->cosmetic); } -- cgit v0.12 From cc98c1d3c6fb39bad2ff7f6ebff881a697565305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 6 Nov 2009 11:11:24 +0100 Subject: Make sure the pixmap is properly initialized. Reviewed-by: sroedal --- examples/graphicsview/weatheranchorlayout/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/graphicsview/weatheranchorlayout/main.cpp b/examples/graphicsview/weatheranchorlayout/main.cpp index fd5d9c6..9002828 100644 --- a/examples/graphicsview/weatheranchorlayout/main.cpp +++ b/examples/graphicsview/weatheranchorlayout/main.cpp @@ -124,6 +124,7 @@ public: painter->drawPixmap(QPointF(), scaled); QPixmap tmp(scaled.size()); + tmp.fill(Qt::transparent); QPainter p(&tmp); // create gradient -- cgit v0.12 From 9845e93e4f36a2ed6fbb282d00dafe9d7a852a23 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 6 Nov 2009 12:34:14 +0100 Subject: Fix build --- src/corelib/animation/qabstractanimation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 93ac840..be99b3b 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -191,9 +191,9 @@ void QUnifiedTimer::ensureTimerUpdate() void QUnifiedTimer::updateAnimationsTime() { // ignore consistentTiming in case the pause timer is active - const int delta = (consistentTiming && !isPauseTimerActive) ? + int delta = (consistentTiming && !isPauseTimerActive) ? timingInterval : time.elapsed() - lastTick; - if slowMode) + if (slowMode) delta /= 5; lastTick = time.elapsed(); -- cgit v0.12 From 66e9e79e1c9e983df2cd870a01bf65b3374406b9 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 4 Nov 2009 14:46:29 -0800 Subject: Reset composition mode after drawing in dfb When drawing primitives in DirectFB we always set composition mode to NONE and manually manage whether or not to blend. This patch makes sure we will reset the composition mode afterwards. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index dd6b0d3..690b387 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -68,9 +68,10 @@ public: }; enum CompositionModeStatus { - PorterDuff_None = 0x0, - PorterDuff_SupportedBlits = 0x1, - PorterDuff_SupportedPrimitives = 0x2 + PorterDuff_None = 0x00, + PorterDuff_SupportedBlits = 0x01, + PorterDuff_SupportedPrimitives = 0x02, + PorterDuff_Dirty = 0x10 }; enum ClipType { @@ -945,6 +946,9 @@ void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) } surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); surface->SetBlittingFlags(surface, blittingFlags); + if (compositionModeStatus & PorterDuff_Dirty) { + setCompositionMode(q->state()->composition_mode); + } } static inline uint ALPHA_MUL(uint x, uint a) @@ -962,6 +966,7 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) surface->SetColor(surface, color.red(), color.green(), color.blue(), alpha); surface->SetPorterDuff(surface, DSPD_NONE); surface->SetDrawingFlags(surface, alpha == 255 ? DSDRAW_NOFX : DSDRAW_BLEND); + compositionModeStatus |= PorterDuff_Dirty; } IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release) -- cgit v0.12 From e0091513db8f3d9e5a54136ea5815843578b83de Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 5 Nov 2009 16:06:33 -0800 Subject: Support composition mode source for drawing in dfb Qt's/DirectFB's composition modes are not compatible for drawing operations. We only support SourceOver and handle whether or not to blend colors using DSDRAW_BLEND based on the alpha/opacity value. If drawing with Source and an opaque color we can still handle the operation using DirectFB. This has major impact since WebKit fills the background of web pages using Source. Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 71 ++++++++++++++++------ 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 690b387..c86af73 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -71,6 +71,7 @@ public: PorterDuff_None = 0x00, PorterDuff_SupportedBlits = 0x01, PorterDuff_SupportedPrimitives = 0x02, + PorterDuff_SupportedOpaquePrimitives = 0x04, PorterDuff_Dirty = 0x10 }; @@ -96,6 +97,7 @@ public: inline void unlock(); static inline void unlock(QDirectFBPaintDevice *device); + inline bool testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color = 0) const; inline bool isSimpleBrush(const QBrush &brush) const; void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos); @@ -405,11 +407,11 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen) return; - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) + if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) || !d->simplePen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush)) { + || !d->isSimpleBrush(brush) + || !d->testCompositionMode(&pen, &brush)) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); @@ -435,11 +437,11 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen) return; - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) + if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) || !d->simplePen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush)) { + || !d->isSimpleBrush(brush) + || !d->testCompositionMode(&pen, &brush)) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); @@ -461,16 +463,16 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) { Q_D(QDirectFBPaintEngine); - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || !d->simplePen - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) { + const QPen &pen = state()->pen; + if (!d->simplePen + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->testCompositionMode(&pen, 0)) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; } - const QPen &pen = state()->pen; if (pen.style() != Qt::NoPen) { d->setDFBColor(pen.color()); CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines)(lines, lineCount, state()->matrix, d->surface)); @@ -481,16 +483,16 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) { Q_D(QDirectFBPaintEngine); - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || !d->simplePen - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) { + const QPen &pen = state()->pen; + if (!d->simplePen + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->testCompositionMode(&pen, 0)) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; } - const QPen &pen = state()->pen; if (pen.style() != Qt::NoPen) { d->setDFBColor(pen.color()); CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines)(lines, lineCount, state()->matrix, d->surface)); @@ -715,8 +717,8 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) if (d->clipType != QDirectFBPaintEnginePrivate::ComplexClip) { switch (brush.style()) { case Qt::SolidPattern: { - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)) { + if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported + || !d->testCompositionMode(0, &brush)) { break; } const QColor color = brush.color(); @@ -754,9 +756,9 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) if (!color.isValid()) return; Q_D(QDirectFBPaintEngine); - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) { + if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->testCompositionMode(0, 0, &color)) { RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG()); d->lock(); QRasterPaintEngine::fillRect(rect, color); @@ -816,6 +818,36 @@ bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); } +bool QDirectFBPaintEnginePrivate::testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color) const +{ + Q_ASSERT(!pen || pen->style() == Qt::NoPen || pen->style() == Qt::SolidLine); + Q_ASSERT(!brush || brush->style() == Qt::NoBrush || brush->style() == Qt::SolidPattern); + switch (compositionModeStatus & (QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives + |QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)) { + case QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives: + return true; + case QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives: + if (pen && pen->style() == Qt::SolidLine && pen->color().alpha() != 255) + return false; + if (brush) { + if (brush->style() == Qt::SolidPattern && brush->color().alpha() != 255) { + return false; + } + } else if (color && color->alpha() != 255) { + return false; + } + return true; + case QDirectFBPaintEnginePrivate::PorterDuff_None: + return false; + default: + // ### PorterDuff_SupportedOpaquePrimitives|PorterDuff_SupportedPrimitives can't be combined + break; + } + Q_ASSERT(0); + return false; +} + + void QDirectFBPaintEnginePrivate::lock() { // We will potentially get a new pointer to the buffer after a @@ -889,6 +921,7 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m break; case QPainter::CompositionMode_Source: surface->SetPorterDuff(surface, DSPD_SRC); + compositionModeStatus |= PorterDuff_SupportedOpaquePrimitives; break; case QPainter::CompositionMode_SourceOver: compositionModeStatus |= PorterDuff_SupportedPrimitives; -- cgit v0.12 From 0625bb69685d768891fe882b788d56285eb9a1ee Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 6 Nov 2009 11:25:21 +0100 Subject: my change log for 4.6 --- dist/changes-4.6.0 | 70 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 7596943..a42b213 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -41,6 +41,9 @@ Third party components QtCore + - QObject + * [259514] fixed a possible dead-lock in the destructor + - QVariant * Many optimisations * Added QVariant::toFloat() and QVariant::toReal() @@ -67,7 +70,13 @@ QtCore QtGui -- QGraphicsItem + - QCompleter + * [246056] Fixed a possible assertion when setting the completer prefix + + - QFontDialog + * [256466] fixed the dialog not always returning the selected style. + + - QGraphicsItem * Fixed bug and improved accuracy of QGraphicsItem::childrenBoundingRect(). * Many optimizations. * Introduced QGraphicsItem::ItemHasNoContents @@ -79,10 +88,10 @@ QtGui * Introduced QGraphicsItem::stackBefore() * Cached items are now always invalidated when update() is called. -- QGraphicsObject + - QGraphicsObject * New class; inherits QGraphicsItem and adds notification signals and property declarations. -- QGraphicsProxyWidget + - QGraphicsProxyWidget * [251407] Fixed window flag handling. Now QGraphicsProxyWidget's flags win. * Fix Qt::ClickFocus policy @@ -95,24 +104,47 @@ QtGui * Introduced activation support. * Fixed bugs in initial focus support. -- QGraphicsTextItem + - QGraphicsTextItem * Now inherits from QGraphicsObject instead - QGraphicsTransform * New class; eases animation of transformations for QGraphicsItem. -- QGraphicsView + - QGraphicsView * Fix mapToScene(QRect) to avoid extra unnecessary adjustments. * Many optimizations. * Introduced QGraphicsView::isTransformed() * [QTBUG-4151] Items with parent that sets ItemClipsChildrenToShape were sometimes invisible. -- QGraphicsWidget + - QGraphicsWidget * Now inherits from QGraphicsObject instead + - QHeaderView + * [208320] Make sure the sort indicator s taken into account for the size hint + * [255574] Make sure the sizehint for the section depend on visible sections + + - QMainWindow + * [226060] Adding actions to a toolbar would always make the next toolbar move + + - QMenuBar + * [260873] Fix mouse interaction while undocking a widget from the main window + * dock areas don't get a splitter if their dock widgets are not resizable + + - QColumnView + * [246999] Fixed view not updating when the model is changed dynamically + + - QListView + * [243335] Fixed the visualRect to return correct values when the widget is not yet show + - QTreeView * [234930] Be able to use :has-children and :has-sibillings in a stylesheet * [252616] Set QStyleOptionViewItemV4::OnlyOne flag when painting spanning columns + * [245654] Fixed expandAll when deleting and recreating a mode for the tree + * [239271] Fixed missing update when adding a row when the first column is hidden + * [258225] Fixed scrollTo with center and bottom + + - QTreeWidget + * [253109] Shows the widget when calling setItemWidget - QTableView * [191545] Selections work more similarly to well-known spreadsheets @@ -121,6 +153,9 @@ QtGui speed-up, support for rows/columns insertion/removal, and better keyboard navigation + - QTableWidget + * [234641] Fixed takeItem to cause the view to be updated. + - QTabBar * [196326] Fixed having a stylesheet on a QTabBar resulted in some tab names to be slightly clipped. @@ -129,10 +164,10 @@ QtGui - QComboBox * [220195] Fixed keyboard search when current index is -1 -- QPixmap + - QPixmap * Optimized width(), height(), isNull() and depth(). -- QRegion + - QRegion * Minor optimizations. - QSpinBox @@ -182,7 +217,7 @@ QtGui - On Windows CE the link time code geration has been disabled by default to be consistent with win32-msvc200x. - + - Added QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES1CL and QMAKE_LIBS_OPENGL_ES2 qmake variables for specifying OpenGL ES specific libraries. @@ -190,6 +225,13 @@ QtGui - KDE Integration: Improved the integration into KDE desktop (loading of KDE palette, usage of KColorDialog and KFileDialog) using the GuiPlatformPlugin + + - Phonon on Windows + * Now much more reliable when reading a file through a QIODevice. + * If Video Mixing Renderer 9 is not available, falls back to software + rendering. + * Fixed a flicker issue when switching source with a transition time of 0 + **************************************************************************** * Tools * **************************************************************************** @@ -361,4 +403,14 @@ QtGui - On Mac OS X, QDesktopServices::storageLocation(DataLocation) now includes QCoreApplication::organizationName() and QCoreApplication::applicationName() if those are set. This matches the behavior on the other platforms. + + - The Animation Framework + * currentTime() now returns the complete current time including previous loops + * currentLoopTime() returns the time inside the current loop + * stateChanged signal sends the new state as first parameter and old state as + the second + * QAnimationGroup::clearAnimations() has been renames to clear() + * QAnimationGroup::insertAnimationAt() has been renames to insertAnimation() + * QAnimationGroup::takeAnimationAt() has been renames to takeAnimation() + * QSequentialAnimationGroup::insertPauseAt() has been renames to insertPause() -- cgit v0.12 From d895d7cc8908ce5c6157c8261b9145d81b21501f Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Fri, 6 Nov 2009 11:27:57 +0100 Subject: Fix QDesktopWidget::availableGeometry() on OSX Was ignoring top OSX menu bar. Example c++: http://pastebin.ca/1585763 http://fred.uwcs.co.uk/testAvailableGeometry.cpp Example output: http://pastebin.ca/1585766 http://fred.uwcs.co.uk/testAvailableGeometry.output Introduced by commit 13254da6c3192937812983f44ce95fe8e1bc602c Merge-request: 1652 Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qdesktopwidget_mac.mm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qdesktopwidget_mac.mm b/src/gui/kernel/qdesktopwidget_mac.mm index 88dc173..1020435 100644 --- a/src/gui/kernel/qdesktopwidget_mac.mm +++ b/src/gui/kernel/qdesktopwidget_mac.mm @@ -136,16 +136,20 @@ void QDesktopWidgetImplementation::onResize() screenRects.clear(); availableRects.clear(); NSRect primaryRect = [[displays objectAtIndex:0] frame]; - for (int i = 0; i Date: Fri, 6 Nov 2009 11:32:04 +0100 Subject: Removed the unnecessery loop in the last commit originated from a merge request. Reviewed-by: Prasanth --- src/gui/kernel/qdesktopwidget_mac.mm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qdesktopwidget_mac.mm b/src/gui/kernel/qdesktopwidget_mac.mm index 1020435..c2d05d7 100644 --- a/src/gui/kernel/qdesktopwidget_mac.mm +++ b/src/gui/kernel/qdesktopwidget_mac.mm @@ -137,15 +137,14 @@ void QDesktopWidgetImplementation::onResize() availableRects.clear(); NSRect primaryRect = [[displays objectAtIndex:0] frame]; for (int i = 0; i Date: Fri, 6 Nov 2009 11:49:07 +0100 Subject: Assistant: Fix bugs on cached collection file handling. 1. When the dates between the caller-supplied and the cached versions of a collection file differed, we used to overwrite the cached with the original version. This was obviously wrong - we should only overwrite when the cached version is older. 2. We also forgot to set the zoom factor when overwriting. Task-number: QTBUG-4899 Reviewed-by: kh1 --- tools/assistant/tools/assistant/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index a721880..12bc5b1 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -115,7 +115,7 @@ updateUserCollection(QHelpEngineCore& user, const QHelpEngineCore& caller) const uint userCollectionCreationTime = user. customValue(QLatin1String("CreationTime"), 1).toUInt(); - if (callerCollectionCreationTime == userCollectionCreationTime) + if (callerCollectionCreationTime <= userCollectionCreationTime) return false; user.setCustomValue(QLatin1String("CreationTime"), @@ -124,6 +124,12 @@ updateUserCollection(QHelpEngineCore& user, const QHelpEngineCore& caller) caller.customValue(QLatin1String("WindowTitle"))); user.setCustomValue(QLatin1String("LastShownPages"), caller.customValue(QLatin1String("LastShownPages"))); +#if !defined(QT_NO_WEBKIT) + const QLatin1String zoomKey("LastPagesZoomWebView"); +#else + const QLatin1String zoomKey("LastPagesZoomTextBrowser"); +#endif + user.setCustomValue(zoomKey, caller.customValue(zoomKey)); user.setCustomValue(QLatin1String("CurrentFilter"), caller.customValue(QLatin1String("CurrentFilter"))); user.setCustomValue(QLatin1String("CacheDirectory"), -- cgit v0.12 From b8a8110ead6fe5d4a985fe9d486dd8f470aa24eb Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 6 Nov 2009 11:58:38 +0100 Subject: update harfbuzz once again, adding N'Ko support integrate/update to change 797fe54d9ebbafb0cdc00705c008ea09e7ac1e9e from harfbuzz: commit 797fe54d9ebbafb0cdc00705c008ea09e7ac1e9e Author: Lars Knoll Date: Fri Nov 6 11:56:44 2009 +0100 add N'Ko support to the arabic shaper Long outstanding bug report for Qt. See http://bugreports.qt.nokia.com/browse/QTBUG-1042 Task-number: part of QTBUG-1042 Reviewed-by: Gunnar --- src/3rdparty/harfbuzz/src/harfbuzz-arabic.c | 60 +++++++++++++++++++++++++-- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 8 +++- src/3rdparty/harfbuzz/src/harfbuzz-shaper.h | 2 +- src/3rdparty/harfbuzz/tests/shaping/main.cpp | 35 ++++++++++++++++ 4 files changed, 99 insertions(+), 6 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c index 4d85c19..3837087 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c @@ -489,6 +489,56 @@ static void getArabicProperties(const unsigned short *chars, int len, HB_ArabicP */ } +static Joining getNkoJoining(unsigned short uc) +{ + if (uc < 0x7ca) + return JNone; + if (uc <= 0x7ea) + return JDual; + if (uc <= 0x7f3) + return JTransparent; + if (uc <= 0x7f9) + return JNone; + if (uc == 0x7fa) + return JCausing; + return JNone; +} + +static void getNkoProperties(const unsigned short *chars, int len, HB_ArabicProperties *properties) +{ + int lastPos = 0; + int i = 0; + + Joining j = getNkoJoining(chars[0]); + ArabicShape shape = joining_table[XIsolated][j].form2; + properties[0].justification = HB_NoJustification; + + for (i = 1; i < len; ++i) { + properties[i].justification = (HB_GetUnicodeCharCategory(chars[i]) == HB_Separator_Space) ? + ArabicSpace : ArabicNone; + + j = getNkoJoining(chars[i]); + + if (j == JTransparent) { + properties[i].shape = XIsolated; + continue; + } + + properties[lastPos].shape = joining_table[shape][j].form1; + shape = joining_table[shape][j].form2; + + + lastPos = i; + } + properties[lastPos].shape = joining_table[shape][JNone].form1; + + + /* + for (int i = 0; i < len; ++i) + qDebug("nko properties(%d): uc=%x shape=%d, justification=%d", i, chars[i], properties[i].shape, properties[i].justification); + */ +} + /* // The unicode to unicode shaping codec. // does only presentation forms B at the moment, but that should be enough for @@ -1012,7 +1062,10 @@ static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok) if (f + l + item->item.pos < item->stringLength) { ++l; } - getArabicProperties(uc+f, l, props); + if (item->item.script == HB_Script_Nko) + getNkoProperties(uc+f, l, props); + else + getArabicProperties(uc+f, l, props); for (i = 0; i < (int)item->num_glyphs; i++) { apply[i] = 0; @@ -1051,7 +1104,8 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item) HB_Bool haveGlyphs; HB_STACKARRAY(HB_UChar16, shapedChars, item->item.length); - assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac); + assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac + || item->item.script == HB_Script_Nko); #ifndef NO_OPENTYPE @@ -1065,7 +1119,7 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item) } #endif - if (item->item.script == HB_Script_Syriac) + if (item->item.script != HB_Script_Arabic) return HB_BasicShape(item); shapedString(item->string, item->stringLength, item->item.pos, item->item.length, shapedChars, &slen, diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index f92bb55..f3ec8e1 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -637,7 +637,9 @@ const HB_ScriptEngine HB_ScriptEngines[] = { // Runic { HB_BasicShape, 0 }, // Khmer - { HB_KhmerShape, HB_KhmerAttributes } + { HB_KhmerShape, HB_KhmerAttributes }, + // N'Ko + { HB_ArabicShape, 0} }; void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, @@ -877,7 +879,9 @@ static const OTScripts ot_scripts [] = { // Runic { HB_MAKE_TAG('r', 'u', 'n', 'r'), 0 }, // Khmer - { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 } + { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 }, + // N'Ko + { HB_MAKE_TAG('n', 'k', 'o', ' '), 1 } }; enum { NumOTScripts = sizeof(ot_scripts)/sizeof(OTScripts) }; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h index d2357f43..f7c7714 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h @@ -62,6 +62,7 @@ typedef enum { HB_Script_Ogham, HB_Script_Runic, HB_Script_Khmer, + HB_Script_Nko, HB_Script_Inherited, HB_ScriptCount = HB_Script_Inherited /* @@ -102,7 +103,6 @@ typedef enum { HB_Script_Cuneiform = Common, HB_Script_Phoenician = Common, HB_Script_PhagsPa = Common, - HB_Script_Nko = Common */ } HB_Script; diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 41f2dbb..12fa7c4 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -181,6 +181,7 @@ private slots: void sinhala(); void khmer(); + void nko(); void linearB(); }; @@ -1075,6 +1076,40 @@ void tst_QScriptEngine::khmer() } } +void tst_QScriptEngine::nko() +{ + { + FT_Face face = loadFace("DejaVuSans.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x7ca, 0x0 }, + { 0x5c1, 0x0 } }, + { { 0x7ca, 0x7ca, 0x0 }, + { 0x14db, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7fa, 0x7ca, 0x0 }, + { 0x14db, 0x5ec, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7f3, 0x7ca, 0x0 }, + { 0x14db, 0x5e7, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7f3, 0x7fa, 0x7ca, 0x0 }, + { 0x14db, 0x5e7, 0x5ec, 0x14d9, 0x0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Nko) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVuSans.ttf", SkipAll); + } + } +} + + void tst_QScriptEngine::linearB() { { -- cgit v0.12 From 2e429e40eeed266c7062502c4f7b43092340f264 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 6 Nov 2009 12:03:10 +0100 Subject: add support for the N'Ko writing system to Qt Enables N'Ko support in Qt, after having now a harfbuzz version that supports it. Task-number: QTBUG-1042 Reviewed-by: Gunnar --- src/corelib/tools/qunicodetables_p.h | 4 +- src/gui/text/qfontdatabase.cpp | 23 +++++++-- src/gui/text/qfontdatabase.h | 1 + src/gui/text/qfontdatabase_x11.cpp | 93 +++++++++++++++++++----------------- 4 files changed, 72 insertions(+), 49 deletions(-) diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h index e4041b4..4e9ce4d 100644 --- a/src/corelib/tools/qunicodetables_p.h +++ b/src/corelib/tools/qunicodetables_p.h @@ -114,6 +114,7 @@ namespace QUnicodeTables { Ogham, Runic, Khmer, + Nko, Inherited, ScriptCount = Inherited, Latin = Common, @@ -152,8 +153,7 @@ namespace QUnicodeTables { Balinese = Common, Cuneiform = Common, Phoenician = Common, - PhagsPa = Common, - Nko = Common + PhagsPa = Common }; enum { ScriptSentinel = 32 }; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index fb8444e..7d17e49 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -534,6 +534,12 @@ static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { { 0, 127 }, // same as latin1 // Other, { 126, 127 } + // Ogham, + { 78, 127 }, + // Runic, + { 79, 127 }, + // Nko, + { 14, 127 }, }; #define SimplifiedChineseCsbBit 18 @@ -873,7 +879,8 @@ static const int scriptForWritingSystem[] = { QUnicodeTables::Common, // Braille QUnicodeTables::Common, // Symbol QUnicodeTables::Ogham, // Ogham - QUnicodeTables::Runic // Runic + QUnicodeTables::Runic, // Runic + QUnicodeTables::Nko // Nko }; @@ -881,12 +888,12 @@ static const int scriptForWritingSystem[] = { static inline bool requiresOpenType(int writingSystem) { return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) - || writingSystem == QFontDatabase::Khmer); + || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko); } static inline bool scriptRequiresOpenType(int script) { return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala) - || script == QUnicodeTables::Khmer); + || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko); } #endif @@ -1558,6 +1565,7 @@ QFontDatabase::QFontDatabase() \value Other (the same as Symbol) \value Ogham \value Runic + \value Nko \omitvalue WritingSystemsCount */ @@ -2232,6 +2240,9 @@ QString QFontDatabase::writingSystemName(WritingSystem writingSystem) case Runic: name = QT_TRANSLATE_NOOP("QFontDatabase", "Runic"); break; + case Nko: + name = QT_TRANSLATE_NOOP("QFontDatabase", "N'Ko"); + break; default: Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter"); break; @@ -2445,6 +2456,12 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem) sample += QChar(0x16a2); sample += QChar(0x16a3); break; + case Nko: + sample += QChar(0x7ca); + sample += QChar(0x7cb); + sample += QChar(0x7cc); + sample += QChar(0x7cd); + break; default: break; } diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index e6dcfc9..37b5860 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -108,6 +108,7 @@ public: Ogham, Runic, + Nko, WritingSystemsCount }; diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index f184811..dd575f9 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -155,187 +155,187 @@ static const char writingSystems_for_xlfd_encoding[sizeof(xlfd_encoding)][QFontD { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-2 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-3 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-4 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-9 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-10 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-13 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-14 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-15 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // hp-roman8 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-5 { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // *-cp1251 { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // koi8-ru { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // koi8-u { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // koi8-r { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-7 { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-8 { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // gb18030-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0 }, + 0, 0 }, // gb18030.2000-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0 }, + 0, 0 }, // gbk-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0 }, + 0, 0 }, // gb2312.*-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0 }, + 0, 0 }, // jisx0201*-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0 }, + 0, 0 }, // jisx0208*-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0 }, + 0, 0 }, // ksc5601*-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0 }, + 0, 0 }, // big5hkscs-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0 }, + 0, 0 }, // hkscs-1 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0 }, + 0, 0 }, // big5*-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0 }, + 0, 0 }, // tscii-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // tis620*-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-11 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // mulelao-1 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // ethiopic-unicode { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso10646-1 { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, - 0 }, + 0, 0 }, // unicode-* { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, - 0 }, + 0, 0 }, // *-symbol { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 }, + 1, 0 }, // *-fontspecific { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 }, + 1, 0 }, // fontspecific-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 } + 1, 0 } }; @@ -835,7 +835,8 @@ static const char *specialLanguages[] = { "ko", // Hangul "", // Ogham "", // Runic - "km" // Khmer + "km", // Khmer + "" // N'Ko }; enum { SpecialLanguageCount = sizeof(specialLanguages) / sizeof(const char *) }; @@ -866,7 +867,8 @@ static const ushort specialChars[] = { 0, // Hangul 0x1681, // Ogham 0x16a0, // Runic - 0 // Khmer + 0, // Khmer + 0x7ca // N'Ko }; enum { SpecialCharCount = sizeof(specialChars) / sizeof(ushort) }; @@ -905,7 +907,8 @@ static const char *languageForWritingSystem[] = { "vi", // Vietnamese 0, // Symbol 0, // Ogham - 0 // Runic + 0, // Runic + 0 // N'Ko }; enum { LanguageCount = sizeof(languageForWritingSystem) / sizeof(const char *) }; @@ -944,7 +947,8 @@ static const ushort sampleCharForWritingSystem[] = { 0, // Vietnamese 0, // Symbol 0x1681, // Ogham - 0x16a0 // Runic + 0x16a0, // Runic + 0x7ca // N'Ko }; enum { SampleCharCount = sizeof(sampleCharForWritingSystem) / sizeof(ushort) }; @@ -984,7 +988,8 @@ static const char *openType[] = { 0, // Vietnamese 0, // Symbol 0, // Ogham - 0 // Runic + 0, // Runic + "nko " // N'Ko }; enum { OpenTypeCount = sizeof(openType) / sizeof(const char *) }; @@ -1472,7 +1477,7 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD !(request.styleStrategy & QFont::NoAntialias)); } - if (script != QUnicodeTables::Common) { + if (script != QUnicodeTables::Common && *specialLanguages[script] != '\0') { Q_ASSERT(script < QUnicodeTables::ScriptCount); FcLangSet *ls = FcLangSetCreate(); FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]); @@ -1615,7 +1620,7 @@ static QFontEngine *tryPatternLoad(FcPattern *p, int screen, goto done; if (!FcCharSetHasChar(cs, specialChars[script])) goto done; - } else { + } else if (*specialLanguages[script] != '\0'){ FcLangSet *langSet = 0; if (FcPatternGetLangSet(match, FC_LANG, 0, &langSet) != FcResultMatch) goto done; -- cgit v0.12 From 5b9d489f6cc08061f91b36eb07df4fd7df12ccb1 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 6 Nov 2009 12:04:53 +0100 Subject: update documentation We are at Unicode 5.1, not 4.0 Tell about N'Ko support. Reviewed-by: Gunnar --- doc/src/internationalization/i18n.qdoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc index 2d1b8cc..ecc25fe 100644 --- a/doc/src/internationalization/i18n.qdoc +++ b/doc/src/internationalization/i18n.qdoc @@ -93,7 +93,7 @@ \o Greek \o Hebrew \o Thai and Lao - \o All scripts in Unicode 4.0 that do not require special processing + \o All scripts in Unicode 5.1 that do not require special processing \endlist On Windows, Unix/X11 with FontConfig (client side font support) @@ -112,6 +112,7 @@ \o Tamil \o Telugu \o Tibetan + \o N'Ko \endlist Many of these writing systems exhibit special features: @@ -181,7 +182,7 @@ \section2 Use QString for All User-Visible Text - Since QString uses the Unicode 4.0 encoding internally, every + Since QString uses the Unicode 5.1 encoding internally, every language in the world can be processed transparently using familiar text processing operations. Also, since all Qt functions that present text to the user take a QString as a parameter, -- cgit v0.12 From e70168edd89a0161955866e9acc32bb766d9f147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 6 Nov 2009 12:06:15 +0100 Subject: My changes --- dist/changes-4.6.0 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 7596943..2808113 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -62,10 +62,16 @@ QtCore * Added the possibility to pass the flag Qt::UniqueConnection to QObject::connect * Fixed race conditions that occured when moving object to threads while connecting + - QPluginLoader + * Improved performance of plugin loading by reusing the plugin cache instead of loading + it every time. + - QTextStream * [221316] Fixed crash on large input. QtGui +- QGraphicsAnchorLayout + * Support for expanding size policy has been removed. (The Qt 4.6 Beta had support for it). - QGraphicsItem * Fixed bug and improved accuracy of QGraphicsItem::childrenBoundingRect(). @@ -79,6 +85,9 @@ QtGui * Introduced QGraphicsItem::stackBefore() * Cached items are now always invalidated when update() is called. +- QGraphicsLayout + * Introduced QGraphicsLayout::addChildLayoutItem() + - QGraphicsObject * New class; inherits QGraphicsItem and adds notification signals and property declarations. @@ -109,6 +118,7 @@ QtGui - QGraphicsWidget * Now inherits from QGraphicsObject instead + * Interactive resizing of top level windows now respects height-for-width constraints. - QTreeView * [234930] Be able to use :has-children and :has-sibillings in a stylesheet @@ -141,6 +151,9 @@ QtGui - QStandardItemModel * [255652] Fixed crash while using takeRow with a QSortFilterProxyModel + - QToolTip + * Fixed a bug where tooltips were not shown in popups. (Windows only). + - QGraphicsItem * Added a new set of properties to set a transformation on a item @@ -213,6 +226,9 @@ QtGui - [128859] Fixed code generation of QLabel's wordWrap property. + - lupdate + - Fixed a bug in the java source code parser. + **************************************************************************** * DirectFB * **************************************************************************** -- cgit v0.12 From 49c941e5f34a20b05f0f40914a8224e433d5e4e8 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 6 Nov 2009 12:14:13 +0100 Subject: Fix Phonon's video renderer on windows with opengl Now we use opengl 2. Reviewed-by: Samuel --- src/3rdparty/phonon/ds9/videorenderer_soft.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp index 82d6235..f7d42cf 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp @@ -661,7 +661,10 @@ namespace Phonon #ifndef QT_NO_OPENGL - if (painter.paintEngine() && painter.paintEngine()->type() == QPaintEngine::OpenGL && checkGLPrograms()) { + if (painter.paintEngine() && + (painter.paintEngine()->type() == QPaintEngine::OpenGL || painter.paintEngine()->type() == QPaintEngine::OpenGL2) + && checkGLPrograms()) { + //for now we only support YUV (both YV12 and YUY2) updateTexture(); @@ -673,6 +676,7 @@ namespace Phonon } //let's draw the texture + painter.beginNativePainting(); //Let's pass the other arguments const Program prog = (m_inputPin->connectedType().subtype == MEDIASUBTYPE_YV12) ? YV12toRGB : YUY2toRGB; @@ -722,6 +726,7 @@ namespace Phonon glDisableClientState(GL_VERTEX_ARRAY); glDisable(GL_FRAGMENT_PROGRAM_ARB); + painter.endNativePainting(); return; } else #endif -- cgit v0.12 From 461f7037d2ae6b3d97e49ff2729d594c9221309f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 6 Nov 2009 12:17:55 +0100 Subject: Pro file fixes wrt anchor layout examples. --- examples/graphicsview/graphicsview.pro | 3 ++- examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/graphicsview/graphicsview.pro b/examples/graphicsview/graphicsview.pro index a919c74..210ab1f 100644 --- a/examples/graphicsview/graphicsview.pro +++ b/examples/graphicsview/graphicsview.pro @@ -9,7 +9,8 @@ SUBDIRS = \ diagramscene \ dragdroprobot \ flowlayout \ - anchorlayout + anchorlayout \ + weatheranchorlayout contains(QT_CONFIG, qt3support):SUBDIRS += portedcanvas portedasteroids contains(DEFINES, QT_NO_CURSOR)|contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= dragdroprobot diff --git a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro index 8b1803b..fa2733c 100644 --- a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro +++ b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro @@ -8,9 +8,7 @@ RESOURCES += weatheranchorlayout.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/weatheranchorlayout -sources.files = $$SOURCES $$HEADERS $$RESOURCES weatheranchorlayout.pro +sources.files = $$SOURCES $$HEADERS $$RESOURCES weatheranchorlayout.pro images sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/weatheranchorlayout INSTALLS += target sources -TARGET = weatheranchorlayout_example -CONFIG += console -- cgit v0.12 From 3433bc44168398734cdd53df9b64adf016c8ab3b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 6 Nov 2009 09:50:32 +0100 Subject: Compile on Mac Reviewed-by: Thierry --- src/gui/widgets/qmenu_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index b238faf..9510cc6 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -1191,7 +1191,7 @@ QMenuPrivate::QMacMenuPrivate::addAction(QMacMenuAction *action, QMacMenuAction #endif } - QWidget *widget = qmenu ? qmenu->widgetItems.value(qmenu->actions.indexOf(action->action)) : 0; + QWidget *widget = qmenu ? qmenu->widgetItems.value(action->action) : 0; if (widget) { #ifndef QT_MAC_USE_COCOA ChangeMenuAttributes(action->menu, kMenuAttrDoNotCacheImage, 0); -- cgit v0.12 From f8a0b7b9ea2e077be7167c58d4eac27360d4cee6 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 5 Nov 2009 13:11:03 +0100 Subject: QGraphicsView: Fixes QGraphicsView::focusItem when scene is not active When scene is not active, returns the item that would get the focus if the scene became active. This is more consistant with Qt 4.5 behaviour Reviewed-by: Andreas --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- src/gui/graphicsview/qgraphicsscene.cpp | 10 ++++++---- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 949f555..073c31b 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2980,7 +2980,7 @@ bool QGraphicsItem::hasFocus() const { if (d_ptr->focusProxy) return d_ptr->focusProxy->hasFocus(); - return (d_ptr->scene && d_ptr->scene->focusItem() == this); + return isActive() && (d_ptr->scene && d_ptr->scene->focusItem() == this); } /*! diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 80cd2bc..a59e961 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -2883,18 +2883,20 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) } /*! - Returns the scene's current focus item, or 0 if no item currently has - focus. + When the scene is active, this functions returns the scene's current focus + item, or 0 if no item currently has focus. When the scene is inactive, this + functions returns the item that will gain input focus when the scene becomes + active. The focus item receives keyboard input when the scene receives a key event. - \sa setFocusItem(), QGraphicsItem::hasFocus() + \sa setFocusItem(), QGraphicsItem::hasFocus(), isActive() */ QGraphicsItem *QGraphicsScene::focusItem() const { Q_D(const QGraphicsScene); - return d->focusItem; + return isActive() ? d->focusItem : d->lastFocusItem; } /*! diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 4f76ddd..c81bd64 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -225,6 +225,7 @@ private slots: void focusItem(); void focusItemLostFocus(); void setFocusItem(); + void setFocusItem_inactive(); void mouseGrabberItem(); void hoverEvents_siblings(); void hoverEvents_parentChild(); @@ -1534,6 +1535,26 @@ void tst_QGraphicsScene::setFocusItem() QVERIFY(!item2->hasFocus()); } +void tst_QGraphicsScene::setFocusItem_inactive() +{ + QGraphicsScene scene; + QGraphicsItem *item = scene.addText("Qt"); + QVERIFY(!scene.focusItem()); + QVERIFY(!scene.hasFocus()); + scene.setFocusItem(item); + QVERIFY(!scene.hasFocus()); + QVERIFY(!scene.focusItem()); + item->setFlag(QGraphicsItem::ItemIsFocusable); + + for (int i = 0; i < 3; ++i) { + scene.setFocusItem(item); + QCOMPARE(scene.focusItem(), item); + QVERIFY(!item->hasFocus()); + } + +} + + void tst_QGraphicsScene::mouseGrabberItem() { QGraphicsScene scene; @@ -3130,6 +3151,7 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems() QVERIFY(!view->viewport()->hasFocus()); QVERIFY(!scene.hasFocus()); QVERIFY(!item->hasFocus()); + QCOMPARE(scene.focusItem(), static_cast(item)); // Check that the correct item regains focus. widget.show(); -- cgit v0.12 From d9c226c72105ef221c766cb9f616d10329197880 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 5 Nov 2009 15:36:15 +0100 Subject: Fix QGraphicsScene::isActive if the view is shown while the window is active. We need to make sure the active state is preserved if graphicsview are dinamically shown/hide while window is active. Or if scene is changed with setScene. This fixes KRunner focus regressions Reviewed-by: Andreas Task-number: QTBUG-5281 --- src/gui/graphicsview/qgraphicsview.cpp | 23 +++ tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 178 +++++++++++++++++++++++ 2 files changed, 201 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index d1dd26f..87585a2 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1512,6 +1512,11 @@ void QGraphicsView::setScene(QGraphicsScene *scene) this, SLOT(updateSceneRect(QRectF))); d->scene->d_func()->removeView(this); d->connectedToScene = false; + + if (isActiveWindow() && isVisible()) { + QEvent windowDeactivate(QEvent::WindowDeactivate); + QApplication::sendEvent(d->scene, &windowDeactivate); + } } // Assign the new scene and update the contents (scrollbars, etc.)). @@ -1533,6 +1538,11 @@ void QGraphicsView::setScene(QGraphicsScene *scene) // enable touch events if any items is interested in them if (!d->scene->d_func()->allItemsIgnoreTouchEvents) d->viewport->setAttribute(Qt::WA_AcceptTouchEvents); + + if (isActiveWindow() && isVisible()) { + QEvent windowActivate(QEvent::WindowActivate); + QApplication::sendEvent(d->scene, &windowActivate); + } } else { d->recalculateContentSize(); } @@ -2638,6 +2648,19 @@ bool QGraphicsView::viewportEvent(QEvent *event) d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); QApplication::sendEvent(d->scene, event); break; + case QEvent::Show: + if (d->scene && isActiveWindow()) { + QEvent windowActivate(QEvent::WindowActivate); + QApplication::sendEvent(d->scene, &windowActivate); + } + break; + case QEvent::Hide: + // spontaneous event will generate a WindowDeactivate. + if (!event->spontaneous() && d->scene && isActiveWindow()) { + QEvent windowDeactivate(QEvent::WindowDeactivate); + QApplication::sendEvent(d->scene, &windowDeactivate); + } + break; case QEvent::Leave: // ### This is a temporary fix for until we get proper mouse grab // events. activeMouseGrabberItem should be set to 0 if we lose the diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index c81bd64..9a561eb 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -268,6 +268,7 @@ private slots: void initialFocus_data(); void initialFocus(); void polishItems(); + void isActive(); // task specific tests below me void task139710_bspTreeCrash(); @@ -3159,8 +3160,10 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems() widget.activateWindow(); QTest::qWaitForWindowShown(&widget); QTRY_VERIFY(view->hasFocus()); + QTRY_VERIFY(scene.isActive()); QVERIFY(view->viewport()->hasFocus()); QVERIFY(scene.hasFocus()); + QCOMPARE(scene.focusItem(), static_cast(item)); QVERIFY(item->hasFocus()); } @@ -3952,5 +3955,180 @@ void tst_QGraphicsScene::polishItems() QMetaObject::invokeMethod(&scene,"_q_polishItems"); } +void tst_QGraphicsScene::isActive() +{ + QGraphicsScene scene1; + QVERIFY(!scene1.isActive()); + QGraphicsScene scene2; + QVERIFY(!scene2.isActive()); + + { + QWidget toplevel1; + QHBoxLayout *layout = new QHBoxLayout; + toplevel1.setLayout(layout); + QGraphicsView *view1 = new QGraphicsView(&scene1); + QGraphicsView *view2 = new QGraphicsView(&scene2); + layout->addWidget(view1); + layout->addWidget(view2); + + QVERIFY(!scene1.isActive()); + QVERIFY(!scene2.isActive()); + + view1->setVisible(false); + + toplevel1.show(); + QApplication::setActiveWindow(&toplevel1); + QTest::qWaitForWindowShown(&toplevel1); + QTRY_COMPARE(QApplication::activeWindow(), &toplevel1); + + QVERIFY(!scene1.isActive()); //it is hidden; + QVERIFY(scene2.isActive()); + + view1->show(); + QVERIFY(scene1.isActive()); + QVERIFY(scene2.isActive()); + + view2->hide(); + + QVERIFY(scene1.isActive()); + QVERIFY(!scene2.isActive()); + + toplevel1.hide(); + QTest::qWait(12); + QTRY_VERIFY(!scene1.isActive()); + QTRY_VERIFY(!scene2.isActive()); + + toplevel1.show(); + QApplication::setActiveWindow(&toplevel1); + QApplication::processEvents(); + QTRY_COMPARE(QApplication::activeWindow(), &toplevel1); + + QTRY_VERIFY(scene1.isActive()); + QTRY_VERIFY(!scene2.isActive()); + + view2->show(); + QVERIFY(scene1.isActive()); + QVERIFY(scene2.isActive()); + } + + QVERIFY(!scene1.isActive()); + QVERIFY(!scene2.isActive()); + + { + QWidget toplevel2; + QHBoxLayout *layout = new QHBoxLayout; + toplevel2.setLayout(layout); + QGraphicsView *view1 = new QGraphicsView(&scene1); + QGraphicsView *view2 = new QGraphicsView(); + layout->addWidget(view1); + layout->addWidget(view2); + + QVERIFY(!scene1.isActive()); + QVERIFY(!scene2.isActive()); + + toplevel2.show(); + QApplication::setActiveWindow(&toplevel2); + QTest::qWaitForWindowShown(&toplevel2); + QTRY_COMPARE(QApplication::activeWindow(), &toplevel2); + + QVERIFY(scene1.isActive()); + QVERIFY(!scene2.isActive()); + + view2->setScene(&scene2); + + QVERIFY(scene1.isActive()); + QVERIFY(scene2.isActive()); + + view1->setScene(&scene2); + QVERIFY(!scene1.isActive()); + QVERIFY(scene2.isActive()); + + view1->hide(); + QVERIFY(!scene1.isActive()); + QVERIFY(scene2.isActive()); + + view1->setScene(&scene1); + QVERIFY(!scene1.isActive()); + QVERIFY(scene2.isActive()); + + view1->show(); + + view1->show(); + QVERIFY(scene1.isActive()); + QVERIFY(scene2.isActive()); + + view2->hide(); + QVERIFY(scene1.isActive()); + QVERIFY(!scene2.isActive()); + + QGraphicsView topLevelView; + topLevelView.show(); + QApplication::setActiveWindow(&topLevelView); + QTest::qWaitForWindowShown(&topLevelView); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&topLevelView)); + + QVERIFY(!scene1.isActive()); + QVERIFY(!scene2.isActive()); + + topLevelView.setScene(&scene1); + QVERIFY(scene1.isActive()); + QVERIFY(!scene2.isActive()); + + view2->show(); + QVERIFY(scene1.isActive()); + QVERIFY(!scene2.isActive()); + + view1->hide(); + QVERIFY(scene1.isActive()); + QVERIFY(!scene2.isActive()); + + QApplication::setActiveWindow(&toplevel2); + QTRY_COMPARE(QApplication::activeWindow(), &toplevel2); + + QVERIFY(!scene1.isActive()); + QVERIFY(scene2.isActive()); + + + } + + QVERIFY(!scene1.isActive()); + QVERIFY(!scene2.isActive()); + + { + QWidget toplevel3; + QHBoxLayout *layout = new QHBoxLayout; + toplevel3.setLayout(layout); + QGraphicsView *view1 = new QGraphicsView(&scene1); + QGraphicsView *view2 = new QGraphicsView(&scene2); + layout->addWidget(view1); + + QVERIFY(!scene1.isActive()); + QVERIFY(!scene2.isActive()); + + toplevel3.show(); + QApplication::setActiveWindow(&toplevel3); + QTest::qWaitForWindowShown(&toplevel3); + QTRY_COMPARE(QApplication::activeWindow(), &toplevel3); + + QVERIFY(scene1.isActive()); + QVERIFY(!scene2.isActive()); + + layout->addWidget(view2); + QApplication::processEvents(); + QVERIFY(scene1.isActive()); + QVERIFY(scene2.isActive()); + + view1->setParent(0); + QVERIFY(!scene1.isActive()); + QVERIFY(scene2.isActive()); + delete view1; + } + + QVERIFY(!scene1.isActive()); + QVERIFY(!scene2.isActive()); + +} + + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" -- cgit v0.12 From a48b8e3c8c05384b27fcdde4ac27b8b8866c36c2 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 6 Nov 2009 12:11:48 +0100 Subject: Fixed crash in qt_scale_image_16/32bit() when target is flipped. If the target rectangle had negative width or height and the target rectangle's border passed through pixel centres, qt_scale_image_16/32bit() could crash because of incorrect rounding. Task-number: 5493 Reviewed-by: Gunnar --- src/gui/painting/qblendfunctions.cpp | 40 ++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index f8dd424..8737f10 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -223,11 +223,23 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl, int h = ty2 - ty1; int w = tx2 - tx1; - const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1; - const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1; + quint32 basex; + quint32 srcy; - quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx; - quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty; + if (sx < 0) { + int dstx = qFloor((tx1 + 0.5 - targetRect.right()) * ix) + 1; + basex = quint32(srcRect.right() * 65536) + dstx; + } else { + int dstx = qCeil((tx1 + 0.5 - targetRect.left()) * ix) - 1; + basex = quint32(srcRect.left() * 65536) + dstx; + } + if (sy < 0) { + int dsty = qFloor((ty1 + 0.5 - targetRect.bottom()) * iy) + 1; + srcy = quint32(srcRect.bottom() * 65536) + dsty; + } else { + int dsty = qCeil((ty1 + 0.5 - targetRect.top()) * iy) - 1; + srcy = quint32(srcRect.top() * 65536) + dsty; + } quint16 *dst = ((quint16 *) (destPixels + ty1 * dbpl)) + tx1; @@ -723,11 +735,23 @@ template void qt_scale_image_32bit(uchar *destPixels, int dbpl, int h = ty2 - ty1; int w = tx2 - tx1; - const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1; - const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1; + quint32 basex; + quint32 srcy; - quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx; - quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty; + if (sx < 0) { + int dstx = qFloor((tx1 + 0.5 - targetRect.right()) * ix) + 1; + basex = quint32(srcRect.right() * 65536) + dstx; + } else { + int dstx = qCeil((tx1 + 0.5 - targetRect.left()) * ix) - 1; + basex = quint32(srcRect.left() * 65536) + dstx; + } + if (sy < 0) { + int dsty = qFloor((ty1 + 0.5 - targetRect.bottom()) * iy) + 1; + srcy = quint32(srcRect.bottom() * 65536) + dsty; + } else { + int dsty = qCeil((ty1 + 0.5 - targetRect.top()) * iy) - 1; + srcy = quint32(srcRect.top() * 65536) + dsty; + } quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1; -- cgit v0.12 From ddc5383e9ab596d42c0f481c0916234c238e8bb5 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 6 Nov 2009 12:43:40 +0100 Subject: don't do unessesary brush comparrisons Reviewed-by: Samuel --- src/gui/painting/qpainter.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 09a4563..4c13d3e 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -3890,14 +3890,6 @@ void QPainter::setBrush(const QBrush &brush) return; } - Qt::BrushStyle currentStyle = d->state->brush.style(); - if (currentStyle == brush.style()) { - if (currentStyle == Qt::NoBrush - || (currentStyle == Qt::SolidPattern - && d->state->brush.color() == brush.color())) - return; - } - d->state->brush = brush; d->state->dirtyFlags |= QPaintEngine::DirtyBrush; } -- cgit v0.12 From 38d316a105e05fa66d57c64df283ab463b5b3aee Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 6 Nov 2009 12:44:34 +0100 Subject: Compile Missing comma in qfontdatabase.cpp Reviewed-by: Gunnar --- src/gui/text/qfontdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 7d17e49..7e93aa0 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -533,7 +533,7 @@ static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { // Vietnamese, { 0, 127 }, // same as latin1 // Other, - { 126, 127 } + { 126, 127 }, // Ogham, { 78, 127 }, // Runic, -- cgit v0.12 From 9b500e9a09907f05002bd0e57869c5312ae101db Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 6 Nov 2009 12:59:35 +0100 Subject: Fix QPainter::setPen(pen with color but no style) on non-extended. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was working with a QImage but not with a QPixmap, which is obviously a bug. In addition, it broke WebCore::GraphicsContext::setPlatformStrokeColor which does exactly what I put in the unittest: get pen, set color, set pen. This commit fixes the wrong color in the underline of the links in http://www.davidfaure.fr/kde/link_underline_color.html in QtWebkit. Merge-request: 1995 Reviewed-by: Samuel Rødal --- src/gui/painting/qpainter.cpp | 17 ++-------------- tests/auto/qpainter/tst_qpainter.cpp | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 4c13d3e..48629d1 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -3787,27 +3787,14 @@ void QPainter::setPen(const QPen &pen) if (d->state->pen == pen) return; + d->state->pen = pen; + if (d->extended) { - d->state->pen = pen; d->checkEmulation(); d->extended->penChanged(); return; } - // Do some checks to see if we are the same pen. - Qt::PenStyle currentStyle = d->state->pen.style(); - if (currentStyle == pen.style() && currentStyle != Qt::CustomDashLine) { - if (currentStyle == Qt::NoPen || - (d->state->pen.isSolid() && pen.isSolid() - && d->state->pen.color() == pen.color() - && d->state->pen.widthF() == pen.widthF() - && d->state->pen.capStyle() == pen.capStyle() - && d->state->pen.joinStyle() == pen.joinStyle() - && d->state->pen.isCosmetic() == pen.isCosmetic())) - return; - } - - d->state->pen = pen; d->state->dirtyFlags |= QPaintEngine::DirtyPen; } diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index bcdbe56..4d2c626 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -239,9 +239,12 @@ private slots: void taskQT4444_dontOverflowDashOffset(); void painterBegin(); + void setPenColorOnImage(); + void setPenColorOnPixmap(); private: void fillData(); + void setPenColor(QPainter& p); QColor baseColor( int k, int intensity=255 ); QImage getResImage( const QString &dir, const QString &addition, const QString &extension ); QBitmap getBitmap( const QString &dir, const QString &filename, bool mask ); @@ -4352,5 +4355,41 @@ void tst_QPainter::painterBegin() QVERIFY(!p.end()); } +void tst_QPainter::setPenColor(QPainter& p) +{ + p.setPen(Qt::NoPen); + + // Setting color, then style + // Should work even though the pen is "NoPen with color", temporarily. + QPen newPen(p.pen()); + newPen.setColor(Qt::red); + QCOMPARE(p.pen().style(), newPen.style()); + QCOMPARE(p.pen().style(), Qt::NoPen); + p.setPen(newPen); + + QCOMPARE(p.pen().color().name(), QString("#ff0000")); + + QPen newPen2(p.pen()); + newPen2.setStyle(Qt::SolidLine); + p.setPen(newPen2); + + QCOMPARE(p.pen().color().name(), QString("#ff0000")); +} + +void tst_QPainter::setPenColorOnImage() +{ + QImage img(QSize(10, 10), QImage::Format_ARGB32_Premultiplied); + QPainter p(&img); + setPenColor(p); +} + +void tst_QPainter::setPenColorOnPixmap() +{ + QPixmap pix(10, 10); + QPainter p(&pix); + setPenColor(p); +} + QTEST_MAIN(tst_QPainter) + #include "tst_qpainter.moc" -- cgit v0.12 From d3b9884b73561ac50bb6aa137a23933a2e4b14d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 5 Nov 2009 11:39:35 +0100 Subject: Fix QT_NO_TOOLBAR Reviewed-by: tom --- src/gui/statemachine/qguistatemachine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp index 1de5ffa..12c0dbe 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/gui/statemachine/qguistatemachine.cpp @@ -266,8 +266,10 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::WhatsThisClicked: return new QWhatsThisClickedEvent(*static_cast(e)); +#ifndef QT_NO_TOOLBAR case QEvent::ToolBarChange: return new QToolBarChangeEvent(*static_cast(e)); +#endif //QT_NO_TOOLBAR case QEvent::ApplicationActivate: return new QEvent(*e); -- cgit v0.12 From 57d34fbffb6e4a6ec650c098315c370342a5c95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 5 Nov 2009 12:45:05 +0100 Subject: Fix QT_NO_STATUSTIP Reviewed-by: paul --- src/gui/statemachine/qguistatemachine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp index 12c0dbe..544a9dc 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/gui/statemachine/qguistatemachine.cpp @@ -238,8 +238,10 @@ static QEvent *cloneEvent(QEvent *e) return new QHelpEvent(*static_cast(e)); case QEvent::WhatsThis: return new QHelpEvent(*static_cast(e)); +#ifndef QT_NO_STATUSTIP case QEvent::StatusTip: return new QStatusTipEvent(*static_cast(e)); +#endif //QT_NO_STATUSTIP #ifndef QT_NO_ACTION case QEvent::ActionChanged: case QEvent::ActionAdded: -- cgit v0.12 From b042eceda6ab46a7e651a30d68aad632791fdc3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 5 Nov 2009 13:08:01 +0100 Subject: Fix QT_NO_TABLETEVENT Reviewed-by: tom --- src/gui/statemachine/qguistatemachine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp index 544a9dc..68f737a 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/gui/statemachine/qguistatemachine.cpp @@ -190,8 +190,10 @@ static QEvent *cloneEvent(QEvent *e) return new QInputMethodEvent(*static_cast(e)); case QEvent::AccessibilityPrepare: return new QEvent(*e); +#ifndef QT_NO_TABLETEVENT case QEvent::TabletMove: return new QTabletEvent(*static_cast(e)); +#endif //QT_NO_TABLETEVENT case QEvent::LocaleChange: return new QEvent(*e); case QEvent::LanguageChange: @@ -200,10 +202,12 @@ static QEvent *cloneEvent(QEvent *e) return new QEvent(*e); case QEvent::Style: return new QEvent(*e); +#ifndef QT_NO_TABLETEVENT case QEvent::TabletPress: return new QTabletEvent(*static_cast(e)); case QEvent::TabletRelease: return new QTabletEvent(*static_cast(e)); +#endif //QT_NO_TABLETEVENT case QEvent::OkRequest: return new QEvent(*e); case QEvent::HelpRequest: @@ -401,9 +405,11 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::DynamicPropertyChange: return new QDynamicPropertyChangeEvent(*static_cast(e)); +#ifndef QT_NO_TABLETEVENT case QEvent::TabletEnterProximity: case QEvent::TabletLeaveProximity: return new QTabletEvent(*static_cast(e)); +#endif //QT_NO_TABLETEVENT case QEvent::NonClientAreaMouseMove: case QEvent::NonClientAreaMouseButtonPress: -- cgit v0.12 From cb2e03d3ea16edf341191e03a7138440d3a7ba22 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 6 Nov 2009 12:58:58 +0100 Subject: Fix fuzzy aliased rendering on GLES2 The GL2 paint engine adds a (0.49,0.49) pixel offset when doing aliased rendering. But this assumed if it was doing aliased rendering then multisampling was disabled. On GLES, multisampling is always enabled if the surface has it enabled. So on GLES, we never add the offset if the surface is multisampled. Reviewed-By: Gunnar --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 14 ++++++++++++-- src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 1527e72..8228c7e 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1203,7 +1203,9 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) ensureActive(); QOpenGL2PaintEngineState *s = state(); - bool doOffset = !(s->renderHints & QPainter::Antialiasing) && style == Qt::SolidPattern; + bool doOffset = !(s->renderHints & QPainter::Antialiasing) && + (style == Qt::SolidPattern) && + !d->multisamplingAlwaysEnabled; if (doOffset) { d->temporaryTransform = s->matrix; @@ -1242,7 +1244,7 @@ void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) ensureActive(); - bool doOffset = !(s->renderHints & QPainter::Antialiasing); + bool doOffset = !(s->renderHints & QPainter::Antialiasing) && !d->multisamplingAlwaysEnabled; if (doOffset) { d->temporaryTransform = s->matrix; QTransform tx = QTransform::fromTranslate(0.49, .49); @@ -1780,6 +1782,14 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) } #endif +#if defined(QT_OPENGL_ES_2) + // OpenGL ES can't switch MSAA off, so if the gl paint device is + // multisampled, it's always multisampled. + d->multisamplingAlwaysEnabled = d->device->format().sampleBuffers(); +#else + d->multisamplingAlwaysEnabled = false; +#endif + return true; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 4cf2a83..9720723 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -277,6 +277,7 @@ public: bool needsSync; bool inRenderText; + bool multisamplingAlwaysEnabled; GLfloat depthRange[2]; -- cgit v0.12 From 654cbdb901386b2a8e168cd52446abdddec1aa28 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 6 Nov 2009 13:03:05 +0100 Subject: Move the check for HWND to be right after the CreateWindow() call By moving the check, it ensures that the error message obtained if it fails is correct and not the error message that SetWindowLong() gives due to an invalid HWND. Merge-request: 1910 Reviewed-by: Denis Dzyubenko --- src/corelib/kernel/qeventdispatcher_win.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index d13e1d1..ccf5b96 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -531,15 +531,16 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch qWinAppInst(), // application 0); // windows creation data. + if (!wnd) { + qWarning("QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: %d\n", (int)GetLastError()); + } + #ifdef GWLP_USERDATA SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)eventDispatcher); #else SetWindowLong(wnd, GWL_USERDATA, (LONG)eventDispatcher); #endif - if (!wnd) { - qWarning("QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: %d\n", (int)GetLastError()); - } return wnd; } -- cgit v0.12 From 33aeddff84e449404787f4be1b53d0fb52060ffb Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 6 Nov 2009 22:04:18 +1000 Subject: Fix error when configuring on Unix using an evaluation license. If you run configure on Unix more than once using an eval license (or -DQT_EVAL), configure outputs an error and fails to overwrite src/corelib/global/qconfig_eval.cpp. This is corrected simply by removing any existing instance of the file before re-creating it. Reviewed-by: Trust Me --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 9c3e417..208bb6b 100755 --- a/configure +++ b/configure @@ -4183,6 +4183,7 @@ elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then fi if [ -n "$EVALKEY" ]; then + rm -f "$outpath/src/corelib/global/qconfig_eval.cpp" cat > "$outpath/src/corelib/global/qconfig_eval.cpp" < Date: Fri, 6 Nov 2009 13:05:32 +0100 Subject: Fixed g++ compiler warnings in qpen.cpp. --- src/gui/painting/qpen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index a57450d..77aa748 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -984,7 +984,7 @@ QDataStream &operator>>(QDataStream &s, QPen &p) QDebug operator<<(QDebug dbg, const QPen &p) { #ifndef Q_BROKEN_DEBUG_STREAM - char *PEN_STYLES[] = { + const char *PEN_STYLES[] = { "NoPen", "SolidLine", "DashLine", -- cgit v0.12 From 19d24c867bfb7b95562e8658b0c795dc0296ba80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 5 Nov 2009 15:39:17 +0100 Subject: Fix QT_NO_GRAPHICSEFFECT Reviewed-by: paul --- src/gui/graphicsview/qgraphicsitem.cpp | 17 +++++++++++++++++ src/gui/graphicsview/qgraphicsitem.h | 2 ++ src/gui/graphicsview/qgraphicsitem_p.h | 5 ++++- src/gui/graphicsview/qgraphicsscene.cpp | 7 ++++++- src/gui/graphicsview/qgraphicsscene_p.h | 4 ++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2fd499d..305fee1 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1336,7 +1336,9 @@ QGraphicsItem::~QGraphicsItem() d_ptr->setParentItemHelper(0); } +#ifndef QT_NO_GRAPHICSEFFECT delete d_ptr->graphicsEffect; +#endif //QT_NO_GRAPHICSEFFECT if (d_ptr->transformData) { for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) { QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i); @@ -2506,7 +2508,9 @@ void QGraphicsItem::setOpacity(qreal opacity) // Update. if (d_ptr->scene) { +#ifndef QT_NO_GRAPHICSEFFECT d_ptr->invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true, /*maybeDirtyClipPath=*/false, @@ -2523,6 +2527,7 @@ void QGraphicsItem::setOpacity(qreal opacity) \since 4.6 */ +#ifndef QT_NO_GRAPHICSEFFECT QGraphicsEffect *QGraphicsItem::graphicsEffect() const { return d_ptr->graphicsEffect; @@ -2569,6 +2574,7 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect) prepareGeometryChange(); } +#endif //QT_NO_GRAPHICSEFFECT /*! \internal @@ -2582,6 +2588,7 @@ 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(); if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) @@ -2598,6 +2605,10 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect() const } return brect; +#else //QT_NO_GRAPHICSEFFECT + return q_ptr->boundingRect(); +#endif //QT_NO_GRAPHICSEFFECT + } /*! @@ -4977,6 +4988,7 @@ int QGraphicsItemPrivate::depth() const /*! \internal */ +#ifndef QT_NO_GRAPHICSEFFECT void QGraphicsItemPrivate::invalidateGraphicsEffectsRecursively() { QGraphicsItemPrivate *itemPrivate = this; @@ -4989,6 +5001,7 @@ void QGraphicsItemPrivate::invalidateGraphicsEffectsRecursively() } } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0)); } +#endif //QT_NO_GRAPHICSEFFECT /*! \internal @@ -5324,7 +5337,9 @@ void QGraphicsItem::update(const QRectF &rect) return; // Make sure we notify effects about invalidated source. +#ifndef QT_NO_GRAPHICSEFFECT d_ptr->invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT if (CacheMode(d_ptr->cacheMode) != NoCache) { // Invalidate cache. @@ -10678,6 +10693,7 @@ int QGraphicsItemGroup::type() const return Type; } +#ifndef QT_NO_GRAPHICSEFFECT QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const { const bool deviceCoordinates = (system == Qt::DeviceCoordinates); @@ -10817,6 +10833,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP return pixmap; } +#endif //QT_NO_GRAPHICSEFFECT #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug debug, QGraphicsItem *item) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index f091e34..84d9eaf 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -225,9 +225,11 @@ public: qreal effectiveOpacity() const; void setOpacity(qreal opacity); +#ifndef QT_NO_GRAPHICSEFFECT // Effect QGraphicsEffect *graphicsEffect() const; void setGraphicsEffect(QGraphicsEffect *effect); +#endif //QT_NO_GRAPHICSEFFECT Qt::MouseButtons acceptedMouseButtons() const; void setAcceptedMouseButtons(Qt::MouseButtons buttons); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 51d2ffd..b914c5c 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -223,7 +223,9 @@ public: bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false, bool ignoreDirtyBit = false, bool ignoreOpacity = false) const; int depth() const; +#ifndef QT_NO_GRAPHICSEFFECT void invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT void invalidateDepthRecursively(); void resolveDepth(); void addChild(QGraphicsItem *child); @@ -577,6 +579,7 @@ struct QGraphicsItemPaintInfo quint32 drawItem : 1; }; +#ifndef QT_NO_GRAPHICSEFFECT class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: @@ -632,7 +635,7 @@ public: QGraphicsItemPaintInfo *info; QTransform lastEffectTransform; }; - +#endif //QT_NO_GRAPHICSEFFECT /*! Returns true if \a item1 is on top of \a item2. diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index dc036f8..c4771c1 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4577,6 +4577,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * if (itemHasChildren && itemClipsChildrenToShape) ENSURE_TRANSFORM_PTR; +#ifndef QT_NO_GRAPHICSEFFECT if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) { ENSURE_TRANSFORM_PTR; QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp, @@ -4599,7 +4600,9 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * item->d_ptr->graphicsEffect->draw(painter, source); painter->setWorldTransform(restoreTransform); sourced->info = 0; - } else { + } else +#endif //QT_NO_GRAPHICSEFFECT + { draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity, effectTransform, wasDirtyParentSceneTransform, drawItem); } @@ -4768,10 +4771,12 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b QGraphicsItem *p = item->d_ptr->parent; while (p) { p->d_ptr->dirtyChildren = 1; +#ifndef QT_NO_GRAPHICSEFFECT if (p->d_ptr->graphicsEffect && p->d_ptr->graphicsEffect->isEnabled()) { p->d_ptr->dirty = 1; p->d_ptr->fullUpdatePending = 1; } +#endif //QT_NO_GRAPHICSEFFECT p = p->d_ptr->parent; } } diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index f8db084..a2a1ee1 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -234,6 +234,7 @@ public: item->d_ptr->fullUpdatePending = 0; item->d_ptr->ignoreVisible = 0; item->d_ptr->ignoreOpacity = 0; +#ifndef QT_NO_GRAPHICSEFFECT QGraphicsEffect::ChangeFlags flags; if (item->d_ptr->notifyBoundingRectChanged) { flags |= QGraphicsEffect::SourceBoundingRectChanged; @@ -243,12 +244,15 @@ public: flags |= QGraphicsEffect::SourceInvalidated; item->d_ptr->notifyInvalidated = 0; } +#endif //QT_NO_GRAPHICSEFFECT if (recursive) { for (int i = 0; i < item->d_ptr->children.size(); ++i) resetDirtyItem(item->d_ptr->children.at(i), recursive); } +#ifndef QT_NO_GRAPHICSEFFECT if (flags && item->d_ptr->graphicsEffect) item->d_ptr->graphicsEffect->sourceChanged(flags); +#endif //QT_NO_GRAPHICSEFFECT } inline void ensureSortedTopLevelItems() -- cgit v0.12 From 4bbcfc85eb69f7a04b1ec4264ded855be0df46d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Nov 2009 10:28:16 +0100 Subject: Fix QT_NO_DATESTRING Reviewed-by: tom --- src/corelib/global/qlibraryinfo.cpp | 2 ++ src/corelib/global/qlibraryinfo.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 15a06d7..15325ae 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -212,11 +212,13 @@ QLibraryInfo::buildKey() Returns the installation date for this build of Qt. The install date will usually be the last time that Qt sources were configured. */ +#ifndef QT_NO_DATESTRING QDate QLibraryInfo::buildDate() { return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate); } +#endif //QT_NO_DATESTRING /*! Returns the location specified by \a loc. diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 88e8566..f65051d 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -60,7 +60,9 @@ public: static QString licensedProducts(); static QString buildKey(); +#ifndef QT_NO_DATESTRING static QDate buildDate(); +#endif //QT_NO_DATESTRING enum LibraryLocation { -- cgit v0.12 From 628a0d9d54f50a9e75cb8f26e4927231a2130e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Nov 2009 10:28:52 +0100 Subject: Fix QT_NO_SHORTCUT Reviewed-by: Harald Fernengel --- src/gui/statemachine/qguistatemachine.cpp | 2 ++ src/plugins/accessible/widgets/simplewidgets.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp index 68f737a..4db10ca 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/gui/statemachine/qguistatemachine.cpp @@ -255,8 +255,10 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::FileOpen: return new QFileOpenEvent(*static_cast(e)); +#ifndef QT_NO_SHORTCUT case QEvent::Shortcut: return new QShortcutEvent(*static_cast(e)); +#endif //QT_NO_SHORTCUT case QEvent::ShortcutOverride: return new QKeyEvent(*static_cast(e)); diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index aa51759..e0e20db 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -256,9 +256,9 @@ QString QAccessibleButton::localizedName(int actionIndex) QStringList QAccessibleButton::keyBindings(int actionIndex) { switch (actionIndex) { -#ifdef QT_NO_SHORTCUT +#ifndef QT_NO_SHORTCUT case 0: - return button()->shortcut().toString(); + return QStringList() << button()->shortcut().toString(); #endif default: return QStringList(); -- cgit v0.12 From 7713d95161bf986bb9dbd3e7a9033ce2e29b7213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Nov 2009 11:43:44 +0100 Subject: Fix QT_NO_MENUBAR Reviewed-by: tom --- src/gui/widgets/qmenu.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 1b5d1cd..c567955 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1878,9 +1878,11 @@ void QMenu::popup(const QPoint &p, QAction *atAction) if(snapToMouse) //position flowing left from the mouse pos.setX(mouse.x()-size.width()); +#ifndef QT_NO_MENUBAR //if in a menubar, it should be right-aligned if (qobject_cast(d->causedPopup.widget)) pos.rx() -= size.width(); +#endif //QT_NO_MENUBAR if (pos.x() < screen.left()+desktopFrame) pos.setX(qMax(p.x(), screen.left()+desktopFrame)); -- cgit v0.12 From 3cbf477c7b71771a71fed920800a9938abc3c001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Nov 2009 11:55:28 +0100 Subject: Fix QT_NO_WHATSTHIS Reviewed-by: tom --- src/gui/statemachine/qguistatemachine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp index 4db10ca..2ae13f3 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/gui/statemachine/qguistatemachine.cpp @@ -271,8 +271,10 @@ static QEvent *cloneEvent(QEvent *e) break; #endif +#ifndef QT_NO_WHATSTHIS case QEvent::WhatsThisClicked: return new QWhatsThisClickedEvent(*static_cast(e)); +#endif //QT_NO_WHATSTHIS #ifndef QT_NO_TOOLBAR case QEvent::ToolBarChange: -- cgit v0.12 From 55b27267a6a21d15c3a505668aefed824d5cdf4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Nov 2009 12:43:29 +0100 Subject: Fix QT_NO_WHEELEVENT Reviewed-by: Trust Me --- src/gui/statemachine/qguistatemachine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp index 2ae13f3..4f7806f 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/gui/statemachine/qguistatemachine.cpp @@ -106,8 +106,10 @@ static QEvent *cloneEvent(QEvent *e) return new QEvent(*e); case QEvent::HideToParent: return new QEvent(*e); +#ifndef QT_NO_WHEELEVENT case QEvent::Wheel: return new QWheelEvent(*static_cast(e)); +#endif //QT_NO_WHEELEVENT case QEvent::WindowTitleChange: return new QEvent(*e); case QEvent::WindowIconChange: -- cgit v0.12 From 1edc42765fa922a4d89a64d5edce2af27b72713b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 6 Nov 2009 13:20:51 +0100 Subject: Add documentation for the new min/pref/maxSize properties. --- src/gui/graphicsview/qgraphicswidget.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index d70a281..6f910c7 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -410,6 +410,27 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) */ /*! + \property QGraphicsWidget::minimumSize + \brief the minimum size of the widget + + \sa setMinimumSize(), minimumSize(), preferredSize, maximumSize +*/ + +/*! + \property QGraphicsWidget::preferredSize + \brief the preferred size of the widget + + \sa setPreferredSize(), preferredSize(), minimumSize, maximumSize +*/ + +/*! + \property QGraphicsWidget::maximumSize + \brief the maximum size of the widget + + \sa setMaximumSize(), maximumSize(), minimumSize, preferredSize +*/ + +/*! Sets the widget's contents margins to \a left, \a top, \a right and \a bottom. -- cgit v0.12 From 2c0108ee5aa1cd21c9f3aee23e1d9eec71d600e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 6 Nov 2009 13:21:54 +0100 Subject: Use 0 instead of NULL. --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 7ad994c..96f8930 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -966,8 +966,8 @@ void QGraphicsAnchorLayoutPrivate::deleteLayoutEdges() { Q_Q(QGraphicsAnchorLayout); - Q_ASSERT(internalVertex(q, Qt::AnchorHorizontalCenter) == NULL); - Q_ASSERT(internalVertex(q, Qt::AnchorVerticalCenter) == NULL); + Q_ASSERT(!internalVertex(q, Qt::AnchorHorizontalCenter)); + Q_ASSERT(!internalVertex(q, Qt::AnchorVerticalCenter)); removeAnchor_helper(internalVertex(q, Qt::AnchorLeft), internalVertex(q, Qt::AnchorRight)); @@ -2036,7 +2036,7 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin // Look for the layout edge. That can be either the first half in case the // layout is split in two, or the whole layout anchor. Orientation orient = Orientation(anchors.first()->orientation); - AnchorData *layoutEdge = NULL; + AnchorData *layoutEdge = 0; if (layoutCentralVertex[orient]) { layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]); } else { @@ -2047,7 +2047,7 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin // set back the variable to NULL to prevent the continue condition from being // satisfied in the loop below. if (layoutEdge->maxSize < QWIDGETSIZE_MAX) - layoutEdge = NULL; + layoutEdge = 0; } // For each variable, create constraints based on size hints @@ -2111,8 +2111,8 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation) { Q_ASSERT(layoutFirstVertex[orientation] && layoutLastVertex[orientation]); - AnchorData *edgeL1 = NULL; - AnchorData *edgeL2 = NULL; + AnchorData *edgeL1 = 0; + AnchorData *edgeL2 = 0; // The layout may have a single anchor between Left and Right or two half anchors // passing through the center -- cgit v0.12 From cb81b4d699f1d009591fb452f5f8f99a70c51571 Mon Sep 17 00:00:00 2001 From: gunnar Date: Wed, 4 Nov 2009 19:38:01 +0100 Subject: Added some helpful info to QBrush and QPen's QDebug operators Reviewed-by: TrustMe --- src/gui/painting/qbrush.cpp | 24 +++++++++++++++++++++++- src/gui/painting/qpen.cpp | 12 +++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index cbfbba6..6f5d892 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -970,7 +970,29 @@ bool QBrush::operator==(const QBrush &b) const QDebug operator<<(QDebug dbg, const QBrush &b) { #ifndef Q_BROKEN_DEBUG_STREAM - dbg.nospace() << "QBrush(" << b.color() << ',' << b.style() << ')'; + char *BRUSH_STYLES[] = { + "NoBrush", + "SolidPattern", + "Dense1Pattern", + "Dense2Pattern", + "Dense3Pattern", + "Dense4Pattern", + "Dense5Pattern", + "Dense6Pattern", + "Dense7Pattern", + "HorPattern", + "VerPattern", + "CrossPattern", + "BDiagPattern", + "FDiagPattern", + "DiagCrossPattern", + "LinearGradientPattern", + "RadialGradientPattern", + "ConicalGradientPattern", + "TexturePattern" + }; + + dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')'; return dbg.space(); #else qWarning("This compiler doesn't support streaming QBrush to QDebug"); diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 41efc80..9746747 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -983,8 +983,18 @@ QDataStream &operator>>(QDataStream &s, QPen &p) QDebug operator<<(QDebug dbg, const QPen &p) { #ifndef Q_BROKEN_DEBUG_STREAM + char *PEN_STYLES[] = { + "NoPen", + "SolidLine", + "DashLine", + "DotLine", + "DashDotLine", + "DashDotDotLine", + "CustomDashLine" + }; + dbg.nospace() << "QPen(" << p.width() << ',' << p.brush() - << ',' << int(p.style()) << ',' << int(p.capStyle()) + << ',' << PEN_STYLES[p.style()] << ',' << int(p.capStyle()) << ',' << int(p.joinStyle()) << ',' << p.dashPattern() << ',' << p.dashOffset() << ',' << p.miterLimit() << ')'; -- cgit v0.12 From cb356372ff0e8e0e3b4f2969562642b208807cad Mon Sep 17 00:00:00 2001 From: gunnar Date: Wed, 4 Nov 2009 21:02:10 +0100 Subject: Made QPen== catch QPen(Qt::NoPen) == QPen(QBrush(Qt::NoBrush)) QSvgDocument uses the latter as default pen so every svg filling command would issue a penChange without this. Reviewed-by: TrustMe --- src/gui/painting/qpen.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 9746747..1ddadf2 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -835,16 +835,19 @@ bool QPen::operator==(const QPen &p) const { QPenData *dd = static_cast(d); QPenData *pdd = static_cast(p.d); - return (p.d == d) || (p.d->style == d->style - && p.d->capStyle == d->capStyle - && p.d->joinStyle == d->joinStyle - && p.d->width == d->width - && pdd->miterLimit == dd->miterLimit - && (d->style != Qt::CustomDashLine - || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) && - pdd->dashPattern == dd->dashPattern)) - && p.d->brush == d->brush - && pdd->cosmetic == dd->cosmetic); + return (p.d == d) + || (p.d->style == d->style + && p.d->capStyle == d->capStyle + && p.d->joinStyle == d->joinStyle + && p.d->width == d->width + && pdd->miterLimit == dd->miterLimit + && (d->style != Qt::CustomDashLine + || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) && + pdd->dashPattern == dd->dashPattern)) + && p.d->brush == d->brush + && pdd->cosmetic == dd->cosmetic) + || ((p.d->style == Qt::NoPen || p.d->brush.style() == Qt::NoBrush) + && (d->style == Qt::NoPen || d->brush.style() == Qt::NoBrush)); } -- cgit v0.12 From a7c0ca402177b21cca4d5d6b9c5ff407984e1be9 Mon Sep 17 00:00:00 2001 From: gunnar Date: Wed, 4 Nov 2009 21:06:29 +0100 Subject: Fixed some debug and some minor optims to QPaintBuffer Reviewed-by: TrustMe --- src/gui/painting/qpaintbuffer.cpp | 95 +++++++++++++++++++++++---------------- src/gui/painting/qpaintbuffer_p.h | 5 ++- 2 files changed, 60 insertions(+), 40 deletions(-) diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index 6b9d77c..b8700c3 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -48,7 +48,7 @@ #include -//#define QPAINTBUFFER_DEBUG_DRAW +// #define QPAINTBUFFER_DEBUG_DRAW QT_BEGIN_NAMESPACE @@ -247,23 +247,24 @@ void QPaintBuffer::draw(QPainter *painter, int frame) const #ifdef QPAINTBUFFER_DEBUG_DRAW qDebug() << "QPaintBuffer::draw() --------------------------------"; -// printf("Float buffer:"); -// for (int i=0; ifloats.size(); i++) { -// if ((i % 10) == 0) { -// printf("\n%4d-%4d: ", i, i+9); -// } -// printf("%4.2f ", d->floats[i]); -// } -// printf("\n"); - -// printf("Int Buffer:"); -// for (int i=0; iints.size(); i++) { -// if ((i % 10) == 0) { -// printf("\n%4d-%4d: ", i, i+10); -// } -// printf("%5d", d->ints[i]); -// } -// printf("\n"); + Q_D(const QPaintBuffer); + printf("Float buffer:"); + for (int i=0; ifloats.size(); i++) { + if ((i % 10) == 0) { + printf("\n%4d-%4d: ", i, i+9); + } + printf("%4.2f ", d->floats[i]); + } + printf("\n"); + + printf("Int Buffer:"); + for (int i=0; iints.size(); i++) { + if ((i % 10) == 0) { + printf("\n%4d-%4d: ", i, i+10); + } + printf("%5d", d->ints[i]); + } + printf("\n"); #endif if (painter && !painter->isActive()) @@ -406,16 +407,17 @@ void QPaintBufferEngine::clipEnabledChanged() void QPaintBufferEngine::penChanged() { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine:" << state()->pen; -#endif const QPen &pen = state()->pen; if (!buffer->commands.isEmpty() && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetPen) { +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << "QPaintBufferEngine: penChanged (compressed)" << state()->pen; +#endif buffer->variants[buffer->commands.last().offset] = pen; return; } + if (buffer->calculateBoundingRect) { if (pen.style() == Qt::NoPen) { buffer->penWidthAdjustment = 0; @@ -427,22 +429,28 @@ void QPaintBufferEngine::penChanged() buffer->penWidthAdjustment = transformedWidth.x() / 2.0; } } +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << "QPaintBufferEngine: penChanged" << state()->pen; +#endif buffer->addCommand(QPaintBufferPrivate::Cmd_SetPen, pen); } void QPaintBufferEngine::brushChanged() { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine:" << state()->brush; -#endif const QBrush &brush = state()->brush; if (!buffer->commands.isEmpty() && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetBrush) { +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << "QPaintBufferEngine: brushChanged (compressed)" << state()->brush; +#endif buffer->variants[buffer->commands.last().offset] = brush; return; } +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << "QPaintBufferEngine: brushChanged" << state()->brush; +#endif buffer->addCommand(QPaintBufferPrivate::Cmd_SetBrush, brush); } @@ -488,14 +496,14 @@ void QPaintBufferEngine::transformChanged() if (!buffer->commands.isEmpty() && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetTransform) { #ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: compressing " << state()->matrix; + qDebug() << "QPaintBufferEngine: transformChanged (compressing) " << state()->matrix; #endif buffer->variants[buffer->commands.last().offset] = state()->matrix; return; } #ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: " << state()->matrix; + qDebug() << "QPaintBufferEngine: transformChanged:" << state()->matrix; #endif buffer->addCommand(QPaintBufferPrivate::Cmd_SetTransform, state()->matrix); } @@ -514,7 +522,18 @@ void QPaintBufferEngine::draw(const QVectorPath &path) #ifdef QPAINTBUFFER_DEBUG_DRAW qDebug() << "QPaintBufferEngine: draw vpath:" << path.elementCount(); #endif - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawVectorPath, path); + + bool hasBrush = qbrush_style(state()->brush) != Qt::NoBrush; + bool hasPen = qpen_style(state()->pen) != Qt::NoPen + && qbrush_style(qpen_brush(state()->pen)) != Qt::NoBrush; + + if (hasPen || hasBrush) + buffer->addCommand(QPaintBufferPrivate::Cmd_DrawVectorPath, path); +#ifdef QPAINTBUFFER_DEBUG_DRAW + else + qDebug() << " - no pen or brush active, discarded...\n"; +#endif + // if (buffer->calculateBoundingRect) { // QRealRect r = path.controlPointRect(); // buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1)); @@ -745,15 +764,15 @@ void QPaintBufferEngine::drawEllipse(const QRect &r) void QPaintBufferEngine::drawPath(const QPainterPath &path) { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawPath: element count:" << path.elementCount(); -#endif - // ### Path -> QVariant - // buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPath, QVariant(path)); +// #ifdef QPAINTBUFFER_DEBUG_DRAW +// qDebug() << "QPaintBufferEngine: drawPath: element count:" << path.elementCount(); +// #endif +// // ### Path -> QVariant +// // buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPath, QVariant(path)); QPaintEngineEx::drawPath(path); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(path.boundingRect()); +// if (buffer->calculateBoundingRect) +// buffer->updateBoundingRect(path.boundingRect()); } void QPaintBufferEngine::drawPoints(const QPoint *points, int pointCount) @@ -1424,10 +1443,6 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd) QTextItemInt &ti = (*tiCopy)(); QString text(ti.text()); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawTextItem:" << pos << " " << text << " " << scaleFactor; -#endif - QFont font(ti.font()); font.setUnderline(false); font.setStrikeOut(false); @@ -1439,6 +1454,10 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd) justificationWidth = si.width.toReal(); qreal scaleFactor = font.d->dpi/qreal(qt_defaultDpiY()); +#ifdef QPAINTBUFFER_DEBUG_DRAW + qDebug() << " -> Cmd_DrawTextItem:" << pos << " " << text << " " << scaleFactor; +#endif + if (scaleFactor != 1.0) { QFont fnt(font); QFakeDevice fake; diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h index 6a7ac73..adf0564 100644 --- a/src/gui/painting/qpaintbuffer_p.h +++ b/src/gui/painting/qpaintbuffer_p.h @@ -66,6 +66,7 @@ class QPaintBufferPlayback; class Q_GUI_EXPORT QPaintBuffer : public QPaintDevice { + Q_DECLARE_PRIVATE(QPaintBuffer); public: QPaintBuffer(); QPaintBuffer(const QPaintBuffer &other); @@ -311,7 +312,7 @@ public: virtual ~QPainterReplayer() { } void setupTransform(QPainter *painter); - void process(const QPaintBufferCommand &cmd); + virtual void process(const QPaintBufferCommand &cmd); void draw(const QPaintBuffer &buffer, QPainter *painter, int frame); protected: @@ -326,7 +327,7 @@ class Q_GUI_EXPORT QPaintEngineExReplayer : public QPainterReplayer public: QPaintEngineExReplayer() { } - void process(const QPaintBufferCommand &cmd); + virtual void process(const QPaintBufferCommand &cmd); }; class QPaintBufferEnginePrivate; -- cgit v0.12 From b987057236099e6c6ccd8a354725bf1730b3ebd8 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 5 Nov 2009 10:25:12 +1000 Subject: Modify QGLShader and QGLShaderProgram in response to API review Reviewed-by: Sarah Smith --- demos/boxes/scene.cpp | 34 +-- .../snippets/code/src_opengl_qglshaderprogram.cpp | 15 +- examples/opengl/hellogl_es2/glwidget.cpp | 30 ++- examples/opengl/textures/glwidget.cpp | 12 +- .../gl2paintengineex/qglengineshadermanager.cpp | 26 +- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 4 +- src/opengl/qglshaderprogram.cpp | 298 ++++++++++++--------- src/opengl/qglshaderprogram.h | 43 +-- src/opengl/qwindowsurface_gl.cpp | 2 +- 9 files changed, 257 insertions(+), 207 deletions(-) diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp index a06e8a1..06dc0f9 100644 --- a/demos/boxes/scene.cpp +++ b/demos/boxes/scene.cpp @@ -552,14 +552,15 @@ void Scene::initGL() { m_box = new GLRoundedBox(0.25f, 1.0f, 10); - m_vertexShader = new QGLShader(":/res/boxes/basic.vsh", QGLShader::VertexShader); + m_vertexShader = new QGLShader(QGLShader::Vertex); + m_vertexShader->compileSourceFile(QLatin1String(":/res/boxes/basic.vsh")); QStringList list; list << ":/res/boxes/cubemap_posx.jpg" << ":/res/boxes/cubemap_negx.jpg" << ":/res/boxes/cubemap_posy.jpg" << ":/res/boxes/cubemap_negy.jpg" << ":/res/boxes/cubemap_posz.jpg" << ":/res/boxes/cubemap_negz.jpg"; m_environment = new GLTextureCube(list, qMin(1024, m_maxTextureSize)); - m_environmentShader = new QGLShader(QGLShader::FragmentShader); - m_environmentShader->compile(environmentShaderText); + m_environmentShader = new QGLShader(QGLShader::Fragment); + m_environmentShader->compileSourceCode(environmentShaderText); m_environmentProgram = new QGLShaderProgram; m_environmentProgram->addShader(m_vertexShader); m_environmentProgram->addShader(m_environmentShader); @@ -616,7 +617,8 @@ void Scene::initGL() files = QDir(":/res/boxes/").entryInfoList(filter, QDir::Files | QDir::Readable); foreach (QFileInfo file, files) { QGLShaderProgram *program = new QGLShaderProgram; - QGLShader* shader = new QGLShader(file.absoluteFilePath(), QGLShader::FragmentShader); + QGLShader* shader = new QGLShader(QGLShader::Fragment); + shader->compileSourceFile(file.absoluteFilePath()); // The program does not take ownership over the shaders, so store them in a vector so they can be deleted afterwards. program->addShader(m_vertexShader); program->addShader(shader); @@ -638,9 +640,9 @@ void Scene::initGL() m_programs << program; m_renderOptions->addShader(file.baseName()); - program->enable(); + program->bind(); m_cubemaps << ((program->uniformLocation("env") != -1) ? new GLRenderTargetCube(qMin(256, m_maxTextureSize)) : 0); - program->disable(); + program->release(); } if (m_programs.size() == 0) @@ -697,12 +699,12 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) // Don't render the environment if the environment texture can't be set for the correct sampler. if (glActiveTexture) { m_environment->bind(); - m_environmentProgram->enable(); + m_environmentProgram->bind(); m_environmentProgram->setUniformValue("tex", GLint(0)); m_environmentProgram->setUniformValue("env", GLint(1)); m_environmentProgram->setUniformValue("noise", GLint(2)); m_box->draw(); - m_environmentProgram->disable(); + m_environmentProgram->release(); m_environment->unbind(); } @@ -730,14 +732,14 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) else m_environment->bind(); } - m_programs[i]->enable(); + m_programs[i]->bind(); m_programs[i]->setUniformValue("tex", GLint(0)); m_programs[i]->setUniformValue("env", GLint(1)); m_programs[i]->setUniformValue("noise", GLint(2)); m_programs[i]->setUniformValue("view", view); m_programs[i]->setUniformValue("invView", invView); m_box->draw(); - m_programs[i]->disable(); + m_programs[i]->release(); if (glActiveTexture) { if (m_dynamicCubemap && m_cubemaps[i]) @@ -760,14 +762,14 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) m_environment->bind(); } - m_programs[m_currentShader]->enable(); + m_programs[m_currentShader]->bind(); m_programs[m_currentShader]->setUniformValue("tex", GLint(0)); m_programs[m_currentShader]->setUniformValue("env", GLint(1)); m_programs[m_currentShader]->setUniformValue("noise", GLint(2)); m_programs[m_currentShader]->setUniformValue("view", view); m_programs[m_currentShader]->setUniformValue("invView", invView); m_box->draw(); - m_programs[m_currentShader]->disable(); + m_programs[m_currentShader]->release(); if (glActiveTexture) { if (m_dynamicCubemap) @@ -1046,9 +1048,9 @@ void Scene::setColorParameter(const QString &name, QRgb color) { // set the color in all programs foreach (QGLShaderProgram *program, m_programs) { - program->enable(); + program->bind(); program->setUniformValue(program->uniformLocation(name), QColor(color)); - program->disable(); + program->release(); } } @@ -1056,9 +1058,9 @@ void Scene::setFloatParameter(const QString &name, float value) { // set the color in all programs foreach (QGLShaderProgram *program, m_programs) { - program->enable(); + program->bind(); program->setUniformValue(program->uniformLocation(name), value); - program->disable(); + program->release(); } } diff --git a/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp b/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp index 2997297..9a15f19 100644 --- a/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp +++ b/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp @@ -40,32 +40,32 @@ ****************************************************************************/ //! [0] -QGLShader shader(QGLShader::VertexShader); -shader.compile(code); +QGLShader shader(QGLShader::Vertex); +shader.compileSourceCode(code); QGLShaderProgram program(context); program.addShader(shader); program.link(); -program.enable(); +program.bind(); //! [0] //! [1] -program.addShader(QGLShader::VertexShader, +program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec4 vertex;\n" "attribute mediump mat4 matrix;\n" "void main(void)\n" "{\n" " gl_Position = matrix * vertex;\n" "}"); -program.addShader(QGLShader::FragmentShader, +program.addShaderFromSourceCode(QGLShader::Fragment, "uniform mediump vec4 color;\n" "void main(void)\n" "{\n" " gl_FragColor = color;\n" "}"); program.link(); -program.enable(); +program.bind(); int vertexLocation = program.attributeLocation("vertex"); int matrixLocation = program.attributeLocation("matrix"); @@ -84,9 +84,12 @@ QColor color(0, 255, 0, 255); QMatrix4x4 pmvMatrix; pmvMatrix.ortho(rect()); +program.enableAttributeArray(vertexLocation); program.setAttributeArray(vertexLocation, triangleVertices, 3); program.setUniformValue(matrixLocation, pmvMatrix); program.setUniformValue(colorLocation, color); glDrawArrays(GL_TRIANGLES, 0, 3); + +program.disableAttributeArray(vertexLocation); //! [2] diff --git a/examples/opengl/hellogl_es2/glwidget.cpp b/examples/opengl/hellogl_es2/glwidget.cpp index a31c34a..08e887a 100644 --- a/examples/opengl/hellogl_es2/glwidget.cpp +++ b/examples/opengl/hellogl_es2/glwidget.cpp @@ -92,6 +92,8 @@ void GLWidget::showBubbles(bool bubbles) void GLWidget::paintQtLogo() { + program1.enableAttributeArray(normalAttr1); + program1.enableAttributeArray(vertexAttr1); program1.setAttributeArray(vertexAttr1, vertices.constData()); program1.setAttributeArray(normalAttr1, normals.constData()); glDrawArrays(GL_TRIANGLES, 0, vertices.size()); @@ -159,6 +161,10 @@ void GLWidget::paintTexturedCube() program2.setUniformValue(textureUniform2, 0); // use texture unit 0 + program2.enableAttributeArray(vertexAttr2); + program2.enableAttributeArray(normalAttr2); + program2.enableAttributeArray(texCoordAttr2); + glDrawArrays(GL_TRIANGLES, 0, 36); program2.disableAttributeArray(vertexAttr2); @@ -173,7 +179,7 @@ void GLWidget::initializeGL () glGenTextures(1, &m_uiTexture); m_uiTexture = bindTexture(QImage(":/qt.png")); - QGLShader *vshader1 = new QGLShader(QGLShader::VertexShader, this); + QGLShader *vshader1 = new QGLShader(QGLShader::Vertex, this); const char *vsrc1 = "attribute highp vec4 vertex;\n" "attribute mediump vec3 normal;\n" @@ -188,16 +194,16 @@ void GLWidget::initializeGL () " color = clamp(color, 0.0, 1.0);\n" " gl_Position = matrix * vertex;\n" "}\n"; - vshader1->compile(vsrc1); + vshader1->compileSourceCode(vsrc1); - QGLShader *fshader1 = new QGLShader(QGLShader::FragmentShader, this); + QGLShader *fshader1 = new QGLShader(QGLShader::Fragment, this); const char *fsrc1 = "varying mediump vec4 color;\n" "void main(void)\n" "{\n" " gl_FragColor = color;\n" "}\n"; - fshader1->compile(fsrc1); + fshader1->compileSourceCode(fsrc1); program1.addShader(vshader1); program1.addShader(fshader1); @@ -207,7 +213,7 @@ void GLWidget::initializeGL () normalAttr1 = program1.attributeLocation("normal"); matrixUniform1 = program1.uniformLocation("matrix"); - QGLShader *vshader2 = new QGLShader(QGLShader::VertexShader); + QGLShader *vshader2 = new QGLShader(QGLShader::Vertex); const char *vsrc2 = "attribute highp vec4 vertex;\n" "attribute highp vec4 texCoord;\n" @@ -222,9 +228,9 @@ void GLWidget::initializeGL () " gl_Position = matrix * vertex;\n" " texc = texCoord;\n" "}\n"; - vshader2->compile(vsrc2); + vshader2->compileSourceCode(vsrc2); - QGLShader *fshader2 = new QGLShader(QGLShader::FragmentShader); + QGLShader *fshader2 = new QGLShader(QGLShader::Fragment); const char *fsrc2 = "varying highp vec4 texc;\n" "uniform sampler2D tex;\n" @@ -235,7 +241,7 @@ void GLWidget::initializeGL () " color = color * 0.2 + color * 0.8 * angle;\n" " gl_FragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n" "}\n"; - fshader2->compile(fsrc2); + fshader2->compileSourceCode(fsrc2); program2.addShader(vshader2); program2.addShader(fshader2); @@ -284,15 +290,15 @@ void GLWidget::paintGL() modelview.translate(0.0f, -0.2f, 0.0f); if (qtLogo) { - program1.enable(); + program1.bind(); program1.setUniformValue(matrixUniform1, modelview); paintQtLogo(); - program1.disable(); + program1.release(); } else { - program2.enable(); + program2.bind(); program1.setUniformValue(matrixUniform2, modelview); paintTexturedCube(); - program2.disable(); + program2.release(); } glDisable(GL_DEPTH_TEST); diff --git a/examples/opengl/textures/glwidget.cpp b/examples/opengl/textures/glwidget.cpp index 6efd31a..0f50e2d 100644 --- a/examples/opengl/textures/glwidget.cpp +++ b/examples/opengl/textures/glwidget.cpp @@ -99,7 +99,7 @@ void GLWidget::initializeGL() #define PROGRAM_VERTEX_ATTRIBUTE 0 #define PROGRAM_TEXCOORD_ATTRIBUTE 1 - QGLShader *vshader = new QGLShader(QGLShader::VertexShader, this); + QGLShader *vshader = new QGLShader(QGLShader::Vertex, this); const char *vsrc = "attribute highp vec4 vertex;\n" "attribute mediump vec4 texCoord;\n" @@ -110,9 +110,9 @@ void GLWidget::initializeGL() " gl_Position = matrix * vertex;\n" " texc = texCoord;\n" "}\n"; - vshader->compile(vsrc); + vshader->compileSourceCode(vsrc); - QGLShader *fshader = new QGLShader(QGLShader::FragmentShader, this); + QGLShader *fshader = new QGLShader(QGLShader::Fragment, this); const char *fsrc = "uniform sampler2D texture;\n" "varying mediump vec4 texc;\n" @@ -120,7 +120,7 @@ void GLWidget::initializeGL() "{\n" " gl_FragColor = texture2D(texture, texc.st);\n" "}\n"; - fshader->compile(fsrc); + fshader->compileSourceCode(fsrc); program = new QGLShaderProgram(this); program->addShader(vshader); @@ -129,7 +129,7 @@ void GLWidget::initializeGL() program->bindAttributeLocation("texCoord", PROGRAM_TEXCOORD_ATTRIBUTE); program->link(); - program->enable(); + program->bind(); program->setUniformValue("texture", 0); #endif @@ -163,6 +163,8 @@ void GLWidget::paintGL() m.rotate(zRot / 16.0f, 0.0f, 0.0f, 1.0f); program->setUniformValue("matrix", m); + program->enableAttributeArray(PROGRAM_VERTEX_ATTRIBUTE); + program->enableAttributeArray(PROGRAM_TEXCOORD_ATTRIBUTE); program->setAttributeArray (PROGRAM_VERTEX_ATTRIBUTE, vertices.constData()); program->setAttributeArray diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 40a6241..8a8f483 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -169,14 +169,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) source.clear(); source.append(qShaderSnippets[MainVertexShader]); source.append(qShaderSnippets[PositionOnlyVertexShader]); - vertexShader = new QGLShader(QGLShader::VertexShader, context, this); - vertexShader->compile(source); + vertexShader = new QGLShader(QGLShader::Vertex, context, this); + vertexShader->compileSourceCode(source); source.clear(); source.append(qShaderSnippets[MainFragmentShader]); source.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); - fragShader = new QGLShader(QGLShader::FragmentShader, context, this); - fragShader->compile(source); + fragShader = new QGLShader(QGLShader::Fragment, context, this); + fragShader->compileSourceCode(source); simpleShaderProg = new QGLShaderProgram(context, this); simpleShaderProg->addShader(vertexShader); @@ -192,14 +192,14 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) source.clear(); source.append(qShaderSnippets[MainWithTexCoordsVertexShader]); source.append(qShaderSnippets[UntransformedPositionVertexShader]); - vertexShader = new QGLShader(QGLShader::VertexShader, context, this); - vertexShader->compile(source); + vertexShader = new QGLShader(QGLShader::Vertex, context, this); + vertexShader->compileSourceCode(source); source.clear(); source.append(qShaderSnippets[MainFragmentShader]); source.append(qShaderSnippets[ImageSrcFragmentShader]); - fragShader = new QGLShader(QGLShader::FragmentShader, context, this); - fragShader->compile(source); + fragShader = new QGLShader(QGLShader::Fragment, context, this); + fragShader->compileSourceCode(source); blitShaderProg = new QGLShaderProgram(context, this); blitShaderProg->addShader(vertexShader); @@ -243,14 +243,14 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS source.append(qShaderSnippets[prog.compositionFragShader]); if (prog.maskFragShader) source.append(qShaderSnippets[prog.maskFragShader]); - QGLShader* fragShader = new QGLShader(QGLShader::FragmentShader, ctxGuard.context(), this); - fragShader->compile(source); + QGLShader* fragShader = new QGLShader(QGLShader::Fragment, ctxGuard.context(), this); + fragShader->compileSourceCode(source); source.clear(); source.append(qShaderSnippets[prog.mainVertexShader]); source.append(qShaderSnippets[prog.positionVertexShader]); - QGLShader* vertexShader = new QGLShader(QGLShader::VertexShader, ctxGuard.context(), this); - vertexShader->compile(source); + QGLShader* vertexShader = new QGLShader(QGLShader::Vertex, ctxGuard.context(), this); + vertexShader->compileSourceCode(source); #if defined(QT_DEBUG) // Name the shaders for easier debugging @@ -673,7 +673,7 @@ bool QGLEngineShaderManager::useCorrectShaderProg() currentShaderProg = sharedShaders->findProgramInCache(requiredProgram); if (currentShaderProg) { - currentShaderProg->program->enable(); + currentShaderProg->program->bind(); if (useCustomSrc) customSrcStage->setUniforms(currentShaderProg->program); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index a9744b3..d20700f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -246,7 +246,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray); glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray); - pex->shaderManager->blitProgram()->enable(); + pex->shaderManager->blitProgram()->bind(); pex->shaderManager->blitProgram()->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT); pex->shaderManager->setDirty(); @@ -395,7 +395,7 @@ void QGL2PaintEngineExPrivate::setBrush(const QBrush* brush) void QGL2PaintEngineExPrivate::useSimpleShader() { - shaderManager->simpleProgram()->enable(); + shaderManager->simpleProgram()->bind(); shaderManager->setDirty(); if (matrixDirty) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index e28c382..b4191dc 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE The following example creates a vertex shader program using the supplied source \c{code}. Once compiled and linked, the shader program is activated in the current QGLContext by calling - QGLShaderProgram::enable(): + QGLShaderProgram::bind(): \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 0 @@ -125,11 +125,11 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QGLShader::ShaderTypeBits + \enum QGLShader::ShaderTypeBit This enum specifies the type of QGLShader that is being created. - \value VertexShader Vertex shader written in the OpenGL Shading Language (GLSL). - \value FragmentShader Fragment shader written in the OpenGL Shading Language (GLSL). + \value Vertex Vertex shader written in the OpenGL Shading Language (GLSL). + \value Fragment Fragment shader written in the OpenGL Shading Language (GLSL). */ #ifndef GL_FRAGMENT_SHADER @@ -211,7 +211,7 @@ bool QGLShaderPrivate::create() return false; if (qt_resolve_glsl_extensions(const_cast(context))) { GLuint shader; - if (shaderType == QGLShader::VertexShader) + if (shaderType == QGLShader::Vertex) shader = glCreateShader(GL_VERTEX_SHADER); else shader = glCreateShader(GL_FRAGMENT_SHADER); @@ -266,14 +266,14 @@ void QGLShaderPrivate::deleteShader() /*! Constructs a new QGLShader object of the specified \a type and attaches it to \a parent. If shader programs are not supported, - QGLShaderProgram::hasShaderPrograms() will return false. + QGLShaderProgram::hasOpenGLShaderPrograms() will return false. - This constructor is normally followed by a call to compile() - or compileFile(). + This constructor is normally followed by a call to compileSourceCode() + or compileSourceFile(). The shader will be associated with the current QGLContext. - \sa compile(), compileFile() + \sa compileSourceCode(), compileSourceFile() */ QGLShader::QGLShader(QGLShader::ShaderType type, QObject *parent) : QObject(*new QGLShaderPrivate(QGLContext::currentContext(), type), parent) @@ -283,45 +283,19 @@ QGLShader::QGLShader(QGLShader::ShaderType type, QObject *parent) } /*! - Constructs a new QGLShader object of the specified \a type from the - source code in \a fileName and attaches it to \a parent. - If the shader could not be loaded, then isCompiled() will return false. - - The shader will be associated with the current QGLContext. - - \sa isCompiled() -*/ -QGLShader::QGLShader - (const QString& fileName, QGLShader::ShaderType type, QObject *parent) - : QObject(*new QGLShaderPrivate(QGLContext::currentContext(), type), parent) -{ - Q_D(QGLShader); - if (d->create() && !compileFile(fileName)) - d->deleteShader(); -} - -static inline const QGLContext *contextOrCurrent(const QGLContext *context) -{ - if (context) - return context; - else - return QGLContext::currentContext(); -} - -/*! Constructs a new QGLShader object of the specified \a type and attaches it to \a parent. If shader programs are not supported, - then QGLShaderProgram::hasShaderPrograms() will return false. + then QGLShaderProgram::hasOpenGLShaderPrograms() will return false. - This constructor is normally followed by a call to compile() - or compileFile(). + This constructor is normally followed by a call to compileSourceCode() + or compileSourceFile(). The shader will be associated with \a context. - \sa compile(), compileFile() + \sa compileSourceCode(), compileSourceFile() */ QGLShader::QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent) - : QObject(*new QGLShaderPrivate(contextOrCurrent(context), type), parent) + : QObject(*new QGLShaderPrivate(context ? context : QGLContext::currentContext(), type), parent) { Q_D(QGLShader); #ifndef QT_NO_DEBUG @@ -334,30 +308,6 @@ QGLShader::QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObj } /*! - Constructs a new QGLShader object of the specified \a type from the - source code in \a fileName and attaches it to \a parent. - If the shader could not be loaded, then isCompiled() will return false. - - The shader will be associated with \a context. - - \sa isCompiled() -*/ -QGLShader::QGLShader - (const QString& fileName, QGLShader::ShaderType type, const QGLContext *context, QObject *parent) - : QObject(*new QGLShaderPrivate(contextOrCurrent(context), type), parent) -{ - Q_D(QGLShader); -#ifndef QT_NO_DEBUG - if (context && !QGLContext::areSharing(context, QGLContext::currentContext())) { - qWarning("QGLShader::QGLShader: \'context\' must be current context or sharing with it."); - return; - } -#endif - if (d->create() && !compileFile(fileName)) - d->deleteShader(); -} - -/*! Deletes this shader. If the shader has been attached to a QGLShaderProgram object, then the actual shader will stay around until the QGLShaderProgram is destroyed. @@ -400,9 +350,9 @@ static const char redefineHighp[] = Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - \sa compileFile() + \sa compileSourceFile() */ -bool QGLShader::compile(const char *source) +bool QGLShader::compileSourceCode(const char *source) { Q_D(QGLShader); if (d->shaderGuard.id()) { @@ -431,7 +381,7 @@ bool QGLShader::compile(const char *source) srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP - if (d->shaderType == FragmentShader) { + if (d->shaderType == Fragment) { src.append(redefineHighp); srclen.append(GLint(sizeof(redefineHighp) - 1)); } @@ -451,11 +401,11 @@ bool QGLShader::compile(const char *source) Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - \sa compileFile() + \sa compileSourceFile() */ -bool QGLShader::compile(const QByteArray& source) +bool QGLShader::compileSourceCode(const QByteArray& source) { - return compile(source.constData()); + return compileSourceCode(source.constData()); } /*! @@ -464,11 +414,11 @@ bool QGLShader::compile(const QByteArray& source) Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - \sa compileFile() + \sa compileSourceFile() */ -bool QGLShader::compile(const QString& source) +bool QGLShader::compileSourceCode(const QString& source) { - return compile(source.toLatin1().constData()); + return compileSourceCode(source.toLatin1().constData()); } /*! @@ -476,9 +426,9 @@ bool QGLShader::compile(const QString& source) and compiles it. Returns true if the file could be opened and the source compiled, false otherwise. - \sa compile() + \sa compileSourceCode() */ -bool QGLShader::compileFile(const QString& fileName) +bool QGLShader::compileSourceFile(const QString& fileName) { QFile file(fileName); if (!file.open(QFile::ReadOnly)) { @@ -487,13 +437,13 @@ bool QGLShader::compileFile(const QString& fileName) } QByteArray contents = file.readAll(); - return compile(contents.constData()); + return compileSourceCode(contents.constData()); } /*! Returns the source code for this shader. - \sa compile() + \sa compileSourceCode() */ QByteArray QGLShader::sourceCode() const { @@ -516,7 +466,7 @@ QByteArray QGLShader::sourceCode() const /*! Returns true if this shader has been compiled; false otherwise. - \sa compile() + \sa compileSourceCode(), compileSourceFile() */ bool QGLShader::isCompiled() const { @@ -527,7 +477,7 @@ bool QGLShader::isCompiled() const /*! Returns the errors and warnings that occurred during the last compile. - \sa compile() + \sa compileSourceCode(), compileSourceFile() */ QString QGLShader::log() const { @@ -666,6 +616,7 @@ bool QGLShaderProgram::init() is deleted. This allows the caller to add the same shader to multiple shader programs. + \sa addShaderFromSourceCode(), addShaderFromSourceFile() \sa removeShader(), link(), removeAllShaders() */ bool QGLShaderProgram::addShader(QGLShader *shader) @@ -705,15 +656,16 @@ bool QGLShaderProgram::addShader(QGLShader *shader) adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first. + \sa addShader(), addShaderFromSourceFile() \sa removeShader(), link(), log(), removeAllShaders() */ -bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const char *source) +bool QGLShaderProgram::addShaderFromSourceCode(QGLShader::ShaderType type, const char *source) { Q_D(QGLShaderProgram); if (!init()) return false; QGLShader *shader = new QGLShader(type, this); - if (!shader->compile(source)) { + if (!shader->compileSourceCode(source)) { d->log = shader->log(); delete shader; return false; @@ -734,11 +686,12 @@ bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const char *source) adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first. + \sa addShader(), addShaderFromSourceFile() \sa removeShader(), link(), log(), removeAllShaders() */ -bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QByteArray& source) +bool QGLShaderProgram::addShaderFromSourceCode(QGLShader::ShaderType type, const QByteArray& source) { - return addShader(type, source.constData()); + return addShaderFromSourceCode(type, source.constData()); } /*! @@ -753,11 +706,12 @@ bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QByteArray& s adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first. + \sa addShader(), addShaderFromSourceFile() \sa removeShader(), link(), log(), removeAllShaders() */ -bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QString& source) +bool QGLShaderProgram::addShaderFromSourceCode(QGLShader::ShaderType type, const QString& source) { - return addShader(type, source.toLatin1().constData()); + return addShaderFromSourceCode(type, source.toLatin1().constData()); } /*! @@ -770,16 +724,16 @@ bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const QString& sour adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first. - \sa addShader() + \sa addShader(), addShaderFromSourceCode() */ -bool QGLShaderProgram::addShaderFromFile +bool QGLShaderProgram::addShaderFromSourceFile (QGLShader::ShaderType type, const QString& fileName) { Q_D(QGLShaderProgram); if (!init()) return false; QGLShader *shader = new QGLShader(type, this); - if (!shader->compileFile(fileName)) { + if (!shader->compileSourceFile(fileName)) { d->log = shader->log(); delete shader; return false; @@ -912,14 +866,16 @@ QString QGLShaderProgram::log() const } /*! - Enable use of this shader program in the currently active QGLContext. - Returns true if the program was successfully enabled; false - otherwise. If the shader program has not yet been linked, + Binds this shader program to the active QGLContext and makes + it the current shader program. Any previously bound shader program + is released. This is equivalent to calling \c{glUseProgram()} on + programId(). Returns true if the program was successfully bound; + false otherwise. If the shader program has not yet been linked, or it needs to be re-linked, this function will call link(). - \sa link(), disable() + \sa link(), release() */ -bool QGLShaderProgram::enable() +bool QGLShaderProgram::bind() { Q_D(QGLShaderProgram); GLuint program = d->programGuard.id(); @@ -927,6 +883,12 @@ bool QGLShaderProgram::enable() return false; if (!d->linked && !link()) return false; +#ifndef QT_NO_DEBUG + if (!QGLContext::areSharing(d->programGuard.context(), QGLContext::currentContext())) { + qWarning("QGLShaderProgram::bind: program is not valid in the current context."); + return false; + } +#endif glUseProgram(program); return true; } @@ -935,13 +897,18 @@ bool QGLShaderProgram::enable() #define ctx QGLContext::currentContext() /*! - Disables the active shader program in the current QGLContext. + Releases the active shader program from the current QGLContext. This is equivalent to calling \c{glUseProgram(0)}. - \sa enable() + \sa bind() */ -void QGLShaderProgram::disable() +void QGLShaderProgram::release() { +#ifndef QT_NO_DEBUG + Q_D(QGLShaderProgram); + if (!QGLContext::areSharing(d->programGuard.context(), QGLContext::currentContext())) + qWarning("QGLShaderProgram::release: program is not valid in the current context."); +#endif #if defined(QT_OPENGL_ES_2) glUseProgram(0); #else @@ -1331,22 +1298,26 @@ void QGLShaderProgram::setAttributeValue /*! Sets an array of vertex \a values on the attribute at \a location - in this shader program. The \a size indicates the number of + in this shader program. The \a tupleSize indicates the number of components per vertex (1, 2, 3, or 4), and the \a stride indicates the number of bytes between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray - (int location, const GLfloat *values, int size, int stride) + (int location, const GLfloat *values, int tupleSize, int stride) { Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - glVertexAttribPointer(location, size, GL_FLOAT, GL_FALSE, + glVertexAttribPointer(location, tupleSize, GL_FLOAT, GL_FALSE, stride, values); - glEnableVertexAttribArray(location); } } @@ -1356,7 +1327,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (int location, const QVector2D *values, int stride) @@ -1366,7 +1342,6 @@ void QGLShaderProgram::setAttributeArray if (location != -1) { glVertexAttribPointer(location, 2, GL_FLOAT, GL_FALSE, stride, values); - glEnableVertexAttribArray(location); } } @@ -1376,7 +1351,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (int location, const QVector3D *values, int stride) @@ -1386,7 +1366,6 @@ void QGLShaderProgram::setAttributeArray if (location != -1) { glVertexAttribPointer(location, 3, GL_FLOAT, GL_FALSE, stride, values); - glEnableVertexAttribArray(location); } } @@ -1396,7 +1375,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (int location, const QVector4D *values, int stride) @@ -1406,7 +1390,6 @@ void QGLShaderProgram::setAttributeArray if (location != -1) { glVertexAttribPointer(location, 4, GL_FLOAT, GL_FALSE, stride, values); - glEnableVertexAttribArray(location); } } @@ -1414,17 +1397,22 @@ void QGLShaderProgram::setAttributeArray \overload Sets an array of vertex \a values on the attribute called \a name - in this shader program. The \a size indicates the number of + in this shader program. The \a tupleSize indicates the number of components per vertex (1, 2, 3, or 4), and the \a stride indicates the number of bytes between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray - (const char *name, const GLfloat *values, int size, int stride) + (const char *name, const GLfloat *values, int tupleSize, int stride) { - setAttributeArray(attributeLocation(name), values, size, stride); + setAttributeArray(attributeLocation(name), values, tupleSize, stride); } /*! @@ -1435,7 +1423,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (const char *name, const QVector2D *values, int stride) @@ -1451,7 +1444,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (const char *name, const QVector3D *values, int stride) @@ -1467,7 +1465,12 @@ void QGLShaderProgram::setAttributeArray between vertices. A default \a stride value of zero indicates that the vertices are densely packed in \a values. - \sa setAttributeValue(), setUniformValue(), disableAttributeArray() + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() */ void QGLShaderProgram::setAttributeArray (const char *name, const QVector4D *values, int stride) @@ -1476,10 +1479,42 @@ void QGLShaderProgram::setAttributeArray } /*! + Enables the vertex array at \a location in this shader program + so that the value set by setAttributeArray() on \a location + will be used by the shader program. + + \sa disableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() +*/ +void QGLShaderProgram::enableAttributeArray(int location) +{ + Q_D(QGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + glEnableVertexAttribArray(location); +} + +/*! + \overload + + Enables the vertex array called \a name in this shader program + so that the value set by setAttributeArray() on \a name + will be used by the shader program. + + \sa disableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() +*/ +void QGLShaderProgram::enableAttributeArray(const char *name) +{ + enableAttributeArray(attributeLocation(name)); +} + +/*! Disables the vertex array at \a location in this shader program - that was enabled by a previous call to setAttributeArray(). + that was enabled by a previous call to enableAttributeArray(). - \sa setAttributeArray(), setAttributeValue(), setUniformValue() + \sa enableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() */ void QGLShaderProgram::disableAttributeArray(int location) { @@ -1493,9 +1528,10 @@ void QGLShaderProgram::disableAttributeArray(int location) \overload Disables the vertex array called \a name in this shader program - that was enabled by a previous call to setAttributeArray(). + that was enabled by a previous call to enableAttributeArray(). - \sa setAttributeArray(), setAttributeValue(), setUniformValue() + \sa enableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() */ void QGLShaderProgram::disableAttributeArray(const char *name) { @@ -2363,25 +2399,25 @@ void QGLShaderProgram::setUniformValueArray /*! Sets the uniform variable array at \a location in the current context to the \a count elements of \a values. Each element - has \a size components. The \a size must be 1, 2, 3, or 4. + has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4. \sa setAttributeValue() */ -void QGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, int count, int size) +void QGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize) { Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - if (size == 1) + if (tupleSize == 1) glUniform1fv(location, count, values); - else if (size == 2) + else if (tupleSize == 2) glUniform2fv(location, count, values); - else if (size == 3) + else if (tupleSize == 3) glUniform3fv(location, count, values); - else if (size == 4) + else if (tupleSize == 4) glUniform4fv(location, count, values); else - qWarning() << "QGLShaderProgram::setUniformValue: size" << size << "not supported"; + qWarning() << "QGLShaderProgram::setUniformValue: size" << tupleSize << "not supported"; } } @@ -2390,14 +2426,14 @@ void QGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, Sets the uniform variable array called \a name in the current context to the \a count elements of \a values. Each element - has \a size components. The \a size must be 1, 2, 3, or 4. + has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4. \sa setAttributeValue() */ void QGLShaderProgram::setUniformValueArray - (const char *name, const GLfloat *values, int count, int size) + (const char *name, const GLfloat *values, int count, int tupleSize) { - setUniformValueArray(uniformLocation(name), values, count, size); + setUniformValueArray(uniformLocation(name), values, count, tupleSize); } /*! @@ -2800,7 +2836,7 @@ void QGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x4 * The \a context is used to resolve the GLSL extensions. If \a context is null, then QGLContext::currentContext() is used. */ -bool QGLShaderProgram::hasShaderPrograms(const QGLContext *context) +bool QGLShaderProgram::hasOpenGLShaderPrograms(const QGLContext *context) { #if !defined(QT_OPENGL_ES_2) if (!context) @@ -2825,8 +2861,6 @@ void QGLShaderProgram::shaderDestroyed() removeShader(shader); } -#endif - #ifdef Q_MAC_COMPAT_GL_FUNCTIONS /*! \internal */ void QGLShaderProgram::setUniformValue(int location, QMacCompatGLint value) @@ -2877,4 +2911,6 @@ void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGL } #endif +#endif // !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) + QT_END_NAMESPACE diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index 49c3364..deeaee2 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -63,25 +63,23 @@ class Q_OPENGL_EXPORT QGLShader : public QObject { Q_OBJECT public: - enum ShaderTypeBits + enum ShaderTypeBit { - VertexShader = 0x0001, - FragmentShader = 0x0002 + Vertex = 0x0001, + Fragment = 0x0002 }; - Q_DECLARE_FLAGS(ShaderType, ShaderTypeBits) + Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit) explicit QGLShader(QGLShader::ShaderType type, QObject *parent = 0); - QGLShader(const QString& fileName, QGLShader::ShaderType type, QObject *parent = 0); QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0); - QGLShader(const QString& fileName, QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0); virtual ~QGLShader(); QGLShader::ShaderType shaderType() const; - bool compile(const char *source); - bool compile(const QByteArray& source); - bool compile(const QString& source); - bool compileFile(const QString& fileName); + bool compileSourceCode(const char *source); + bool compileSourceCode(const QByteArray& source); + bool compileSourceCode(const QString& source); + bool compileSourceFile(const QString& fileName); QByteArray sourceCode() const; @@ -114,10 +112,10 @@ public: void removeShader(QGLShader *shader); QList shaders() const; - bool addShader(QGLShader::ShaderType type, const char *source); - bool addShader(QGLShader::ShaderType type, const QByteArray& source); - bool addShader(QGLShader::ShaderType type, const QString& source); - bool addShaderFromFile(QGLShader::ShaderType type, const QString& fileName); + bool addShaderFromSourceCode(QGLShader::ShaderType type, const char *source); + bool addShaderFromSourceCode(QGLShader::ShaderType type, const QByteArray& source); + bool addShaderFromSourceCode(QGLShader::ShaderType type, const QString& source); + bool addShaderFromSourceFile(QGLShader::ShaderType type, const QString& fileName); void removeAllShaders(); @@ -125,8 +123,8 @@ public: bool isLinked() const; QString log() const; - bool enable(); - static void disable(); + bool bind(); + void release(); GLuint programId() const; @@ -159,7 +157,7 @@ public: void setAttributeValue(const char *name, const GLfloat *values, int columns, int rows); void setAttributeArray - (int location, const GLfloat *values, int size, int stride = 0); + (int location, const GLfloat *values, int tupleSize, int stride = 0); void setAttributeArray (int location, const QVector2D *values, int stride = 0); void setAttributeArray @@ -167,13 +165,16 @@ public: void setAttributeArray (int location, const QVector4D *values, int stride = 0); void setAttributeArray - (const char *name, const GLfloat *values, int size, int stride = 0); + (const char *name, const GLfloat *values, int tupleSize, int stride = 0); void setAttributeArray (const char *name, const QVector2D *values, int stride = 0); void setAttributeArray (const char *name, const QVector3D *values, int stride = 0); void setAttributeArray (const char *name, const QVector4D *values, int stride = 0); + + void enableAttributeArray(int location); + void enableAttributeArray(const char *name); void disableAttributeArray(int location); void disableAttributeArray(const char *name); @@ -244,7 +245,7 @@ public: void setUniformValue(const char *name, const GLfloat value[4][4]); void setUniformValue(const char *name, const QTransform& value); - void setUniformValueArray(int location, const GLfloat *values, int count, int size); + void setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize); void setUniformValueArray(int location, const GLint *values, int count); void setUniformValueArray(int location, const GLuint *values, int count); void setUniformValueArray(int location, const QVector2D *values, int count); @@ -260,7 +261,7 @@ public: void setUniformValueArray(int location, const QMatrix4x3 *values, int count); void setUniformValueArray(int location, const QMatrix4x4 *values, int count); - void setUniformValueArray(const char *name, const GLfloat *values, int count, int size); + void setUniformValueArray(const char *name, const GLfloat *values, int count, int tupleSize); void setUniformValueArray(const char *name, const GLint *values, int count); void setUniformValueArray(const char *name, const GLuint *values, int count); void setUniformValueArray(const char *name, const QVector2D *values, int count); @@ -276,7 +277,7 @@ public: void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count); void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count); - static bool hasShaderPrograms(const QGLContext *context = 0); + static bool hasOpenGLShaderPrograms(const QGLContext *context = 0); private Q_SLOTS: void shaderDestroyed(); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index ebe101d..f1f5976 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -625,7 +625,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & QGLShaderProgram *blitProgram = QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram(); - blitProgram->enable(); + blitProgram->bind(); blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/); // The shader manager's blit program does not multiply the -- cgit v0.12 From f360773567832dce7172eaadf238a0814016b31e Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 4 Nov 2009 15:57:33 +0100 Subject: Fixed soft-light composition mode in raster and OpenGL1. Updated the soft-light composition mode implementation in the raster and OpenGL1 engines to use the equations in the SVG specification as of April 2009. Task-number: QTBUG-3193 Reviewed-by: Trond --- src/gui/painting/qdrawhelper.cpp | 22 +- src/opengl/util/composition_mode_softlight.glsl | 24 +- src/opengl/util/fragmentprograms_p.h | 676 ++++++++++++------------ 3 files changed, 371 insertions(+), 351 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 41602a1..4df7f8a 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2386,12 +2386,12 @@ static void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int len } /* - if 2.Sca < Sa - Dca' = Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa) - otherwise if 8.Dca <= Da - Dca' = Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa).(3 - 8.Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) - otherwise - Dca' = (Dca.Sa + ((Dca/Da)^(0.5).Da - Dca).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa) + if 2.Sca <= Sa + Dca' = Dca.(Sa + (2.Sca - Sa).(1 - Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) + otherwise if 2.Sca > Sa and 4.Dca <= Da + Dca' = Dca.Sa + Da.(2.Sca - Sa).(4.Dca/Da.(4.Dca/Da + 1).(Dca/Da - 1) + 7.Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) + otherwise if 2.Sca > Sa and 4.Dca > Da + Dca' = Dca.Sa + Da.(2.Sca - Sa).((Dca/Da)^0.5 - Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) */ static inline int soft_light_op(int dst, int src, int da, int sa) { @@ -2400,13 +2400,11 @@ static inline int soft_light_op(int dst, int src, int da, int sa) const int temp = (src * (255 - da) + dst * (255 - sa)) * 255; if (src2 < sa) - return (dst * ((sa * 255) - (255 - dst_np) * (src2 - sa)) + temp) / 65025; - else if (8 * dst <= da) - return (dst * ((sa * 255) - ((255 - dst_np) * (src2 - sa) * ((3 * 255) - 8 * dst_np)) / 255) + temp) / 65025; + return (dst * (sa * 255 + (src2 - sa) * (255 - dst_np)) + temp) / 65025; + else if (4 * dst <= da) + return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; else { - // sqrt is too expensive to do three times per pixel, so skipping it for now - // a future possibility is to use a LUT - return ((dst * sa * 255) + (int(dst_np) * da - (dst * 255)) * (src2 - sa) + temp) / 65025; + return (dst * sa * 255 + da * (src2 - sa) * (int(sqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; } } diff --git a/src/opengl/util/composition_mode_softlight.glsl b/src/opengl/util/composition_mode_softlight.glsl index 4777b74..e4c1f89 100644 --- a/src/opengl/util/composition_mode_softlight.glsl +++ b/src/opengl/util/composition_mode_softlight.glsl @@ -1,18 +1,22 @@ -// Dca' = 2.Sca < Sa ? -// Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa) : -// (8.Dca <= Da ? -// Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa).(3 - 8.Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) : -// (Dca.Sa + ((Dca/Da)^(0.5).Da - Dca).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa)) +// if 2.Sca <= Sa +// Dca' = Dca.(Sa + (2.Sca - Sa).(1 - Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) +// otherwise if 2.Sca > Sa and 4.Dca <= Da +// Dca' = Dca.Sa + Da.(2.Sca - Sa).(4.Dca/Da.(4.Dca/Da + 1).(Dca/Da - 1) + 7.Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) +// otherwise if 2.Sca > Sa and 4.Dca > Da +// Dca' = Dca.Sa + Da.(2.Sca - Sa).((Dca/Da)^0.5 - Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da + vec4 composite(vec4 src, vec4 dst) { vec4 result; float da = max(dst.a, 0.00001); - result.rgb = mix(dst.rgb * (src.a - (1.0 - dst.rgb / da) * (2.0 * src.rgb - src.a)), - mix(dst.rgb * (src.a - (1.0 - dst.rgb / da) * (2.0 * src.rgb - src.a) * (3.0 - 8.0 * dst.rgb / da)), - (dst.rgb * src.a + (sqrt(dst.rgb / da) * dst.a - dst.rgb) * (2.0 * src.rgb - src.a)), - step(dst.a, 8.0 * dst.rgb)), - step(src.a, 2.0 * src.rgb)) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); + vec3 dst_np = dst.rgb / da; + result.rgb = mix(dst.rgb * (src.a + (2.0 * src.rgb - src.a) * (1.0 - dst_np)), + mix(dst.rgb * src.a + dst.a * (2.0 * src.rgb - src.a) * ((16.0 * dst_np - 12.0) * dst_np + 3.0) * dst_np, + dst.rgb * src.a + dst.a * (2.0 * src.rgb - src.a) * (sqrt(dst_np) - dst_np), + step(dst.a, 4.0 * dst.rgb)), + step(src.a, 2.0 * src.rgb)) + + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); result.a = src.a + dst.a - src.a * dst.a; return result; } diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h index 9154c6e..2241057 100644 --- a/src/opengl/util/fragmentprograms_p.h +++ b/src/opengl/util/fragmentprograms_p.h @@ -519,8 +519,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..3],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -530,30 +530,31 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MUL R0.xy, fragment.position, c[1];\n" "TEX R0, R0, texture[0], 2D;\n" "MAX R1.x, R0.w, c[4].z;\n" - "RCP R1.w, R1.x;\n" - "MUL R1.xyz, R0, R1.w;\n" - "MUL R4.xyz, -R1, c[4].w;\n" - "RSQ R2.x, R1.x;\n" - "RSQ R2.z, R1.z;\n" - "RSQ R2.y, R1.y;\n" - "MAD R1.xyz, -R0, R1.w, c[4].x;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R3.xyz, R0.w, R2, -R0;\n" - "MAD R2.xyz, fragment.color.primary, c[4].y, -fragment.color.primary.w;\n" - "MUL R3.xyz, R2, R3;\n" - "ADD R5.xyz, R4, c[5].x;\n" - "MUL R4.xyz, R1, R2;\n" - "MAD R1.xyz, -R1, R2, fragment.color.primary.w;\n" + "RCP R1.x, R1.x;\n" + "MUL R2.xyz, R0, R1.x;\n" + "MAD R1.xyz, R2, c[5].x, -c[5].y;\n" + "MAD R3.xyz, R2, R1, c[5].z;\n" + "MAD R1.xyz, fragment.color.primary, c[4].y, -fragment.color.primary.w;\n" + "MUL R4.xyz, R0.w, R1;\n" + "MUL R5.xyz, R4, R3;\n" + "RSQ R1.w, R2.x;\n" + "RSQ R2.w, R2.z;\n" + "RCP R3.x, R1.w;\n" + "RSQ R1.w, R2.y;\n" + "MUL R5.xyz, R2, R5;\n" + "RCP R3.z, R2.w;\n" + "RCP R3.y, R1.w;\n" + "ADD R3.xyz, -R2, R3;\n" + "MUL R3.xyz, R4, R3;\n" + "ADD R2.xyz, -R2, c[4].x;\n" + "MAD R1.xyz, R1, R2, fragment.color.primary.w;\n" "MUL R2.xyz, fragment.color.primary, c[4].y;\n" - "MAD R5.xyz, -R4, R5, fragment.color.primary.w;\n" + "MAD R4.xyz, fragment.color.primary.w, R0, R5;\n" "MAD R3.xyz, fragment.color.primary.w, R0, R3;\n" - "MAD R4.xyz, -R0, R5, R3;\n" + "ADD R5.xyz, R3, -R4;\n" "MUL R3.xyz, R0, c[4].w;\n" - "MUL R5.xyz, R0, R5;\n" "SGE R3.xyz, R3, R0.w;\n" - "MAD R3.xyz, R3, R4, R5;\n" + "MAD R3.xyz, R3, R5, R4;\n" "MAD R3.xyz, -R0, R1, R3;\n" "MUL R1.xyz, R0, R1;\n" "SGE R2.xyz, R2, fragment.color.primary.w;\n" @@ -861,8 +862,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[3] = { program.local[0],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -872,30 +873,31 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE "MUL R0.xy, fragment.position, c[0];\n" "TEX R0, R0, texture[0], 2D;\n" "MAX R1.x, R0.w, c[1].z;\n" - "RCP R1.w, R1.x;\n" - "MUL R1.xyz, R0, R1.w;\n" - "MUL R4.xyz, -R1, c[1].w;\n" - "RSQ R2.x, R1.x;\n" - "RSQ R2.z, R1.z;\n" - "RSQ R2.y, R1.y;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R3.xyz, R0.w, R2, -R0;\n" - "MAD R2.xyz, fragment.color.primary, c[1].y, -fragment.color.primary.w;\n" - "MUL R3.xyz, R2, R3;\n" + "RCP R1.x, R1.x;\n" + "MUL R2.xyz, R0, R1.x;\n" + "MAD R1.xyz, R2, c[2].x, -c[2].y;\n" + "MAD R3.xyz, R2, R1, c[2].z;\n" + "MAD R1.xyz, fragment.color.primary, c[1].y, -fragment.color.primary.w;\n" + "MUL R4.xyz, R0.w, R1;\n" + "MUL R5.xyz, R4, R3;\n" + "RSQ R1.w, R2.x;\n" + "RCP R3.x, R1.w;\n" + "RSQ R2.w, R2.z;\n" + "RSQ R1.w, R2.y;\n" + "MUL R5.xyz, R2, R5;\n" + "RCP R3.z, R2.w;\n" + "RCP R3.y, R1.w;\n" + "ADD R3.xyz, -R2, R3;\n" + "MUL R3.xyz, R4, R3;\n" + "ADD R2.xyz, -R2, c[1].x;\n" + "MAD R1.xyz, R1, R2, fragment.color.primary.w;\n" + "MUL R2.xyz, fragment.color.primary, c[1].y;\n" + "MAD R4.xyz, fragment.color.primary.w, R0, R5;\n" "MAD R3.xyz, fragment.color.primary.w, R0, R3;\n" - "MAD R1.xyz, -R0, R1.w, c[1].x;\n" - "ADD R5.xyz, R4, c[2].x;\n" - "MUL R4.xyz, R1, R2;\n" - "MAD R1.xyz, -R1, R2, fragment.color.primary.w;\n" - "MAD R5.xyz, -R4, R5, fragment.color.primary.w;\n" - "MAD R4.xyz, -R0, R5, R3;\n" + "ADD R5.xyz, R3, -R4;\n" "MUL R3.xyz, R0, c[1].w;\n" - "MUL R2.xyz, fragment.color.primary, c[1].y;\n" - "MUL R5.xyz, R0, R5;\n" "SGE R3.xyz, R3, R0.w;\n" - "MAD R3.xyz, R3, R4, R5;\n" + "MAD R3.xyz, R3, R5, R4;\n" "MAD R3.xyz, -R0, R1, R3;\n" "MUL R1.xyz, R0, R1;\n" "SGE R2.xyz, R2, fragment.color.primary.w;\n" @@ -1457,7 +1459,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "!!ARBfp1.0\n" "PARAM c[11] = { program.local[0..8],\n" " { 2, 4, 1, 9.9999997e-006 },\n" - " { 8, 3 } };\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -1469,53 +1471,55 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MAD R0.xyz, fragment.position.x, c[2], R0;\n" "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAX R0.w, R1, c[9];\n" - "RCP R2.w, R0.w;\n" - "MUL R5.xyz, R1, R2.w;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" "ADD R0.z, R0, R0.w;\n" "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MOV R0.x, c[9];\n" - "RSQ R2.x, R5.x;\n" - "RSQ R2.z, R5.z;\n" - "RSQ R2.y, R5.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0.z, c[9];\n" + "MUL R0.x, R0, c[9];\n" + "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MAD R0.y, R0.x, R0.x, -R0;\n" + "RSQ R0.y, R0.y;\n" + "RCP R0.y, R0.y;\n" + "ADD R0.y, -R0.x, R0;\n" + "MOV R0.x, c[9];\n" + "MUL R0.x, R0, c[1];\n" + "MAX R0.z, R1.w, c[9].w;\n" + "RCP R0.z, R0.z;\n" + "MUL R3.xyz, R1, R0.z;\n" + "MAD R4.xyz, R3, c[10].x, -c[10].y;\n" + "RCP R0.x, R0.x;\n" + "MUL R0.x, R0.y, R0;\n" "TEX R0, R0, texture[2], 1D;\n" - "MAD R3.xyz, R0, c[9].x, -R0.w;\n" - "MAD R6.xyz, -R5, c[10].x, c[10].y;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R3, R2;\n" - "MAD R4.xyz, R0.w, R1, R2;\n" - "MAD R2.xyz, -R1, R2.w, c[9].z;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" - "MAD R5.xyz, -R1, R6, R4;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R2.xyz, R0, c[9].x, -R0.w;\n" + "MAD R4.xyz, R3, R4, c[10].z;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[9].z;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[9].x;\n" - "MUL R4.xyz, R1, c[10].x;\n" - "SGE R3.xyz, R3, R0.w;\n" - "ADD R2.w, -R1, c[9].z;\n" - "MUL R6.xyz, R1, R6;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "ADD R6.xyz, R4, -R5;\n" + "MUL R4.xyz, R1, c[9].y;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" + "SGE R3.xyz, R3, R0.w;\n" "MUL R2.xyz, R1, R2;\n" + "ADD R2.w, -R1, c[9].z;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "ADD R0.x, -R0.w, c[9].z;\n" @@ -2060,7 +2064,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "!!ARBfp1.0\n" "PARAM c[8] = { program.local[0..5],\n" " { 2, 4, 1, 9.9999997e-006 },\n" - " { 8, 3 } };\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2072,49 +2076,51 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MOD "MAD R0.xyz, fragment.position.x, c[2], R0;\n" "ADD R0.xyz, R0, c[4];\n" "RCP R0.z, R0.z;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAX R0.w, R1, c[6];\n" - "RCP R2.w, R0.w;\n" - "MUL R5.xyz, R1, R2.w;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.zw, R0.xyxy, R0.xyxy;\n" "ADD R0.z, R0, R0.w;\n" "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MOV R0.x, c[6];\n" - "RSQ R2.x, R5.x;\n" - "RSQ R2.z, R5.z;\n" - "RSQ R2.y, R5.y;\n" "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" + "MUL R0.y, R0.z, c[6];\n" + "MUL R0.x, R0, c[6];\n" + "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" + "TEX R1, R0.zwzw, texture[0], 2D;\n" + "MAD R0.y, R0.x, R0.x, -R0;\n" + "RSQ R0.y, R0.y;\n" + "RCP R0.y, R0.y;\n" + "ADD R0.y, -R0.x, R0;\n" + "MOV R0.x, c[6];\n" + "MUL R0.x, R0, c[1];\n" + "MAX R0.z, R1.w, c[6].w;\n" + "RCP R0.z, R0.z;\n" + "MUL R3.xyz, R1, R0.z;\n" + "MAD R4.xyz, R3, c[7].x, -c[7].y;\n" + "RCP R0.x, R0.x;\n" + "MUL R0.x, R0.y, R0;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R3.xyz, R0, c[6].x, -R0.w;\n" - "MAD R6.xyz, -R5, c[7].x, c[7].y;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R3, R2;\n" - "MAD R4.xyz, R0.w, R1, R2;\n" - "MAD R2.xyz, -R1, R2.w, c[6].z;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "MAD R2.xyz, R0, c[6].x, -R0.w;\n" + "MAD R4.xyz, R3, R4, c[7].z;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[6].z;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[6].x;\n" - "MUL R4.xyz, R1, c[7].x;\n" - "MUL R6.xyz, R1, R6;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "ADD R6.xyz, R4, -R5;\n" + "MUL R4.xyz, R1, c[6].y;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" "SGE R3.xyz, R3, R0.w;\n" @@ -2899,11 +2905,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" - "PARAM c[12] = { program.local[0..7],\n" + "PARAM c[13] = { program.local[0..7],\n" " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" " { 3.141593, 0.15915494, 1, 2 },\n" - " { 9.9999997e-006, 8, 3 } };\n" + " { 9.9999997e-006, 4, 16, 12 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -2940,41 +2947,43 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "ADD R0.w, -R0.z, c[10].x;\n" "CMP R0.x, R0, R0.w, R0.z;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MAX R0.y, R1.w, c[11].x;\n" - "RCP R2.w, R0.y;\n" - "MUL R5.xyz, R1, R2.w;\n" - "RSQ R2.x, R5.x;\n" - "RSQ R2.z, R5.z;\n" - "RSQ R2.y, R5.y;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MAX R0.z, R1.w, c[11].x;\n" + "RCP R2.x, R0.z;\n" + "MUL R3.xyz, R1, R2.x;\n" + "MAD R4.xyz, R3, c[11].z, -c[11].w;\n" "ADD R0.x, R0, c[0];\n" "MUL R0.x, R0, c[10].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[2], 1D;\n" - "MAD R3.xyz, R0, c[10].w, -R0.w;\n" - "MAD R6.xyz, -R5, c[11].y, c[11].z;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R3, R2;\n" - "MAD R4.xyz, R0.w, R1, R2;\n" - "MAD R2.xyz, -R1, R2.w, c[10].z;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" - "MAD R5.xyz, -R1, R6, R4;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R2.xyz, R0, c[10].w, -R0.w;\n" + "MAD R4.xyz, R3, R4, c[12].x;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[10].z;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[10].w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[11].y;\n" - "SGE R3.xyz, R3, R0.w;\n" - "ADD R2.w, -R1, c[10].z;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" + "SGE R3.xyz, R3, R0.w;\n" "MUL R2.xyz, R1, R2;\n" + "ADD R2.w, -R1, c[10].z;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "ADD R0.x, -R0.w, c[10].z;\n" @@ -3682,11 +3691,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..4],\n" + "PARAM c[10] = { program.local[0..4],\n" " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" " { 3.141593, 0.15915494, 1, 2 },\n" - " { 9.9999997e-006, 8, 3 } };\n" + " { 9.9999997e-006, 4, 16, 12 },\n" + " { 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -3723,37 +3733,39 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MO "ADD R0.w, -R0.z, c[7].x;\n" "CMP R0.x, R0, R0.w, R0.z;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MAX R0.y, R1.w, c[8].x;\n" - "RCP R2.w, R0.y;\n" - "MUL R5.xyz, R1, R2.w;\n" - "RSQ R2.x, R5.x;\n" - "RSQ R2.z, R5.z;\n" - "RSQ R2.y, R5.y;\n" + "CMP R0.x, -R0.y, -R0, R0;\n" + "MAX R0.z, R1.w, c[8].x;\n" + "RCP R2.x, R0.z;\n" + "MUL R3.xyz, R1, R2.x;\n" + "MAD R4.xyz, R3, c[8].z, -c[8].w;\n" "ADD R0.x, R0, c[0];\n" "MUL R0.x, R0, c[7].y;\n" "FLR R0.y, R0.x;\n" "ADD R0.x, R0, -R0.y;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R3.xyz, R0, c[7].w, -R0.w;\n" - "MAD R6.xyz, -R5, c[8].y, c[8].z;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.z, R2.z;\n" - "RCP R2.y, R2.y;\n" - "MAD R2.xyz, R1.w, R2, -R1;\n" - "MUL R2.xyz, R3, R2;\n" - "MAD R4.xyz, R0.w, R1, R2;\n" - "MAD R2.xyz, -R1, R2.w, c[7].z;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "MAD R2.xyz, R0, c[7].w, -R0.w;\n" + "MAD R4.xyz, R3, R4, c[9].x;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[7].z;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[7].w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" + "MAD R4.xyz, R0.w, R1, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[8].y;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" "SGE R3.xyz, R3, R0.w;\n" @@ -4356,8 +4368,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -4365,13 +4377,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.w, R1, c[8].z;\n" - "RCP R2.w, R0.w;\n" - "MUL R2.xyz, R1, R2.w;\n" - "RSQ R0.w, R2.x;\n" - "MUL R5.xyz, -R2, c[8].w;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" @@ -4379,32 +4384,40 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "RSQ R0.z, R2.y;\n" - "RSQ R0.y, R2.z;\n" - "MAD R2.xyz, -R1, R2.w, c[8].x;\n" - "RCP R3.x, R0.w;\n" - "RCP R3.y, R0.z;\n" - "RCP R3.z, R0.y;\n" + "MUL R1.xy, fragment.position, c[5];\n" + "TEX R1, R1, texture[0], 2D;\n" + "MAX R0.z, R1.w, c[8];\n" + "RCP R0.z, R0.z;\n" + "MUL R3.xyz, R1, R0.z;\n" + "MAD R2.xyz, R3, c[9].x, -c[9].y;\n" "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[2], 1D;\n" - "MAD R4.xyz, R1.w, R3, -R1;\n" - "MAD R3.xyz, R0, c[8].y, -R0.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[9].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R4.xyz, R3, R2, c[9].z;\n" + "MAD R2.xyz, R0, c[8].y, -R0.w;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[8].x;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[8].y;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" "MAD R4.xyz, R0.w, R1, R4;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[8].w;\n" - "SGE R3.xyz, R3, R0.w;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" + "SGE R3.xyz, R3, R0.w;\n" "MUL R2.xyz, R1, R2;\n" + "ADD R2.w, -R1, c[8].x;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "ADD R0.x, -R0.w, c[8];\n" @@ -4815,8 +4828,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -4824,13 +4837,6 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.w, R1, c[5].z;\n" - "RCP R2.w, R0.w;\n" - "MUL R2.xyz, R1, R2.w;\n" - "RSQ R0.w, R2.x;\n" - "MUL R5.xyz, -R2, c[5].w;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" @@ -4838,28 +4844,36 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MOD "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "ADD R0.x, R0, R0.y;\n" - "RSQ R0.z, R2.y;\n" - "RSQ R0.y, R2.z;\n" - "MAD R2.xyz, -R1, R2.w, c[5].x;\n" - "RCP R3.x, R0.w;\n" - "RCP R3.y, R0.z;\n" - "RCP R3.z, R0.y;\n" + "MUL R1.xy, fragment.position, c[4];\n" + "TEX R1, R1, texture[0], 2D;\n" + "MAX R0.z, R1.w, c[5];\n" + "RCP R0.z, R0.z;\n" + "MUL R3.xyz, R1, R0.z;\n" + "MAD R2.xyz, R3, c[6].x, -c[6].y;\n" "MUL R0.x, R0, c[0].z;\n" "TEX R0, R0, texture[1], 1D;\n" - "MAD R4.xyz, R1.w, R3, -R1;\n" - "MAD R3.xyz, R0, c[5].y, -R0.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[6].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R4.xyz, R3, R2, c[6].z;\n" + "MAD R2.xyz, R0, c[5].y, -R0.w;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[5].x;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[5].y;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" "MAD R4.xyz, R0.w, R1, R4;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[5].w;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" "SGE R3.xyz, R3, R0.w;\n" @@ -5333,8 +5347,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -5342,44 +5356,45 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.x, R1.w, c[8].z;\n" - "RCP R2.w, R0.x;\n" - "MUL R2.xyz, R1, R2.w;\n" - "RSQ R0.w, R2.x;\n" - "RCP R3.x, R0.w;\n" - "RSQ R0.w, R2.y;\n" - "MUL R5.xyz, -R2, c[8].w;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" + "MUL R1.xy, fragment.position, c[5];\n" + "TEX R1, R1, texture[0], 2D;\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "RSQ R0.z, R2.z;\n" - "MAD R2.xyz, -R1, R2.w, c[8].x;\n" - "RCP R3.y, R0.w;\n" - "RCP R3.z, R0.z;\n" + "MAX R0.w, R1, c[8].z;\n" + "RCP R0.w, R0.w;\n" + "MUL R3.xyz, R1, R0.w;\n" + "MAD R2.xyz, R3, c[9].x, -c[9].y;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[2], 2D;\n" - "MAD R4.xyz, R1.w, R3, -R1;\n" - "MAD R3.xyz, R0, c[8].y, -R0.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[9].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R4.xyz, R3, R2, c[9].z;\n" + "MAD R2.xyz, R0, c[8].y, -R0.w;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[8].x;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[8].y;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" "MAD R4.xyz, R0.w, R1, R4;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[8].w;\n" - "SGE R3.xyz, R3, R0.w;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" + "SGE R3.xyz, R3, R0.w;\n" "MUL R2.xyz, R1, R2;\n" + "ADD R2.w, -R1, c[8].x;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R0, R2.w, R2;\n" "ADD R0.x, -R0.w, c[8];\n" @@ -5768,8 +5783,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -5777,40 +5792,41 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R1, R0, texture[0], 2D;\n" - "MAX R0.x, R1.w, c[5].z;\n" - "RCP R2.w, R0.x;\n" - "MUL R2.xyz, R1, R2.w;\n" - "RSQ R0.w, R2.x;\n" - "RCP R3.x, R0.w;\n" - "RSQ R0.w, R2.y;\n" - "MUL R5.xyz, -R2, c[5].w;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" + "MUL R1.xy, fragment.position, c[4];\n" + "TEX R1, R1, texture[0], 2D;\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "RSQ R0.z, R2.z;\n" - "MAD R2.xyz, -R1, R2.w, c[5].x;\n" - "RCP R3.y, R0.w;\n" - "RCP R3.z, R0.z;\n" + "MAX R0.w, R1, c[5].z;\n" + "RCP R0.w, R0.w;\n" + "MUL R3.xyz, R1, R0.w;\n" + "MAD R2.xyz, R3, c[6].x, -c[6].y;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0, R0, texture[1], 2D;\n" - "MAD R4.xyz, R1.w, R3, -R1;\n" - "MAD R3.xyz, R0, c[5].y, -R0.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[6].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R0.w;\n" + "MAD R4.xyz, R3, R2, c[6].z;\n" + "MAD R2.xyz, R0, c[5].y, -R0.w;\n" + "MUL R5.xyz, R1.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[5].x;\n" + "MAD R2.xyz, R2, R3, R0.w;\n" "MUL R3.xyz, R0, c[5].y;\n" - "MAD R6.xyz, -R5, R6, R0.w;\n" + "MAD R5.xyz, R0.w, R1, R6;\n" "MAD R4.xyz, R0.w, R1, R4;\n" - "MAD R5.xyz, -R1, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R1, c[5].w;\n" - "MUL R6.xyz, R1, R6;\n" "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R1, R2, R4;\n" "MUL R2.xyz, R1, R2;\n" "SGE R3.xyz, R3, R0.w;\n" @@ -6295,8 +6311,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT = "!!ARBfp1.0\n" "PARAM c[10] = { program.local[0..7],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6304,46 +6320,47 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.w, R0, c[8].z;\n" - "RCP R2.w, R1.w;\n" - "MUL R2.xyz, R0, R2.w;\n" - "RSQ R1.w, R2.x;\n" - "MUL R5.xyz, -R2, c[8].w;\n" - "MUL R1.xyz, fragment.position.y, c[2];\n" - "MAD R1.xyz, fragment.position.x, c[1], R1;\n" - "ADD R1.xyz, R1, c[3];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" "RCP R1.z, R1.z;\n" "MUL R1.xy, R1, R1.z;\n" "MUL R1.xy, R1, c[0];\n" "TEX R1.x, R1, texture[2], 2D;\n" - "RSQ R1.z, R2.y;\n" - "RSQ R1.y, R2.z;\n" - "MAD R2.xyz, -R0, R2.w, c[8].x;\n" - "RCP R3.x, R1.w;\n" - "RCP R3.y, R1.z;\n" - "RCP R3.z, R1.y;\n" + "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MAX R1.z, R0.w, c[8];\n" + "RCP R1.z, R1.z;\n" + "MUL R3.xyz, R0, R1.z;\n" + "MAD R2.xyz, R3, c[9].x, -c[9].y;\n" "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R4.xyz, R0.w, R3, -R0;\n" - "MAD R3.xyz, R1, c[8].y, -R1.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[9].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R1.w;\n" + "MAD R4.xyz, R3, R2, c[9].z;\n" + "MAD R2.xyz, R1, c[8].y, -R1.w;\n" + "MUL R5.xyz, R0.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[8].x;\n" + "MAD R2.xyz, R2, R3, R1.w;\n" "MUL R3.xyz, R1, c[8].y;\n" - "MAD R6.xyz, -R5, R6, R1.w;\n" + "MAD R5.xyz, R1.w, R0, R6;\n" "MAD R4.xyz, R1.w, R0, R4;\n" - "MAD R5.xyz, -R0, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R0, c[8].w;\n" - "SGE R3.xyz, R3, R1.w;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MUL R6.xyz, R0, R6;\n" "SGE R4.xyz, R4, R0.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R0, R2, R4;\n" + "SGE R3.xyz, R3, R1.w;\n" "MUL R2.xyz, R0, R2;\n" + "ADD R2.w, -R0, c[8].x;\n" "MAD R2.xyz, R3, R4, R2;\n" "MAD R2.xyz, R1, R2.w, R2;\n" "ADD R1.x, -R1.w, c[8];\n" @@ -6755,8 +6772,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[7] = { program.local[0..4],\n" - " { 1, 2, 9.9999997e-006, 8 },\n" - " { 3 } };\n" + " { 1, 2, 9.9999997e-006, 4 },\n" + " { 16, 12, 3 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6764,42 +6781,43 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R4;\n" "TEMP R5;\n" "TEMP R6;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.w, R0, c[5].z;\n" - "RCP R2.w, R1.w;\n" - "MUL R2.xyz, R0, R2.w;\n" - "RSQ R1.w, R2.x;\n" - "MUL R5.xyz, -R2, c[5].w;\n" - "MUL R1.xyz, fragment.position.y, c[2];\n" - "MAD R1.xyz, fragment.position.x, c[1], R1;\n" - "ADD R1.xyz, R1, c[3];\n" + "MUL R0.xyz, fragment.position.y, c[2];\n" + "MAD R0.xyz, fragment.position.x, c[1], R0;\n" + "ADD R1.xyz, R0, c[3];\n" "RCP R1.z, R1.z;\n" "MUL R1.xy, R1, R1.z;\n" "MUL R1.xy, R1, c[0];\n" "TEX R1.x, R1, texture[1], 2D;\n" - "RSQ R1.z, R2.y;\n" - "RSQ R1.y, R2.z;\n" - "MAD R2.xyz, -R0, R2.w, c[5].x;\n" - "RCP R3.x, R1.w;\n" - "RCP R3.y, R1.z;\n" - "RCP R3.z, R1.y;\n" + "MUL R0.xy, fragment.position, c[4];\n" + "TEX R0, R0, texture[0], 2D;\n" + "MAX R1.z, R0.w, c[5];\n" + "RCP R1.z, R1.z;\n" + "MUL R3.xyz, R0, R1.z;\n" + "MAD R2.xyz, R3, c[6].x, -c[6].y;\n" "ADD R1.x, -R1, c[5];\n" "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R4.xyz, R0.w, R3, -R0;\n" - "MAD R3.xyz, R1, c[5].y, -R1.w;\n" - "MUL R4.xyz, R3, R4;\n" - "ADD R6.xyz, R5, c[6].x;\n" - "MUL R5.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, R3, R1.w;\n" + "MAD R4.xyz, R3, R2, c[6].z;\n" + "MAD R2.xyz, R1, c[5].y, -R1.w;\n" + "MUL R5.xyz, R0.w, R2;\n" + "MUL R6.xyz, R5, R4;\n" + "RSQ R2.w, R3.x;\n" + "RCP R4.x, R2.w;\n" + "RSQ R2.w, R3.y;\n" + "RSQ R3.w, R3.z;\n" + "RCP R4.y, R2.w;\n" + "RCP R4.z, R3.w;\n" + "ADD R4.xyz, -R3, R4;\n" + "MUL R6.xyz, R3, R6;\n" + "MUL R4.xyz, R5, R4;\n" + "ADD R3.xyz, -R3, c[5].x;\n" + "MAD R2.xyz, R2, R3, R1.w;\n" "MUL R3.xyz, R1, c[5].y;\n" - "MAD R6.xyz, -R5, R6, R1.w;\n" + "MAD R5.xyz, R1.w, R0, R6;\n" "MAD R4.xyz, R1.w, R0, R4;\n" - "MAD R5.xyz, -R0, R6, R4;\n" + "ADD R6.xyz, R4, -R5;\n" "MUL R4.xyz, R0, c[5].w;\n" - "MUL R6.xyz, R0, R6;\n" "SGE R4.xyz, R4, R0.w;\n" - "MAD R4.xyz, R4, R5, R6;\n" + "MAD R4.xyz, R4, R6, R5;\n" "MAD R4.xyz, -R0, R2, R4;\n" "MUL R2.xyz, R0, R2;\n" "SGE R3.xyz, R3, R1.w;\n" -- cgit v0.12 From cfbaa43a0a238d164cf76bdbe224d4aa9141fb7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 5 Nov 2009 11:21:31 +0100 Subject: Removed the FBO stacking behaviour and the test attached to it. Having this behaviour in QGLFrameBufferObject complicates alot of things and isn't really necessary. Reviewed-by: Tom Cooksey --- src/opengl/qglframebufferobject.cpp | 33 +++--------- src/opengl/qglframebufferobject_p.h | 4 +- tests/auto/qgl/tst_qgl.cpp | 105 ------------------------------------ 3 files changed, 9 insertions(+), 133 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 7374594..5295b6d 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -361,9 +361,6 @@ void QGLFBOGLPaintDevice::beginPaint() if (QGLContext::currentContext() != context()) context()->makeCurrent(); - // We let QFBO track the previously bound FBO rather than doing it - // ourselves here. This has the advantage that begin/release & bind/end - // work as expected. wasBound = fbo->isBound(); if (!wasBound) fbo->bind(); @@ -896,17 +893,11 @@ bool QGLFramebufferObject::bind() QGL_FUNC_CONTEXT; if (!ctx) return false; // Context no longer exists. + const QGLContext *current = QGLContext::currentContext(); glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->fbo()); d->valid = d->checkFramebufferStatus(); - const QGLContext *context = QGLContext::currentContext(); - if (d->valid && context) { - Q_ASSERT(QGLContextPrivate::contextGroup(context) == QGLContextPrivate::contextGroup(ctx)); - // Save the previous setting to automatically restore in release(). - if (context->d_ptr->current_fbo != d->fbo()) { - d->previous_fbo = context->d_ptr->current_fbo; - context->d_ptr->current_fbo = d->fbo(); - } - } + if (d->valid && current) + current->d_ptr->current_fbo = d->fbo(); return d->valid; } @@ -917,30 +908,20 @@ bool QGLFramebufferObject::bind() framebuffer. Returns true upon success, false otherwise. - Since 4.6: if another QGLFramebufferObject instance was already bound - to the current context when bind() was called, then this function will - automatically re-bind it to the current context. - \sa bind() */ bool QGLFramebufferObject::release() { if (!isValid()) return false; - Q_D(QGLFramebufferObject); QGL_FUNC_CONTEXT; if (!ctx) return false; // Context no longer exists. - const QGLContext *context = QGLContext::currentContext(); - if (context) { - Q_ASSERT(QGLContextPrivate::contextGroup(context) == QGLContextPrivate::contextGroup(ctx)); - // Restore the previous setting for stacked framebuffer objects. - if (d->previous_fbo != context->d_ptr->current_fbo) { - context->d_ptr->current_fbo = d->previous_fbo; - glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->previous_fbo); - } - d->previous_fbo = 0; + const QGLContext *current = QGLContext::currentContext(); + if (current) { + current->d_ptr->current_fbo = 0; + glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); } return true; diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index 122c42e..c341459 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -127,7 +127,8 @@ private: class QGLFramebufferObjectPrivate { public: - QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_stencil_buffer(0), color_buffer(0), valid(false), previous_fbo(0), engine(0) {} + QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_stencil_buffer(0) + , color_buffer(0), valid(false), engine(0) {} ~QGLFramebufferObjectPrivate() {} void init(QGLFramebufferObject *q, const QSize& sz, @@ -143,7 +144,6 @@ public: QGLFramebufferObjectFormat format; uint valid : 1; QGLFramebufferObject::Attachment fbo_attachment; - GLuint previous_fbo; mutable QPaintEngine *engine; QGLFBOGLPaintDevice glDevice; diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index e9f0476..c680dec 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -82,7 +82,6 @@ private slots: void glPBufferRendering(); void glWidgetReparent(); void glWidgetRenderPixmap(); - void stackedFBOs(); void colormap(); void fboFormat(); void testDontCrashOnDanglingResources(); @@ -1226,110 +1225,6 @@ void tst_QGL::glWidgetRenderPixmap() QCOMPARE(fb, reference); } - -// When using multiple FBOs at the same time, unbinding one FBO should re-bind the -// previous. I.e. It should be possible to have a stack of FBOs where pop'ing there -// top re-binds the one underneeth. -void tst_QGL::stackedFBOs() -{ - if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) - QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle); - - QGLWidget glw; - glw.show(); - -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&glw); -#endif - QTest::qWait(200); - - glw.makeCurrent(); - - // No multisample with combined depth/stencil attachment: - QGLFramebufferObjectFormat fboFormat; - fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil); - - // Don't complicate things by using NPOT: - QGLFramebufferObject *fbo1 = new QGLFramebufferObject(128, 128, fboFormat); - QGLFramebufferObject *fbo2 = new QGLFramebufferObject(128, 128, fboFormat); - QGLFramebufferObject *fbo3 = new QGLFramebufferObject(128, 128, fboFormat); - - glClearColor(1.0, 0.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - fbo1->bind(); - glClearColor(1.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - fbo2->bind(); - glClearColor(0.0, 1.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - fbo3->bind(); - glClearColor(0.0, 0.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - glScissor(32, 32, 64, 64); - glEnable(GL_SCISSOR_TEST); - glClearColor(0.0, 1.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - fbo3->release(); - - // Scissor rect & test should be left untouched by the fbo release... - glClearColor(0.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - fbo2->release(); - - glClearColor(1.0, 1.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - fbo1->release(); - - glClearColor(1.0, 1.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - glw.swapBuffers(); - - QImage widgetFB = glw.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32); - QImage fb1 = fbo1->toImage().convertToFormat(QImage::Format_RGB32); - QImage fb2 = fbo2->toImage().convertToFormat(QImage::Format_RGB32); - QImage fb3 = fbo3->toImage().convertToFormat(QImage::Format_RGB32); - - delete fbo1; - delete fbo2; - delete fbo3; - - QImage widgetReference(widgetFB.size(), widgetFB.format()); - QImage fb1Reference(fb1.size(), fb1.format()); - QImage fb2Reference(fb2.size(), fb2.format()); - QImage fb3Reference(fb3.size(), fb3.format()); - - QPainter widgetReferencePainter(&widgetReference); - QPainter fb1ReferencePainter(&fb1Reference); - QPainter fb2ReferencePainter(&fb2Reference); - QPainter fb3ReferencePainter(&fb3Reference); - - widgetReferencePainter.fillRect(0, 0, widgetReference.width(), widgetReference.height(), Qt::magenta); - fb1ReferencePainter.fillRect(0, 0, fb1Reference.width(), fb1Reference.height(), Qt::red); - fb2ReferencePainter.fillRect(0, 0, fb2Reference.width(), fb2Reference.height(), Qt::green); - fb3ReferencePainter.fillRect(0, 0, fb3Reference.width(), fb3Reference.height(), Qt::blue); - - // Flip y-coords to match GL for the widget (which can be any size) - widgetReferencePainter.fillRect(32, glw.height() - 96, 64, 64, Qt::yellow); - fb1ReferencePainter.fillRect(32, 32, 64, 64, Qt::white); - fb2ReferencePainter.fillRect(32, 32, 64, 64, Qt::black); - fb3ReferencePainter.fillRect(32, 32, 64, 64, Qt::cyan); - - widgetReferencePainter.end(); - fb1ReferencePainter.end(); - fb2ReferencePainter.end(); - fb3ReferencePainter.end(); - - QCOMPARE(widgetFB, widgetReference); - QCOMPARE(fb1, fb1Reference); - QCOMPARE(fb2, fb2Reference); - QCOMPARE(fb3, fb3Reference); -} - - class ColormapExtended : public QGLColormap { public: -- cgit v0.12 From 5667e9b59ab3461c23f0adf35eaf393e4097461a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 5 Nov 2009 13:24:58 +0100 Subject: Don't crash in QStateMachine when event transition listens to QApplication instance We can't assert on actually watching the watched object, since we may have installed an event filter on QApplication::instance(), in which case we will filter events for all objects. Reviewed-by: Gunnar --- src/corelib/statemachine/qstatemachine.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index cf951c9..ecf3f9c 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1616,9 +1616,8 @@ void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transitio } void QStateMachinePrivate::handleFilteredEvent(QObject *watched, QEvent *event) -{ - Q_ASSERT(qobjectEvents.contains(watched)); - if (qobjectEvents[watched].contains(event->type())) { +{ + if (qobjectEvents.value(watched).contains(event->type())) { postInternalEvent(new QStateMachine::WrappedEvent(watched, handler->cloneEvent(event))); processEvents(DirectProcessing); } -- cgit v0.12 From e0679bf4aaf3e31d2d8f4dd596fcdd76b0a7ed69 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 5 Nov 2009 14:17:56 +0100 Subject: Add test for QEventTransition when filtering on a QApplication instance Test for 8ec037effce7f515fffed6b05c011e385fb52593. Reviewed-by: Gunnar --- tests/auto/qstatemachine/tst_qstatemachine.cpp | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 9a2b2ed..fd39515 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -208,6 +208,7 @@ private slots: void task260403_clonedSignals(); void postEventFromOtherThread(); + void eventFilterForApplication(); }; tst_QStateMachine::tst_QStateMachine() @@ -4276,5 +4277,35 @@ void tst_QStateMachine::postEventFromOtherThread() QTRY_COMPARE(finishedSpy.count(), 1); } +void tst_QStateMachine::eventFilterForApplication() +{ + QStateMachine machine; + + QState *s1 = new QState(&machine); + { + machine.setInitialState(s1); + } + + QState *s2 = new QState(&machine); + + QEventTransition *transition = new QEventTransition(QCoreApplication::instance(), + QEvent::ApplicationActivate); + transition->setTargetState(s2); + s1->addTransition(transition); + + machine.start(); + QCoreApplication::processEvents(); + + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s1)); + + QCoreApplication::postEvent(QCoreApplication::instance(), + new QEvent(QEvent::ApplicationActivate)); + QCoreApplication::processEvents(); + + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s2)); +} + QTEST_MAIN(tst_QStateMachine) #include "tst_qstatemachine.moc" -- cgit v0.12 From c51cb773acb1c2ba4a89dce07c55103f8c795bcf Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 5 Nov 2009 14:07:05 +0100 Subject: Fixed crash in QPixmap::resize_helper on mac and x11 Reviewed-by: Trond --- src/gui/image/qpixmap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index c452b9a..dfeea76 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -639,13 +639,13 @@ void QPixmap::resize_helper(const QSize &s) QPixmap pm(QSize(w, h), data ? data->type : QPixmapData::PixmapType); bool uninit = false; #if defined(Q_WS_X11) - QX11PixmapData *x11Data = data->classId() == QPixmapData::X11Class ? static_cast(data.data()) : 0; + QX11PixmapData *x11Data = data && data->classId() == QPixmapData::X11Class ? static_cast(data.data()) : 0; if (x11Data) { pm.x11SetScreen(x11Data->xinfo.screen()); uninit = x11Data->flags & QX11PixmapData::Uninitialized; } #elif defined(Q_WS_MAC) - QMacPixmapData *macData = data->classId() == QPixmapData::MacClass ? static_cast(data.data()) : 0; + QMacPixmapData *macData = data && data->classId() == QPixmapData::MacClass ? static_cast(data.data()) : 0; if (macData) uninit = macData->uninit; #endif -- cgit v0.12 From cd6ed59d6a7592231ec7cc21598f160d4ba03dbe Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 5 Nov 2009 14:12:55 +0100 Subject: Remove unnessisary QGLFBOGLPaintDevice re-implementations Now QGLFBO doesn't do stacking, QGLPaintDevice's base implementation is ok to use. Reviewed-By: Trond --- src/opengl/qglframebufferobject.cpp | 30 ------------------------------ src/opengl/qglframebufferobject_p.h | 3 --- 2 files changed, 33 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 5295b6d..ddb107e 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -342,36 +342,6 @@ QGLContext *QGLFBOGLPaintDevice::context() const return fboContext; } -void QGLFBOGLPaintDevice::ensureActiveTarget() -{ - if (QGLContext::currentContext() != context()) - context()->makeCurrent(); - - QGLContext* ctx = const_cast(QGLContext::currentContext()); - Q_ASSERT(ctx); - const GLuint fboId = fbo->d_func()->fbo(); - if (ctx->d_func()->current_fbo != fboId) { - ctx->d_func()->current_fbo = fboId; - glBindFramebuffer(GL_FRAMEBUFFER_EXT, fboId); - } -} - -void QGLFBOGLPaintDevice::beginPaint() -{ - if (QGLContext::currentContext() != context()) - context()->makeCurrent(); - - wasBound = fbo->isBound(); - if (!wasBound) - fbo->bind(); -} - -void QGLFBOGLPaintDevice::endPaint() -{ - if (!wasBound) - fbo->release(); -} - bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const { QGL_FUNCP_CONTEXT; diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index c341459..800cb68 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -111,9 +111,6 @@ public: virtual QSize size() const {return fbo->size();} virtual QGLContext* context() const; virtual QGLFormat format() const {return fboFormat;} - virtual void ensureActiveTarget(); - virtual void beginPaint(); - virtual void endPaint(); void setFBO(QGLFramebufferObject* f, QGLFramebufferObject::Attachment attachment); -- cgit v0.12 From ce2316f466195054a3c02507ef27d548ee08410c Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 5 Nov 2009 14:14:52 +0100 Subject: Fix docs for QGLFramebufferObject & add warnings in bind/release Warnings are for binding/releasing when the current context isn't in the same context group as the FBO was created in. Reviewed-By: Trond --- src/opengl/qglframebufferobject.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index ddb107e..d79283e 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -846,13 +846,6 @@ bool QGLFramebufferObject::isValid() const framebuffer to this framebuffer object. Returns true upon success, false otherwise. - Since 4.6: if another QGLFramebufferObject instance was already bound - to the current context, then its handle() will be remembered and - automatically restored when release() is called. This allows multiple - framebuffer rendering targets to be stacked up. It is important that - release() is called on the stacked framebuffer objects in the reverse - order of the calls to bind(). - \sa release() */ bool QGLFramebufferObject::bind() @@ -864,6 +857,13 @@ bool QGLFramebufferObject::bind() if (!ctx) return false; // Context no longer exists. const QGLContext *current = QGLContext::currentContext(); +#ifdef QT_DEBUG + if (!current || + QGLContextPrivate::contextGroup(current) != QGLContextPrivate::contextGroup(ctx)) + { + qWarning("QGLFramebufferObject::bind() called from incompatible context"); + } +#endif glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->fbo()); d->valid = d->checkFramebufferStatus(); if (d->valid && current) @@ -889,6 +889,15 @@ bool QGLFramebufferObject::release() return false; // Context no longer exists. const QGLContext *current = QGLContext::currentContext(); + +#ifdef QT_DEBUG + if (!current || + QGLContextPrivate::contextGroup(current) != QGLContextPrivate::contextGroup(ctx)) + { + qWarning("QGLFramebufferObject::release() called from incompatible context"); + } +#endif + if (current) { current->d_ptr->current_fbo = 0; glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); -- cgit v0.12 From afe26380f10775b5ae16dc0e449ac7fdcb9b8054 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 5 Nov 2009 14:58:43 +0100 Subject: Use fallback stroker for cosmetic strokes with asymetric transforms Reviewed-by: Samuel --- src/gui/painting/qtransform.cpp | 9 ++++++--- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 8118450..1bd5842 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -2214,12 +2214,14 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale) { const QTransform::TransformationType type = transform.type(); if (type <= QTransform::TxTranslate) { - *scale = 1; + if (scale) + *scale = 1; return true; } else if (type == QTransform::TxScale) { const qreal xScale = qAbs(transform.m11()); const qreal yScale = qAbs(transform.m22()); - *scale = qMax(xScale, yScale); + if (scale) + *scale = qMax(xScale, yScale); return qFuzzyCompare(xScale, yScale); } @@ -2227,7 +2229,8 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale) + transform.m21() * transform.m21(); const qreal yScale = transform.m12() * transform.m12() + transform.m22() * transform.m22(); - *scale = qSqrt(qMax(xScale, yScale)); + if (scale) + *scale = qSqrt(qMax(xScale, yScale)); return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index d20700f..1527e72 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1221,6 +1221,9 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) } } +extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp + + void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) { Q_D(QGL2PaintEngineEx); @@ -1231,6 +1234,11 @@ void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) return; QOpenGL2PaintEngineState *s = state(); + if (pen.isCosmetic() && !qt_scaleForTransform(s->transform(), 0)) { + // QTriangulatingStroker class is not meant to support cosmetically sheared strokes. + QPaintEngineEx::stroke(path, pen); + return; + } ensureActive(); -- cgit v0.12 From 7e280ddba9eaacb5a326a4e7f5e43c536fac8655 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 5 Nov 2009 15:17:15 +0100 Subject: Set strokes as non-convex by default. Reviewed-by: Samuel --- src/gui/painting/qpaintengineex.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 9e21182..1fb8aab 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -431,6 +431,10 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) // Some engines might decide to optimize for the non-shape hint later on... uint flags = QVectorPath::WindingFill; + + if (path.elementCount() > 2) + flags |= QVectorPath::NonConvexShapeMask; + if (d->stroker.capStyle() == Qt::RoundCap || d->stroker.joinStyle() == Qt::RoundJoin) flags |= QVectorPath::CurvedShapeMask; -- cgit v0.12 From ddd5379f8581553734c6ecb3b25f7130ec95f64d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 5 Nov 2009 15:58:03 +0100 Subject: update harfbuzz to fix assamese shaping bug Synced harfbuzz to e66916e33821e71ba19479c32108a2be8bb539b2 Task-number: QTBUG-1802 Reviewed-by: Eskil --- src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp | 6 ++++-- src/3rdparty/harfbuzz/tests/shaping/main.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index 48f4f90..df447e6 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -566,7 +566,7 @@ static const unsigned char indicPosition[0xe00-0x900] = { None, None, None, None, None, None, None, None, - None, None, None, None, + Below, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, @@ -1252,7 +1252,9 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // farther than 3 consonants from the end of the syllable. // #### replace the HasReph property by testing if the feature exists in the font! if (form(*uc) == Consonant || (script == HB_Script_Bengali && form(*uc) == IndependentVowel)) { - beginsWithRa = (properties & HasReph) && ((len > 2) && *uc == ra && *(uc+1) == halant); + if ((properties & HasReph) && (len > 2) && + (*uc == ra || *uc == 0x9f0) && *(uc+1) == halant) + beginsWithRa = true; if (beginsWithRa && form(*(uc+2)) == Control) beginsWithRa = false; diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index a7ea417..9b6aa31 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -515,6 +515,12 @@ void tst_QScriptEngine::bengali() { 0x179, 0x151, 0x172, 0x0 } }, { { 0x995, 0x9c7, 0x9d7, 0x0 }, { 0x179, 0x151, 0x17e, 0x0 } }, + { { 0x9b0, 0x9cd, 0x9ad, 0x0 }, + { 0x168, 0x276, 0x0 } }, + { { 0x9f0, 0x9cd, 0x9ad, 0x0 }, + { 0x168, 0x276, 0x0 } }, + { { 0x9f1, 0x9cd, 0x9ad, 0x0 }, + { 0x191, 0x17d, 0x168, 0x0 } }, { {0}, {0} } }; @@ -652,6 +658,12 @@ void tst_QScriptEngine::bengali() { 0x01fe, 0x0 } }, { { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 }, { 0x10b, 0x167, 0x0 } }, + { { 0x9b0, 0x9cd, 0x9ad, 0x0 }, + { 0xa1, 0x167, 0x0 } }, + { { 0x9f0, 0x9cd, 0x9ad, 0x0 }, + { 0xa1, 0x167, 0x0 } }, + { { 0x9f1, 0x9cd, 0x9ad, 0x0 }, + { 0x11c, 0xa1, 0x0 } }, { {0}, {0} } }; -- cgit v0.12 From 6f9ae6917d0b278df72ec74cee4a62b86cd81cc7 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 5 Nov 2009 16:32:38 +0100 Subject: Fix a bug in malayalam rendering Updated to harfbuzz e6636cadacf220785fca12b741b4587ff1ee42ec. Fixes a bug with the rendering of samvruthokaram (combination of 0xd41 + 0xd4d) in malayalam. Task-number: Parts of QTBUG-1887 Reviewed-by: Eskil --- src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp | 4 ++++ src/3rdparty/harfbuzz/tests/shaping/main.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index df447e6..3008fca 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -1746,6 +1746,10 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int ++pos; continue; } + if (script == HB_Script_Malayalam && state == Matra && uc[pos-1] == 0x0d41) { + ++pos; + continue; + } goto finish; case Nukta: if (state == Consonant) diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 9b6aa31..41f2dbb 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -979,6 +979,8 @@ void tst_QScriptEngine::malayalam() { 0x5e, 0x34, 0x65, 0x0 } }, { { 0xd15, 0xd57, 0x0 }, { 0x34, 0x65, 0x0 } }, + { { 0xd1f, 0xd4d, 0xd1f, 0xd41, 0xd4d, 0x0 }, + { 0x69, 0x5b, 0x64, 0x0 } }, { {0}, {0} } }; -- cgit v0.12 From 5864f84b22e7ce6dfc49b50c3f56e7792af1076b Mon Sep 17 00:00:00 2001 From: gunnar Date: Thu, 5 Nov 2009 19:53:55 +0100 Subject: Fixed warning in lance on printf with wrong types Reviewed-by: TrustMe --- tests/arthur/common/paintcommands.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp index 475f07d..44deb0e 100644 --- a/tests/arthur/common/paintcommands.cpp +++ b/tests/arthur/common/paintcommands.cpp @@ -974,7 +974,7 @@ void PaintCommands::command_drawPixmap(QRegExp re) if (sh == 0) sh = -1; if (m_verboseMode) - printf(" -(lance) drawPixmap('%s' dim=(%d, %d), depth=%d, (%d, %d, %d, %d), (%d, %d, %d, %d)\n", + printf(" -(lance) drawPixmap('%s' dim=(%d, %d), depth=%d, (%f, %f, %f, %f), (%f, %f, %f, %f)\n", qPrintable(re.cap(1)), pm.width(), pm.height(), pm.depth(), tx, ty, tw, th, sx, sy, sw, sh); @@ -1022,7 +1022,7 @@ void PaintCommands::command_drawImage(QRegExp re) if (sh == 0) sh = -1; if (m_verboseMode) - printf(" -(lance) drawImage('%s' dim=(%d, %d), (%d, %d, %d, %d), (%d, %d, %d, %d)\n", + printf(" -(lance) drawImage('%s' dim=(%d, %d), (%f, %f, %f, %f), (%f, %f, %f, %f)\n", qPrintable(re.cap(1)), im.width(), im.height(), tx, ty, tw, th, sx, sy, sw, sh); m_painter->drawImage(QRectF(tx, ty, tw, th), im, QRectF(sx, sy, sw, sh), Qt::OrderedDither | Qt::OrderedAlphaDither); -- cgit v0.12 From e9ed3d523ecec3a9af58c78dbe3fbf4c7cc6d6fe Mon Sep 17 00:00:00 2001 From: gunnar Date: Thu, 5 Nov 2009 19:55:15 +0100 Subject: Fixed bad joins in the new stroker... Normal generation was broken. Reviewed-by: Trustme --- src/opengl/gl2paintengineex/qtriangulatingstroker_p.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index 97eabef..defa3f1 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -129,9 +129,9 @@ inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, fl float pw; if (dx == 0) - pw = m_width / dy; + pw = m_width / qAbs(dy); else if (dy == 0) - pw = m_width / dx; + pw = m_width / qAbs(dx); else pw = m_width / sqrt(dx*dx + dy*dy); @@ -259,8 +259,6 @@ void QTriangulatingStroker::lineTo(const qreal *pts) - - void QTriangulatingStroker::join(const qreal *pts) { // Creates a join to the next segment (m_cx, m_cy) -> (pts[0], pts[1]) -- cgit v0.12 From 13077781b0e54b53c5610638b1ab7abfc021f263 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 6 Nov 2009 07:56:56 +0100 Subject: fix painting on Windows CE it seems the timer id ~0 is already used on windows ce or not available at all. This has caused Qt to not receive the timer messages, causing to not update. Task-number: qtbug-5496 Reviewed-by: Gunnar Sletta --- src/corelib/kernel/qeventdispatcher_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index ccf5b96..29b7568 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -470,7 +470,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) } return 0; } else if (message == WM_TIMER) { - if (wp == ~0u) { + if (wp == ~1u) { KillTimer(d->internalHwnd, wp); int localSerialNumber = d->serialNumber; (void) d->wakeUps.fetchAndStoreRelease(0); @@ -488,7 +488,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) if (GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER) != 0) { // delay the next pass of sendPostedEvents() until we get the special // WM_TIMER, which allows all pending Windows messages to be processed - SetTimer(d->internalHwnd, ~0u, 0, 0); + SetTimer(d->internalHwnd, ~1u, 0, 0); } else { // nothing pending in the queue, let sendPostedEvents go through d->wakeUps.fetchAndStoreRelease(0); -- cgit v0.12 From dd877a22f2d148a90e010dbac497426199ad6284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 5 Nov 2009 16:55:36 +0100 Subject: Fixed uninitialized background artifacts in QWidget::render. We need to use isOpaque to check whether the widget has an opaque background, it's not enough to just check the palette (it doesn't check Qt::NoSystemBackground for example). Task-number: QTBUG-5012 Reviewed-by: Gunnar Sletta --- src/gui/kernel/qwidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 386bf71..271b939 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5171,8 +5171,7 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset return; QPixmap pixmap(size); - if (!(renderFlags & QWidget::DrawWindowBackground) - || !q->palette().brush(q->backgroundRole()).isOpaque()) + if (!(renderFlags & QWidget::DrawWindowBackground) || !isOpaque) pixmap.fill(Qt::transparent); q->render(&pixmap, QPoint(), toBePainted, renderFlags); -- cgit v0.12 From 74e554cd98add74070d9b6d4630c51bbc5d3620e Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 6 Nov 2009 10:10:46 +0100 Subject: Updated testcase since soft-light algorithm rewrite. The SVG standard changed the algorithm which implies some changes to the results as well. Reviewed-by: Kim --- tests/auto/qpainter/tst_qpainter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 8ed83cb..bcdbe56 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -4193,9 +4193,9 @@ void tst_QPainter::extendedBlendModes() QVERIFY(testCompositionMode(255, 255, 255, QPainter::CompositionMode_SoftLight)); QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_SoftLight)); - QVERIFY(testCompositionMode(127, 127, 127, QPainter::CompositionMode_SoftLight)); - QVERIFY(testCompositionMode( 63, 63, 86, QPainter::CompositionMode_SoftLight)); - QVERIFY(testCompositionMode(127, 63, 63, QPainter::CompositionMode_SoftLight)); + QVERIFY(testCompositionMode(127, 127, 126, QPainter::CompositionMode_SoftLight)); + QVERIFY(testCompositionMode( 63, 63, 39, QPainter::CompositionMode_SoftLight)); + QVERIFY(testCompositionMode(127, 63, 62, QPainter::CompositionMode_SoftLight)); QVERIFY(testCompositionMode(255, 255, 0, QPainter::CompositionMode_Difference)); QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_Difference)); -- cgit v0.12 From 3ad67135d3f848241469752b91cc12e5c4fcc81b Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 6 Nov 2009 10:13:27 +0100 Subject: Revert micro optimization where NoPen == NoBrush as SVG relies on this Reviewed-by: Samuel --- src/gui/painting/qpen.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 1ddadf2..a57450d 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -845,9 +845,7 @@ bool QPen::operator==(const QPen &p) const || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) && pdd->dashPattern == dd->dashPattern)) && p.d->brush == d->brush - && pdd->cosmetic == dd->cosmetic) - || ((p.d->style == Qt::NoPen || p.d->brush.style() == Qt::NoBrush) - && (d->style == Qt::NoPen || d->brush.style() == Qt::NoBrush)); + && pdd->cosmetic == dd->cosmetic); } -- cgit v0.12 From 801ec284276b9e20c5cbdfd3cb67eb9d3ae66f77 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 6 Nov 2009 11:58:38 +0100 Subject: update harfbuzz once again, adding N'Ko support integrate/update to change 797fe54d9ebbafb0cdc00705c008ea09e7ac1e9e from harfbuzz: commit 797fe54d9ebbafb0cdc00705c008ea09e7ac1e9e Author: Lars Knoll Date: Fri Nov 6 11:56:44 2009 +0100 add N'Ko support to the arabic shaper Long outstanding bug report for Qt. See http://bugreports.qt.nokia.com/browse/QTBUG-1042 Task-number: part of QTBUG-1042 Reviewed-by: Gunnar --- src/3rdparty/harfbuzz/src/harfbuzz-arabic.c | 60 +++++++++++++++++++++++++-- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 8 +++- src/3rdparty/harfbuzz/src/harfbuzz-shaper.h | 2 +- src/3rdparty/harfbuzz/tests/shaping/main.cpp | 35 ++++++++++++++++ 4 files changed, 99 insertions(+), 6 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c index 4d85c19..3837087 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c @@ -489,6 +489,56 @@ static void getArabicProperties(const unsigned short *chars, int len, HB_ArabicP */ } +static Joining getNkoJoining(unsigned short uc) +{ + if (uc < 0x7ca) + return JNone; + if (uc <= 0x7ea) + return JDual; + if (uc <= 0x7f3) + return JTransparent; + if (uc <= 0x7f9) + return JNone; + if (uc == 0x7fa) + return JCausing; + return JNone; +} + +static void getNkoProperties(const unsigned short *chars, int len, HB_ArabicProperties *properties) +{ + int lastPos = 0; + int i = 0; + + Joining j = getNkoJoining(chars[0]); + ArabicShape shape = joining_table[XIsolated][j].form2; + properties[0].justification = HB_NoJustification; + + for (i = 1; i < len; ++i) { + properties[i].justification = (HB_GetUnicodeCharCategory(chars[i]) == HB_Separator_Space) ? + ArabicSpace : ArabicNone; + + j = getNkoJoining(chars[i]); + + if (j == JTransparent) { + properties[i].shape = XIsolated; + continue; + } + + properties[lastPos].shape = joining_table[shape][j].form1; + shape = joining_table[shape][j].form2; + + + lastPos = i; + } + properties[lastPos].shape = joining_table[shape][JNone].form1; + + + /* + for (int i = 0; i < len; ++i) + qDebug("nko properties(%d): uc=%x shape=%d, justification=%d", i, chars[i], properties[i].shape, properties[i].justification); + */ +} + /* // The unicode to unicode shaping codec. // does only presentation forms B at the moment, but that should be enough for @@ -1012,7 +1062,10 @@ static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok) if (f + l + item->item.pos < item->stringLength) { ++l; } - getArabicProperties(uc+f, l, props); + if (item->item.script == HB_Script_Nko) + getNkoProperties(uc+f, l, props); + else + getArabicProperties(uc+f, l, props); for (i = 0; i < (int)item->num_glyphs; i++) { apply[i] = 0; @@ -1051,7 +1104,8 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item) HB_Bool haveGlyphs; HB_STACKARRAY(HB_UChar16, shapedChars, item->item.length); - assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac); + assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac + || item->item.script == HB_Script_Nko); #ifndef NO_OPENTYPE @@ -1065,7 +1119,7 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item) } #endif - if (item->item.script == HB_Script_Syriac) + if (item->item.script != HB_Script_Arabic) return HB_BasicShape(item); shapedString(item->string, item->stringLength, item->item.pos, item->item.length, shapedChars, &slen, diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index f92bb55..f3ec8e1 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -637,7 +637,9 @@ const HB_ScriptEngine HB_ScriptEngines[] = { // Runic { HB_BasicShape, 0 }, // Khmer - { HB_KhmerShape, HB_KhmerAttributes } + { HB_KhmerShape, HB_KhmerAttributes }, + // N'Ko + { HB_ArabicShape, 0} }; void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, @@ -877,7 +879,9 @@ static const OTScripts ot_scripts [] = { // Runic { HB_MAKE_TAG('r', 'u', 'n', 'r'), 0 }, // Khmer - { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 } + { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 }, + // N'Ko + { HB_MAKE_TAG('n', 'k', 'o', ' '), 1 } }; enum { NumOTScripts = sizeof(ot_scripts)/sizeof(OTScripts) }; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h index d2357f43..f7c7714 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h @@ -62,6 +62,7 @@ typedef enum { HB_Script_Ogham, HB_Script_Runic, HB_Script_Khmer, + HB_Script_Nko, HB_Script_Inherited, HB_ScriptCount = HB_Script_Inherited /* @@ -102,7 +103,6 @@ typedef enum { HB_Script_Cuneiform = Common, HB_Script_Phoenician = Common, HB_Script_PhagsPa = Common, - HB_Script_Nko = Common */ } HB_Script; diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 41f2dbb..12fa7c4 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -181,6 +181,7 @@ private slots: void sinhala(); void khmer(); + void nko(); void linearB(); }; @@ -1075,6 +1076,40 @@ void tst_QScriptEngine::khmer() } } +void tst_QScriptEngine::nko() +{ + { + FT_Face face = loadFace("DejaVuSans.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x7ca, 0x0 }, + { 0x5c1, 0x0 } }, + { { 0x7ca, 0x7ca, 0x0 }, + { 0x14db, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7fa, 0x7ca, 0x0 }, + { 0x14db, 0x5ec, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7f3, 0x7ca, 0x0 }, + { 0x14db, 0x5e7, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7f3, 0x7fa, 0x7ca, 0x0 }, + { 0x14db, 0x5e7, 0x5ec, 0x14d9, 0x0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Nko) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVuSans.ttf", SkipAll); + } + } +} + + void tst_QScriptEngine::linearB() { { -- cgit v0.12 From 72744124de623a60d656668ea718728fc8666a1c Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 6 Nov 2009 12:03:10 +0100 Subject: add support for the N'Ko writing system to Qt Enables N'Ko support in Qt, after having now a harfbuzz version that supports it. Task-number: QTBUG-1042 Reviewed-by: Gunnar --- src/corelib/tools/qunicodetables_p.h | 4 +- src/gui/text/qfontdatabase.cpp | 23 +++++++-- src/gui/text/qfontdatabase.h | 1 + src/gui/text/qfontdatabase_x11.cpp | 93 +++++++++++++++++++----------------- 4 files changed, 72 insertions(+), 49 deletions(-) diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h index e4041b4..4e9ce4d 100644 --- a/src/corelib/tools/qunicodetables_p.h +++ b/src/corelib/tools/qunicodetables_p.h @@ -114,6 +114,7 @@ namespace QUnicodeTables { Ogham, Runic, Khmer, + Nko, Inherited, ScriptCount = Inherited, Latin = Common, @@ -152,8 +153,7 @@ namespace QUnicodeTables { Balinese = Common, Cuneiform = Common, Phoenician = Common, - PhagsPa = Common, - Nko = Common + PhagsPa = Common }; enum { ScriptSentinel = 32 }; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index fb8444e..7d17e49 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -534,6 +534,12 @@ static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { { 0, 127 }, // same as latin1 // Other, { 126, 127 } + // Ogham, + { 78, 127 }, + // Runic, + { 79, 127 }, + // Nko, + { 14, 127 }, }; #define SimplifiedChineseCsbBit 18 @@ -873,7 +879,8 @@ static const int scriptForWritingSystem[] = { QUnicodeTables::Common, // Braille QUnicodeTables::Common, // Symbol QUnicodeTables::Ogham, // Ogham - QUnicodeTables::Runic // Runic + QUnicodeTables::Runic, // Runic + QUnicodeTables::Nko // Nko }; @@ -881,12 +888,12 @@ static const int scriptForWritingSystem[] = { static inline bool requiresOpenType(int writingSystem) { return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) - || writingSystem == QFontDatabase::Khmer); + || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko); } static inline bool scriptRequiresOpenType(int script) { return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala) - || script == QUnicodeTables::Khmer); + || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko); } #endif @@ -1558,6 +1565,7 @@ QFontDatabase::QFontDatabase() \value Other (the same as Symbol) \value Ogham \value Runic + \value Nko \omitvalue WritingSystemsCount */ @@ -2232,6 +2240,9 @@ QString QFontDatabase::writingSystemName(WritingSystem writingSystem) case Runic: name = QT_TRANSLATE_NOOP("QFontDatabase", "Runic"); break; + case Nko: + name = QT_TRANSLATE_NOOP("QFontDatabase", "N'Ko"); + break; default: Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter"); break; @@ -2445,6 +2456,12 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem) sample += QChar(0x16a2); sample += QChar(0x16a3); break; + case Nko: + sample += QChar(0x7ca); + sample += QChar(0x7cb); + sample += QChar(0x7cc); + sample += QChar(0x7cd); + break; default: break; } diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index e6dcfc9..37b5860 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -108,6 +108,7 @@ public: Ogham, Runic, + Nko, WritingSystemsCount }; diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index f184811..dd575f9 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -155,187 +155,187 @@ static const char writingSystems_for_xlfd_encoding[sizeof(xlfd_encoding)][QFontD { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-2 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-3 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-4 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-9 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-10 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-13 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-14 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-15 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // hp-roman8 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-5 { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // *-cp1251 { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // koi8-ru { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // koi8-u { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // koi8-r { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-7 { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-8 { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // gb18030-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0 }, + 0, 0 }, // gb18030.2000-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0 }, + 0, 0 }, // gbk-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0 }, + 0, 0 }, // gb2312.*-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0 }, + 0, 0 }, // jisx0201*-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0 }, + 0, 0 }, // jisx0208*-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0 }, + 0, 0 }, // ksc5601*-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0 }, + 0, 0 }, // big5hkscs-0 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0 }, + 0, 0 }, // hkscs-1 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0 }, + 0, 0 }, // big5*-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0 }, + 0, 0 }, // tscii-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // tis620*-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-11 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // mulelao-1 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // ethiopic-unicode { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso10646-1 { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, - 0 }, + 0, 0 }, // unicode-* { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, - 0 }, + 0, 0 }, // *-symbol { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 }, + 1, 0 }, // *-fontspecific { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 }, + 1, 0 }, // fontspecific-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 } + 1, 0 } }; @@ -835,7 +835,8 @@ static const char *specialLanguages[] = { "ko", // Hangul "", // Ogham "", // Runic - "km" // Khmer + "km", // Khmer + "" // N'Ko }; enum { SpecialLanguageCount = sizeof(specialLanguages) / sizeof(const char *) }; @@ -866,7 +867,8 @@ static const ushort specialChars[] = { 0, // Hangul 0x1681, // Ogham 0x16a0, // Runic - 0 // Khmer + 0, // Khmer + 0x7ca // N'Ko }; enum { SpecialCharCount = sizeof(specialChars) / sizeof(ushort) }; @@ -905,7 +907,8 @@ static const char *languageForWritingSystem[] = { "vi", // Vietnamese 0, // Symbol 0, // Ogham - 0 // Runic + 0, // Runic + 0 // N'Ko }; enum { LanguageCount = sizeof(languageForWritingSystem) / sizeof(const char *) }; @@ -944,7 +947,8 @@ static const ushort sampleCharForWritingSystem[] = { 0, // Vietnamese 0, // Symbol 0x1681, // Ogham - 0x16a0 // Runic + 0x16a0, // Runic + 0x7ca // N'Ko }; enum { SampleCharCount = sizeof(sampleCharForWritingSystem) / sizeof(ushort) }; @@ -984,7 +988,8 @@ static const char *openType[] = { 0, // Vietnamese 0, // Symbol 0, // Ogham - 0 // Runic + 0, // Runic + "nko " // N'Ko }; enum { OpenTypeCount = sizeof(openType) / sizeof(const char *) }; @@ -1472,7 +1477,7 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD !(request.styleStrategy & QFont::NoAntialias)); } - if (script != QUnicodeTables::Common) { + if (script != QUnicodeTables::Common && *specialLanguages[script] != '\0') { Q_ASSERT(script < QUnicodeTables::ScriptCount); FcLangSet *ls = FcLangSetCreate(); FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]); @@ -1615,7 +1620,7 @@ static QFontEngine *tryPatternLoad(FcPattern *p, int screen, goto done; if (!FcCharSetHasChar(cs, specialChars[script])) goto done; - } else { + } else if (*specialLanguages[script] != '\0'){ FcLangSet *langSet = 0; if (FcPatternGetLangSet(match, FC_LANG, 0, &langSet) != FcResultMatch) goto done; -- cgit v0.12 From 16a9dc214150b4531759b2ca43a2abb4f3cf7d99 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 6 Nov 2009 12:04:53 +0100 Subject: update documentation We are at Unicode 5.1, not 4.0 Tell about N'Ko support. Reviewed-by: Gunnar --- doc/src/internationalization/i18n.qdoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc index 2d1b8cc..ecc25fe 100644 --- a/doc/src/internationalization/i18n.qdoc +++ b/doc/src/internationalization/i18n.qdoc @@ -93,7 +93,7 @@ \o Greek \o Hebrew \o Thai and Lao - \o All scripts in Unicode 4.0 that do not require special processing + \o All scripts in Unicode 5.1 that do not require special processing \endlist On Windows, Unix/X11 with FontConfig (client side font support) @@ -112,6 +112,7 @@ \o Tamil \o Telugu \o Tibetan + \o N'Ko \endlist Many of these writing systems exhibit special features: @@ -181,7 +182,7 @@ \section2 Use QString for All User-Visible Text - Since QString uses the Unicode 4.0 encoding internally, every + Since QString uses the Unicode 5.1 encoding internally, every language in the world can be processed transparently using familiar text processing operations. Also, since all Qt functions that present text to the user take a QString as a parameter, -- cgit v0.12 From 0f73f9bab8e276890fd760bb7f88a63bdd45c520 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 6 Nov 2009 12:11:48 +0100 Subject: Fixed crash in qt_scale_image_16/32bit() when target is flipped. If the target rectangle had negative width or height and the target rectangle's border passed through pixel centres, qt_scale_image_16/32bit() could crash because of incorrect rounding. Task-number: 5493 Reviewed-by: Gunnar --- src/gui/painting/qblendfunctions.cpp | 40 ++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index f8dd424..8737f10 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -223,11 +223,23 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl, int h = ty2 - ty1; int w = tx2 - tx1; - const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1; - const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1; + quint32 basex; + quint32 srcy; - quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx; - quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty; + if (sx < 0) { + int dstx = qFloor((tx1 + 0.5 - targetRect.right()) * ix) + 1; + basex = quint32(srcRect.right() * 65536) + dstx; + } else { + int dstx = qCeil((tx1 + 0.5 - targetRect.left()) * ix) - 1; + basex = quint32(srcRect.left() * 65536) + dstx; + } + if (sy < 0) { + int dsty = qFloor((ty1 + 0.5 - targetRect.bottom()) * iy) + 1; + srcy = quint32(srcRect.bottom() * 65536) + dsty; + } else { + int dsty = qCeil((ty1 + 0.5 - targetRect.top()) * iy) - 1; + srcy = quint32(srcRect.top() * 65536) + dsty; + } quint16 *dst = ((quint16 *) (destPixels + ty1 * dbpl)) + tx1; @@ -723,11 +735,23 @@ template void qt_scale_image_32bit(uchar *destPixels, int dbpl, int h = ty2 - ty1; int w = tx2 - tx1; - const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1; - const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1; + quint32 basex; + quint32 srcy; - quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx; - quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty; + if (sx < 0) { + int dstx = qFloor((tx1 + 0.5 - targetRect.right()) * ix) + 1; + basex = quint32(srcRect.right() * 65536) + dstx; + } else { + int dstx = qCeil((tx1 + 0.5 - targetRect.left()) * ix) - 1; + basex = quint32(srcRect.left() * 65536) + dstx; + } + if (sy < 0) { + int dsty = qFloor((ty1 + 0.5 - targetRect.bottom()) * iy) + 1; + srcy = quint32(srcRect.bottom() * 65536) + dsty; + } else { + int dsty = qCeil((ty1 + 0.5 - targetRect.top()) * iy) - 1; + srcy = quint32(srcRect.top() * 65536) + dsty; + } quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1; -- cgit v0.12 From 0345410e29bac602ececbd5045c455dd2db59b32 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 6 Nov 2009 12:43:40 +0100 Subject: don't do unessesary brush comparrisons Reviewed-by: Samuel --- src/gui/painting/qpainter.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 09a4563..4c13d3e 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -3890,14 +3890,6 @@ void QPainter::setBrush(const QBrush &brush) return; } - Qt::BrushStyle currentStyle = d->state->brush.style(); - if (currentStyle == brush.style()) { - if (currentStyle == Qt::NoBrush - || (currentStyle == Qt::SolidPattern - && d->state->brush.color() == brush.color())) - return; - } - d->state->brush = brush; d->state->dirtyFlags |= QPaintEngine::DirtyBrush; } -- cgit v0.12 From c9b6ad8169c283d0a8525c2f3113ee5e4a276c33 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 6 Nov 2009 12:44:34 +0100 Subject: Compile Missing comma in qfontdatabase.cpp Reviewed-by: Gunnar --- src/gui/text/qfontdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 7d17e49..7e93aa0 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -533,7 +533,7 @@ static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { // Vietnamese, { 0, 127 }, // same as latin1 // Other, - { 126, 127 } + { 126, 127 }, // Ogham, { 78, 127 }, // Runic, -- cgit v0.12 From bffa9cbb0e123f3dd1ffd0f084d068fa673cbed7 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 6 Nov 2009 12:59:35 +0100 Subject: Fix QPainter::setPen(pen with color but no style) on non-extended. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was working with a QImage but not with a QPixmap, which is obviously a bug. In addition, it broke WebCore::GraphicsContext::setPlatformStrokeColor which does exactly what I put in the unittest: get pen, set color, set pen. This commit fixes the wrong color in the underline of the links in http://www.davidfaure.fr/kde/link_underline_color.html in QtWebkit. Merge-request: 1995 Reviewed-by: Samuel Rødal --- src/gui/painting/qpainter.cpp | 17 ++-------------- tests/auto/qpainter/tst_qpainter.cpp | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 4c13d3e..48629d1 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -3787,27 +3787,14 @@ void QPainter::setPen(const QPen &pen) if (d->state->pen == pen) return; + d->state->pen = pen; + if (d->extended) { - d->state->pen = pen; d->checkEmulation(); d->extended->penChanged(); return; } - // Do some checks to see if we are the same pen. - Qt::PenStyle currentStyle = d->state->pen.style(); - if (currentStyle == pen.style() && currentStyle != Qt::CustomDashLine) { - if (currentStyle == Qt::NoPen || - (d->state->pen.isSolid() && pen.isSolid() - && d->state->pen.color() == pen.color() - && d->state->pen.widthF() == pen.widthF() - && d->state->pen.capStyle() == pen.capStyle() - && d->state->pen.joinStyle() == pen.joinStyle() - && d->state->pen.isCosmetic() == pen.isCosmetic())) - return; - } - - d->state->pen = pen; d->state->dirtyFlags |= QPaintEngine::DirtyPen; } diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index bcdbe56..4d2c626 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -239,9 +239,12 @@ private slots: void taskQT4444_dontOverflowDashOffset(); void painterBegin(); + void setPenColorOnImage(); + void setPenColorOnPixmap(); private: void fillData(); + void setPenColor(QPainter& p); QColor baseColor( int k, int intensity=255 ); QImage getResImage( const QString &dir, const QString &addition, const QString &extension ); QBitmap getBitmap( const QString &dir, const QString &filename, bool mask ); @@ -4352,5 +4355,41 @@ void tst_QPainter::painterBegin() QVERIFY(!p.end()); } +void tst_QPainter::setPenColor(QPainter& p) +{ + p.setPen(Qt::NoPen); + + // Setting color, then style + // Should work even though the pen is "NoPen with color", temporarily. + QPen newPen(p.pen()); + newPen.setColor(Qt::red); + QCOMPARE(p.pen().style(), newPen.style()); + QCOMPARE(p.pen().style(), Qt::NoPen); + p.setPen(newPen); + + QCOMPARE(p.pen().color().name(), QString("#ff0000")); + + QPen newPen2(p.pen()); + newPen2.setStyle(Qt::SolidLine); + p.setPen(newPen2); + + QCOMPARE(p.pen().color().name(), QString("#ff0000")); +} + +void tst_QPainter::setPenColorOnImage() +{ + QImage img(QSize(10, 10), QImage::Format_ARGB32_Premultiplied); + QPainter p(&img); + setPenColor(p); +} + +void tst_QPainter::setPenColorOnPixmap() +{ + QPixmap pix(10, 10); + QPainter p(&pix); + setPenColor(p); +} + QTEST_MAIN(tst_QPainter) + #include "tst_qpainter.moc" -- cgit v0.12 From 8df2c631632694328c84c667a4022b1bcaac3b32 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 6 Nov 2009 12:58:58 +0100 Subject: Fix fuzzy aliased rendering on GLES2 The GL2 paint engine adds a (0.49,0.49) pixel offset when doing aliased rendering. But this assumed if it was doing aliased rendering then multisampling was disabled. On GLES, multisampling is always enabled if the surface has it enabled. So on GLES, we never add the offset if the surface is multisampled. Reviewed-By: Gunnar --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 14 ++++++++++++-- src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 1527e72..8228c7e 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1203,7 +1203,9 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) ensureActive(); QOpenGL2PaintEngineState *s = state(); - bool doOffset = !(s->renderHints & QPainter::Antialiasing) && style == Qt::SolidPattern; + bool doOffset = !(s->renderHints & QPainter::Antialiasing) && + (style == Qt::SolidPattern) && + !d->multisamplingAlwaysEnabled; if (doOffset) { d->temporaryTransform = s->matrix; @@ -1242,7 +1244,7 @@ void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) ensureActive(); - bool doOffset = !(s->renderHints & QPainter::Antialiasing); + bool doOffset = !(s->renderHints & QPainter::Antialiasing) && !d->multisamplingAlwaysEnabled; if (doOffset) { d->temporaryTransform = s->matrix; QTransform tx = QTransform::fromTranslate(0.49, .49); @@ -1780,6 +1782,14 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) } #endif +#if defined(QT_OPENGL_ES_2) + // OpenGL ES can't switch MSAA off, so if the gl paint device is + // multisampled, it's always multisampled. + d->multisamplingAlwaysEnabled = d->device->format().sampleBuffers(); +#else + d->multisamplingAlwaysEnabled = false; +#endif + return true; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 4cf2a83..9720723 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -277,6 +277,7 @@ public: bool needsSync; bool inRenderText; + bool multisamplingAlwaysEnabled; GLfloat depthRange[2]; -- cgit v0.12 From 048989dedeba6a719760bbc96ebb99a44669d54d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 6 Nov 2009 22:04:18 +1000 Subject: Fix error when configuring on Unix using an evaluation license. If you run configure on Unix more than once using an eval license (or -DQT_EVAL), configure outputs an error and fails to overwrite src/corelib/global/qconfig_eval.cpp. This is corrected simply by removing any existing instance of the file before re-creating it. Reviewed-by: Trust Me --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index a8d9147..aab520e 100755 --- a/configure +++ b/configure @@ -4195,6 +4195,7 @@ elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then fi if [ -n "$EVALKEY" ]; then + rm -f "$outpath/src/corelib/global/qconfig_eval.cpp" cat > "$outpath/src/corelib/global/qconfig_eval.cpp" < Date: Fri, 6 Nov 2009 13:05:32 +0100 Subject: Fixed g++ compiler warnings in qpen.cpp. --- src/gui/painting/qpen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index a57450d..77aa748 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -984,7 +984,7 @@ QDataStream &operator>>(QDataStream &s, QPen &p) QDebug operator<<(QDebug dbg, const QPen &p) { #ifndef Q_BROKEN_DEBUG_STREAM - char *PEN_STYLES[] = { + const char *PEN_STYLES[] = { "NoPen", "SolidLine", "DashLine", -- cgit v0.12 From 6d7d54813f4cfc326fc52d3402653b924677124a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Nov 2009 14:13:42 +0100 Subject: Fix QT_NO_GRAPHICSVIEW Reviewed-by: paul --- src/gui/kernel/qgesturemanager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 628892d..a0b94b2 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -175,8 +175,10 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni return 0; } else if (QGesture *g = qobject_cast(object)) { return g; +#ifndef QT_NO_GRAPHICSVIEW } else { Q_ASSERT(qobject_cast(object)); +#endif } QList states = -- cgit v0.12 From e59c34d93f99530c4b3c69ac7ef6e61d033edef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 6 Nov 2009 14:26:11 +0100 Subject: docs: Add a section about known issues for the anchor layout. --- src/gui/graphicsview/qgraphicsanchorlayout.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 56d70e1..872ec3c 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -83,10 +83,8 @@ \clearfloat \section1 Size Hints and Size Policies in an Anchor Layout - QGraphicsAnchorLayout respects each item's size hints and size policies. However it does - not currently respect their stretch factors. This might change in the future, so avoid - using stretch factors in anchor layouts if you want to avoid any future regressions in - behavior. + QGraphicsAnchorLayout respects each item's size hints and size policies. + Note that there are some properties of QSizePolicy that are \l{Known issues}{not respected}. \section1 Spacing within an Anchor Layout @@ -101,6 +99,21 @@ If the spacing is negative, the items will overlap to some extent. + + \section1 Known issues + There are some features that QGraphicsAnchorLayout currently does not support. + This might change in the future, so avoid using these features if you want to + avoid any future regressions in behaviour: + \list + + \o Stretch factors are not respected. + + \o QSizePolicy::ExpandFlag is not respected. + + \o Height for width is not respected. + + \endlist + \sa QGraphicsLinearLayout, QGraphicsGridLayout, QGraphicsLayout */ -- cgit v0.12 From 4ad6343be52b757fd354cd92874bca944d2ede49 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 6 Nov 2009 15:15:05 +0100 Subject: Add preliminary QAccessibleImage interface As requested by the Maemo team. --- src/gui/accessible/qaccessible.h | 7 ++++- src/gui/accessible/qaccessible2.cpp | 12 ++++++++ src/gui/accessible/qaccessible2.h | 13 ++++++++ src/plugins/accessible/widgets/simplewidgets.cpp | 38 ++++++++++++++++++++++++ src/plugins/accessible/widgets/simplewidgets.h | 7 ++++- tests/auto/qaccessibility/tst_qaccessibility.cpp | 21 +++++++++++++ 6 files changed, 96 insertions(+), 2 deletions(-) diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 8f6d9d9..c493054 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -311,7 +311,8 @@ namespace QAccessible2 EditableTextInterface, ValueInterface, TableInterface, - ActionInterface + ActionInterface, + ImageInterface }; } @@ -321,6 +322,7 @@ class QAccessibleEditableTextInterface; class QAccessibleValueInterface; class QAccessibleTableInterface; class QAccessibleActionInterface; +class QAccessibleImageInterface; class Q_GUI_EXPORT QAccessibleInterface : public QAccessible { @@ -381,6 +383,9 @@ public: inline QAccessibleActionInterface *actionInterface() { return reinterpret_cast(cast_helper(QAccessible2::ActionInterface)); } + inline QAccessibleImageInterface *imageInterface() + { return reinterpret_cast(cast_helper(QAccessible2::ImageInterface)); } + private: QAccessible2Interface *cast_helper(QAccessible2::InterfaceType); }; diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp index 0867368..b878cf1 100644 --- a/src/gui/accessible/qaccessible2.cpp +++ b/src/gui/accessible/qaccessible2.cpp @@ -120,6 +120,18 @@ QT_BEGIN_NAMESPACE \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink */ +/*! + \class QAccessibleImageInterface + \ingroup accessibility + \internal + \preliminary + + \brief The QAccessibleImageInterface class implements support for + the IAccessibleImage interface. + + \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink +*/ + QAccessibleSimpleEditableTextInterface::QAccessibleSimpleEditableTextInterface( QAccessibleInterface *accessibleInterface) : iface(accessibleInterface) diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h index 435c640..ba12a7c 100644 --- a/src/gui/accessible/qaccessible2.h +++ b/src/gui/accessible/qaccessible2.h @@ -82,6 +82,7 @@ inline QAccessible2Interface *qAccessibleTextCastHelper() { return 0; } inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; } inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; } inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; } +inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; } #define Q_ACCESSIBLE_OBJECT \ public: \ @@ -98,6 +99,8 @@ inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; } return qAccessibleTableCastHelper(); \ case QAccessible2::ActionInterface: \ return qAccessibleActionCastHelper(); \ + case QAccessible2::ImageInterface: \ + return qAccessibleImageCastHelper(); \ } \ return 0; \ } \ @@ -224,6 +227,16 @@ public: virtual QStringList keyBindings(int actionIndex) = 0; }; +class Q_GUI_EXPORT QAccessibleImageInterface : public QAccessible2Interface +{ +public: + inline QAccessible2Interface *qAccessibleImageCastHelper() { return this; } + + virtual QString imageDescription() = 0; + virtual QSize imageSize() = 0; + virtual QRect imagePosition(QAccessible2::CoordinateType coordType) = 0; +}; + #endif // QT_NO_ACCESSIBILITY QT_END_NAMESPACE diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index aa51759..1d801e4 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -602,6 +602,44 @@ int QAccessibleDisplay::navigate(RelationFlag rel, int entry, QAccessibleInterfa return QAccessibleWidgetEx::navigate(rel, entry, target); } +/*! \reimp */ +QString QAccessibleDisplay::imageDescription() +{ + return widget()->toolTip(); +} + +/*! \reimp */ +QSize QAccessibleDisplay::imageSize() +{ + QLabel *label = qobject_cast(widget()); + if (!label) + return QSize(); + const QPixmap *pixmap = label->pixmap(); + if (!pixmap) + return QSize(); + return pixmap->size(); +} + +/*! \reimp */ +QRect QAccessibleDisplay::imagePosition(QAccessible2::CoordinateType coordType) +{ + QLabel *label = qobject_cast(widget()); + if (!label) + return QRect(); + const QPixmap *pixmap = label->pixmap(); + if (!pixmap) + return QRect(); + + switch (coordType) { + case QAccessible2::RelativeToScreen: + return QRect(label->mapToGlobal(label->pos()), label->size()); + case QAccessible2::RelativeToParent: + return label->geometry(); + } + + return QRect(); +} + #ifndef QT_NO_LINEEDIT /*! \class QAccessibleLineEdit diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h index 0c1cf5e..5182bdd 100644 --- a/src/plugins/accessible/widgets/simplewidgets.h +++ b/src/plugins/accessible/widgets/simplewidgets.h @@ -111,7 +111,7 @@ protected: }; #endif // QT_NO_TOOLBUTTON -class QAccessibleDisplay : public QAccessibleWidgetEx +class QAccessibleDisplay : public QAccessibleWidgetEx, public QAccessibleImageInterface { Q_ACCESSIBLE_OBJECT public: @@ -122,6 +122,11 @@ public: Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const; int navigate(RelationFlag, int entry, QAccessibleInterface **target) const; + + // QAccessibleImageInterface + QString imageDescription(); + QSize imageSize(); + QRect imagePosition(QAccessible2::CoordinateType coordType); }; #ifndef QT_NO_LINEEDIT diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 9f2e4e7..25c2649 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -4034,6 +4034,27 @@ void tst_QAccessibility::labelTest() delete acc_label; delete label; QTestAccessibility::clearEvents(); + + QPixmap testPixmap(50, 50); + testPixmap.fill(); + + QLabel imageLabel; + imageLabel.setPixmap(testPixmap); + imageLabel.setToolTip("Test Description"); + + acc_label = QAccessible::queryAccessibleInterface(&imageLabel); + QVERIFY(acc_label); + + QAccessibleImageInterface *imageInterface = acc_label->imageInterface(); + QVERIFY(imageInterface); + + QCOMPARE(imageInterface->imageSize(), testPixmap.size()); + QCOMPARE(imageInterface->imageDescription(), QString::fromLatin1("Test Description")); + QCOMPARE(imageInterface->imagePosition(QAccessible2::RelativeToParent), imageLabel.geometry()); + + delete acc_label; + + QTestAccessibility::clearEvents(); #else QSKIP("Test needs accessibility support.", SkipAll); #endif -- cgit v0.12 From 89b6de9091adbf0645ffe2aba59cb17cb233c170 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 6 Nov 2009 15:30:20 +0100 Subject: make the qapplication constructor test more meaningful --- tests/benchmarks/qapplication/main.cpp | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/tests/benchmarks/qapplication/main.cpp b/tests/benchmarks/qapplication/main.cpp index a299db2..0ec65a8 100644 --- a/tests/benchmarks/qapplication/main.cpp +++ b/tests/benchmarks/qapplication/main.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ #include -#include #include @@ -54,34 +53,19 @@ private slots: /* Test the performance of the QApplication constructor. - This test creates a new process and thus includes process creation overhead. - Callgrind results are meaningless since the child process is not traced. + Note: results from the second start on can be misleading, + since all global statics are already initialized. */ void tst_qapplication::ctor() { - QProcess proc; - const QString program = QCoreApplication::applicationFilePath(); - const QStringList arguments = QStringList() << QLatin1String("--exit-now"); - + // simulate reasonable argc, argv + int argc = 1; + char *argv[] = { "tst_qapplication" }; QBENCHMARK { - proc.start(program, arguments); - QVERIFY(proc.waitForStarted()); - QVERIFY(proc.waitForFinished()); - QCOMPARE(proc.exitStatus(), QProcess::NormalExit); - QCOMPARE(proc.exitCode(), 0); + QApplication app(argc, argv); } } -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - - if (argc == 2 && QLatin1String("--exit-now") == QLatin1String(argv[1])) { - return 0; - } - - tst_qapplication test; - return QTest::qExec(&test, argc, argv); -} +QTEST_APPLESS_MAIN(tst_qapplication) #include "main.moc" -- cgit v0.12 From d57933fe2c74907c6256aef82374fefd55adee05 Mon Sep 17 00:00:00 2001 From: ck Date: Fri, 6 Nov 2009 16:21:17 +0100 Subject: Assistant: Fixes related to search configuration. 1. Remove superfluous definition of QT_CLUCENE_SUPPORT in assistant.pro. It was not evaluated anywhere. 2. Bugfix for searvh widget when working with non-CLucene search lib. Reviewed-by: kh1 --- tools/assistant/tools/assistant/assistant.pro | 2 -- tools/assistant/tools/assistant/searchwidget.cpp | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/assistant/tools/assistant/assistant.pro b/tools/assistant/tools/assistant/assistant.pro index 1cbd1d3..1a7e874 100644 --- a/tools/assistant/tools/assistant/assistant.pro +++ b/tools/assistant/tools/assistant/assistant.pro @@ -4,8 +4,6 @@ TEMPLATE = app LANGUAGE = C++ TARGET = assistant -DEFINES += QT_CLUCENE_SUPPORT - contains(QT_CONFIG, webkit) { QT += webkit } diff --git a/tools/assistant/tools/assistant/searchwidget.cpp b/tools/assistant/tools/assistant/searchwidget.cpp index 48fa8c6..3b456a3 100644 --- a/tools/assistant/tools/assistant/searchwidget.cpp +++ b/tools/assistant/tools/assistant/searchwidget.cpp @@ -85,7 +85,8 @@ SearchWidget::SearchWidget(QHelpSearchEngine *engine, QWidget *parent) SLOT(searchingFinished(int))); QTextBrowser* browser = qFindChild(resultWidget); - browser->viewport()->installEventFilter(this); + if (browser) // Will be null if lib was configured not to use CLucene. + browser->viewport()->installEventFilter(this); } SearchWidget::~SearchWidget() -- cgit v0.12 From 7359baee83f6691c31a0a14ffd6f6cc147ed71fd Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 6 Nov 2009 16:27:48 +0100 Subject: use pragma push/pop prevents leaking the pragma out of the header file Task-number: QT-2267 --- src/corelib/tools/qbytearraymatcher.h | 8 ++++++-- src/corelib/tools/qstringmatcher.h | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h index ef46d34..3d951cf 100644 --- a/src/corelib/tools/qbytearraymatcher.h +++ b/src/corelib/tools/qbytearraymatcher.h @@ -79,17 +79,21 @@ private: QByteArray q_pattern; #ifdef Q_CC_RVCT // explicitely allow anonymous unions for RVCT to prevent compiler warnings -#pragma anon_unions +# pragma push +# pragma anon_unions #endif struct Data { uchar q_skiptable[256]; const uchar *p; int l; - }; + }; union { uint dummy[256]; Data p; }; +#ifdef Q_CC_RVCT +# pragma pop +#endif }; QT_END_NAMESPACE diff --git a/src/corelib/tools/qstringmatcher.h b/src/corelib/tools/qstringmatcher.h index 0cb1312..8076098 100644 --- a/src/corelib/tools/qstringmatcher.h +++ b/src/corelib/tools/qstringmatcher.h @@ -79,7 +79,8 @@ private: Qt::CaseSensitivity q_cs; #ifdef Q_CC_RVCT // explicitely allow anonymous unions for RVCT to prevent compiler warnings -#pragma anon_unions +# pragma push +# pragma anon_unions #endif struct Data { uchar q_skiptable[256]; @@ -90,6 +91,9 @@ private: uint q_data[256]; Data p; }; +#ifdef Q_CC_RVCT +# pragma pop +#endif }; QT_END_NAMESPACE -- cgit v0.12 From a1aea71edada74c613124c0a0bf0bb3dba85e88a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 6 Nov 2009 16:29:16 +0100 Subject: Doc: Moved external references to a separate collection. Reviewed-by: Trust Me --- doc/src/external-resources.qdoc | 45 +++++++++++++++++++++++ doc/src/platforms/emb-directfb-EmbLinux.qdoc | 54 ++++++++++++---------------- 2 files changed, 67 insertions(+), 32 deletions(-) diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index ad6731b..8a14095 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -367,3 +367,48 @@ \externalpage http://www.kde.org \title KDE */ + +/*! + \externalpage http://www.directfb.org/index.php?path=Main%2FDownloads&page=1 + \title DirectFB - df_window example +*/ + +/*! + \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBPalette.html + \title DirectFB - IDirectFBPalette +*/ + +/*! + \externalpage http://www.cplusplus.com/reference/clibrary/cstring/memcpy/ + \title C++ Reference - memcpy +*/ + +/*! + \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFB_CreateInputEventBuffer.html + \title DirectFB - CreateInputEventBuffer +*/ + +/*! + \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceBlittingFlags + \title DirectFB - DFBSurfaceBlittingFlags +*/ + +/*! + \externalpage http://directfb.org/docs/DirectFB_Reference_1_4/IDirectFBImageProvider.html + \title DirectFB - IDirectFBImageProvider +*/ + +/*! + \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBSurface.html + \title DirectFB - IDirectFBSurface +*/ + +/*! + \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBWindow + \title DirectFB - IDirectFBWindow +*/ + +/*! + \externalpage http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceDescription + \title DirectFB - DFBSurfaceDescription +*/ diff --git a/doc/src/platforms/emb-directfb-EmbLinux.qdoc b/doc/src/platforms/emb-directfb-EmbLinux.qdoc index b863951..38782be 100644 --- a/doc/src/platforms/emb-directfb-EmbLinux.qdoc +++ b/doc/src/platforms/emb-directfb-EmbLinux.qdoc @@ -62,8 +62,7 @@ engine. And in Qt 4.6 these have been further improved. \tableofcontents \section1 Using DirectFB with Qt -DirectFB is centered around \l -{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBSurface.html}{Surfaces} +DirectFB is centered around \l{DirectFB - IDirectFBSurface}{Surfaces} which is the equivalent of a QPaintDevice. In the Qt/DirectFB plugin, DirectFB maps onto either a QPixmap or a QWindowSurface which essentially means that drawing onto QPixmap or a QWidget can be accelerated and drawing @@ -94,11 +93,11 @@ location on your host. The safest option is usually to explicitly populate these variables in your qmake.conf like this: \code - QT_CFLAGS_DIRECTFB = /opt/toolchain/gcc4.3_mipsel_linux/usr/include/directfb -D_REENTRANT QT_LIBS_DIRECTFB = -L/opt/toolchain/gcc4.3_mipsel_linux/usr/lib/-ldirect -ldirectfb -lfusion +\endcode \note While DirectFB supports a multi-process setup through a kernel-extension called Fusion this setup is not well tested with Qt. @@ -135,14 +134,13 @@ of DirectFB. The Qt DirectFB driver currently supports DirectFB versions >= 0.9. Still, there are large differences in what each actual implementation handles correctly. It is relatively common not to properly support -\l{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBWindow}{DirectFB -windows}, so Qt needs to handle this case with a different code path. In -addition, certain drivers do not properly support DirectFB's cursor -handling. This means Qt has to have a code path for rendering the cursor -itself when this is the case. Some drivers do not let us create \l -{http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceDescription}{preallocated -surfaces} which means we have to have a conditional code path for that -case. +\l{DirectFB - IDirectFBWindow}{DirectFB windows}, so Qt needs to handle +this case with a different code path. In addition, certain drivers do not +properly support DirectFB's cursor handling. This means Qt has to have a +code path for rendering the cursor itself when this is the case. +Some drivers do not let us create +\l{DirectFB - DFBSurfaceDescription}{preallocated surfaces} which means we +have to have a conditional code path for that case. \section2 Optimize performance using define options @@ -150,19 +148,17 @@ Qt/DirectFB comes with a number of defines that can be either uncommented in directfb.pri or added to the QT_DEFINES_DIRECTFB variable in your qmake.conf. -\note The defines have been moved from \i -{src/plugins/gfxdrivers/directfb/directfb.pro} to \i -{src/gui/embedded/directfb.pri} +\note The defines have been moved from +\e{src/plugins/gfxdrivers/directfb/directfb.pro} to +\e{src/gui/embedded/directfb.pri} \code - #DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP| DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON| DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS|DRAW_ROUNDED_RECT #DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" #DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" - \endcode As demonstrated above, you need to Qt which drawing operations you want to @@ -180,8 +176,7 @@ Following is a table showing which options you have. \row \o QT_DIRECTFB_IMAGECACHE \o Defining this means that Qt will cache an IDirectFBSurface per -QImage you draw based on its \l -{http://doc.trolltech.com/4.5/qimage.html#cacheKey}{cacheKey}. +QImage you draw based on its \l{QImage::}{cacheKey()}. Use this define if your application draws many QImages that remain the same. Note that if you in this situation draw an image and then change it, by calling bits() or opening a QPainter on it, the cache will @@ -192,9 +187,7 @@ connect option. \o QT_NO_DIRECTFB_WM \o If your DirectFB implementation does not support windows, you have to define this to make Qt work properly. You can test this by checking -if the \l { -http://www.directfb.org/index.php?path=Main%2FDownloads&page=1}{df_window -example} runs well. +if the \l{DirectFB - df_window example}{df_window example} runs well. This means that all drawing operations onto a QWidget involves an extra blitting step since Qt essentially first has to draw into an off-screen buffer and then blit this buffer to the back buffer of the @@ -218,9 +211,7 @@ cursor rather than letting DirectFB do it. \row \o QT_NO_DIRECTFB_PALETTE \o Define this if your DirectFB driver does not support surfaces -with \l -{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBPalette.html}{color -tables}. +with \l{DirectFB - IDirectFBPalette}{color tables}. The effect of defining this is that Qt will have to convert images with \l QImage::Format_Indexed8 format to another format before rendering them. @@ -228,16 +219,15 @@ rendering them. \row \o QT_NO_DIRECTFB_PREALLOCATED \o Define this if your DirectFB driver does not support creating a -surface with preallocated data. This will make a more frequent use of \l -{http://www.cplusplus.com/reference/clibrary/cstring/memcpy/}{memcpy()} +surface with preallocated data. This will make a more frequent use of +\l{C++ Reference - memcpy}{memcpy()} when drawing images. If you define this, you might want to consider defining QT_DIRECTFB_IMAGECACHE for better image rendering performance. \row \o QT_NO_DIRECTFB_MOUSE and QT_NO_DIRECTFB_KEYBOARD \o Define this if your driver does not provide keyboard/mouse -events through \l -{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFB_CreateInputEventBuffer.html}{CreateInputEventBuffer}. +events through \l{DirectFB - CreateInputEventBuffer}{CreateInputEventBuffer}. This means that Qt cannot use DirectFB to receive keyboard/mouse events and if you want such events in your application, you will have to provide another driver. For more info see \l {Qt for Embedded Linux Pointer @@ -251,8 +241,8 @@ frames per second. \row \o QT_NO_DIRECTFB_OPAQUE_DETECTION - \o When blitting a surface Qt has to decide whether to set the \l -{http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceBlittingFlags}{DSBLIT_BLEND_ALPHACHANNEL} + \o When blitting a surface Qt has to decide whether to set the +\l{DirectFB - DFBSurfaceBlittingFlags}{DSBLIT_BLEND_ALPHACHANNEL} flag. If you load an image from file or network data that has a format that includes an alpha channel, the image might still be completely opaque. Normally Qt runs through every pixel to check if there really is an alpha @@ -281,8 +271,8 @@ define this. \row \o QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE - \o Define this to make sure Qt always keeps at least one \l -{http://directfb.org/docs/DirectFB_Reference_1_4/IDirectFBImageProvider.html}{IDirectFBImageProvider} + \o Define this to make sure Qt always keeps at least one +\l{DirectFB - IDirectFBImageProvider}{IDirectFBImageProvider} object alive. This is to avoid considerable overhead when the first IDirectFBImageProvider is created, the last IDirectFBImageProvider is removed. -- cgit v0.12 From a8a733b0981b3ae396d0ee0bc957ea436ad656e7 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 6 Nov 2009 16:38:14 +0100 Subject: Doc: Fixed a URL to ensure that it can be used in well-formed XML. Reviewed-by: Trust Me --- doc/src/external-resources.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 8a14095..4e1f3b7 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -369,7 +369,7 @@ */ /*! - \externalpage http://www.directfb.org/index.php?path=Main%2FDownloads&page=1 + \externalpage http://www.directfb.org/index.php?path=Main%2FDownloads&page=1 \title DirectFB - df_window example */ -- cgit v0.12 From 46f73ebb2a71e953edde644acd4e378b15dadb35 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 6 Nov 2009 16:55:45 +0100 Subject: Fix autotests that expected QTextControl to always eat mouse events Reviewed-by: ogoffart --- tests/auto/qlabel/tst_qlabel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp index 9eae9c9..9d957a5 100644 --- a/tests/auto/qlabel/tst_qlabel.cpp +++ b/tests/auto/qlabel/tst_qlabel.cpp @@ -328,14 +328,14 @@ void tst_QLabel::eventPropagation_data() QTest::addColumn("propagation"); QTest::newRow("plain text1") << QString("plain text") << int(Qt::LinksAccessibleByMouse) << int(Qt::NoFocus) << true; - QTest::newRow("plain text2") << QString("plain text") << (int)Qt::TextSelectableByKeyboard << (int)Qt::ClickFocus << false; + QTest::newRow("plain text2") << QString("plain text") << (int)Qt::TextSelectableByKeyboard << (int)Qt::ClickFocus << true; QTest::newRow("plain text3") << QString("plain text") << (int)Qt::TextSelectableByMouse << (int)Qt::ClickFocus << false; QTest::newRow("plain text4") << QString("plain text") << (int)Qt::NoTextInteraction << (int)Qt::NoFocus << true; - QTest::newRow("rich text1") << QString("rich text") << (int)Qt::LinksAccessibleByMouse << (int)Qt::NoFocus << false; - QTest::newRow("rich text2") << QString("rich text") << (int)Qt::TextSelectableByKeyboard << (int)Qt::ClickFocus << false; + QTest::newRow("rich text1") << QString("rich text") << (int)Qt::LinksAccessibleByMouse << (int)Qt::NoFocus << true; + QTest::newRow("rich text2") << QString("rich text") << (int)Qt::TextSelectableByKeyboard << (int)Qt::ClickFocus << true; QTest::newRow("rich text3") << QString("rich text") << (int)Qt::TextSelectableByMouse << (int)Qt::ClickFocus << false; QTest::newRow("rich text4") << QString("rich text") << (int)Qt::NoTextInteraction << (int)Qt::NoFocus << true; - QTest::newRow("rich text4") << QString("rich text") << (int)Qt::LinksAccessibleByKeyboard << (int)Qt::StrongFocus << false; + QTest::newRow("rich text4") << QString("rich text") << (int)Qt::LinksAccessibleByKeyboard << (int)Qt::StrongFocus << true; if (!test_box) test_box = new Widget; -- cgit v0.12 From cd58bc13a4a37543d76a79b3cee7cd95bde0a14b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 6 Nov 2009 17:24:43 +0100 Subject: stabilize test --- tests/auto/qcombobox/tst_qcombobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 06c632d..18ebddc 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2529,7 +2529,7 @@ void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated() QCOMPARE(spy.count(), 0); edit.setFocus(); QTRY_VERIFY(edit.hasFocus()); - QCOMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 1); } QTEST_MAIN(tst_QComboBox) -- cgit v0.12 From 8ee95e63a92b07ba89003243b0e93718762a7d88 Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Wed, 4 Nov 2009 10:49:05 -0300 Subject: QGAL: Support for out-of-order parallel anchors Now parallel anchors account for the fact they may be composed of anchors with different directions. We arbitrarily set the direction of the parallel anchor to be the same direction as the first child. The methods refreshSizeHints and updateChildren were updated to support this situation. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 46 ++++++++++++++++++++---- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 9 ++--- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 7ad994c..95922ca 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -218,9 +218,20 @@ bool AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo) void ParallelAnchorData::updateChildrenSizes() { - firstEdge->sizeAtMinimum = secondEdge->sizeAtMinimum = sizeAtMinimum; - firstEdge->sizeAtPreferred = secondEdge->sizeAtPreferred = sizeAtPreferred; - firstEdge->sizeAtMaximum = secondEdge->sizeAtMaximum = sizeAtMaximum; + firstEdge->sizeAtMinimum = sizeAtMinimum; + firstEdge->sizeAtPreferred = sizeAtPreferred; + firstEdge->sizeAtMaximum = sizeAtMaximum; + + const bool secondFwd = (secondEdge->from == from); + if (secondFwd) { + secondEdge->sizeAtMinimum = sizeAtMinimum; + secondEdge->sizeAtPreferred = sizeAtPreferred; + secondEdge->sizeAtMaximum = sizeAtMaximum; + } else { + secondEdge->sizeAtMinimum = -sizeAtMinimum; + secondEdge->sizeAtPreferred = -sizeAtPreferred; + secondEdge->sizeAtMaximum = -sizeAtMaximum; + } firstEdge->updateChildrenSizes(); secondEdge->updateChildrenSizes(); @@ -239,8 +250,16 @@ bool ParallelAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *styleIn return false; } - minSize = qMax(firstEdge->minSize, secondEdge->minSize); - maxSize = qMin(firstEdge->maxSize, secondEdge->maxSize); + // 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) + const bool secondFwd = (secondEdge->from == from); + const qreal secondMin = secondFwd ? secondEdge->minSize : -secondEdge->maxSize; + const qreal secondPref = secondFwd ? secondEdge->prefSize : -secondEdge->prefSize; + const qreal secondMax = secondFwd ? secondEdge->maxSize : -secondEdge->minSize; + + minSize = qMax(firstEdge->minSize, secondMin); + maxSize = qMin(firstEdge->maxSize, secondMax); // This condition means that the maximum size of one anchor being simplified is smaller than // the minimum size of the other anchor. The consequence is that there won't be a valid size @@ -249,7 +268,22 @@ bool ParallelAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *styleIn return false; } - prefSize = qMax(firstEdge->prefSize, secondEdge->prefSize); + // 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: + // + // - There are no negative-sized anchors + // - All sequential anchors are composed of children in the same direction as the + // sequential anchor itself + // + // 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); // See comment in AnchorData::refreshSizeHints() about sizeAt* values diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 1e11ee2..8d77b1a 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -256,10 +256,11 @@ struct ParallelAnchorData : public AnchorData type = AnchorData::Parallel; orientation = first->orientation; - // ### Those asserts force that both child anchors have the same direction, - // but can't we simplify a pair of anchors in opposite directions? - Q_ASSERT(first->from == second->from); - Q_ASSERT(first->to == second->to); + // This assert whether the child anchors share their vertices + 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 from = first->from; to = first->to; #ifdef QT_DEBUG -- cgit v0.12 From 720e04ac5f572c1ca0a32e1675fbda6e778d3e8c Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Thu, 5 Nov 2009 19:18:48 -0300 Subject: QGAL: Revamp the edge interpolation code Simplify the code of interpolateSequentialAnchor to use the distance values of the sequential anchor itself as base for the children distances. So the 'base' parameter was removed. This also allowed out-of-order parallel anchors to be interpolated, and the 'base' parameter also to be removed from interpolateParallelAnchor. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 49 ++++++++++++------------ src/gui/graphicsview/qgraphicsanchorlayout_p.h | 6 +-- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 95922ca..318ce20 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2443,17 +2443,13 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, // Process child anchors if (edge->type == AnchorData::Sequential) - interpolateSequentialEdges(edge->from, - static_cast(edge), - orientation); + interpolateSequentialEdges(static_cast(edge), orientation); else if (edge->type == AnchorData::Parallel) - interpolateParallelEdges(edge->from, - static_cast(edge), - orientation); + interpolateParallelEdges(static_cast(edge), orientation); } void QGraphicsAnchorLayoutPrivate::interpolateParallelEdges( - AnchorVertex *base, ParallelAnchorData *data, Orientation orientation) + ParallelAnchorData *data, Orientation orientation) { // In parallels the boundary vertices are already calculate, we // just need to look for sequential groups inside, because only @@ -2461,40 +2457,43 @@ void QGraphicsAnchorLayoutPrivate::interpolateParallelEdges( // First edge if (data->firstEdge->type == AnchorData::Sequential) - interpolateSequentialEdges(base, - static_cast(data->firstEdge), + interpolateSequentialEdges(static_cast(data->firstEdge), orientation); else if (data->firstEdge->type == AnchorData::Parallel) - interpolateParallelEdges(base, - static_cast(data->firstEdge), + interpolateParallelEdges(static_cast(data->firstEdge), orientation); // Second edge if (data->secondEdge->type == AnchorData::Sequential) - interpolateSequentialEdges(base, - static_cast(data->secondEdge), + interpolateSequentialEdges(static_cast(data->secondEdge), orientation); else if (data->secondEdge->type == AnchorData::Parallel) - interpolateParallelEdges(base, - static_cast(data->secondEdge), + interpolateParallelEdges(static_cast(data->secondEdge), orientation); } void QGraphicsAnchorLayoutPrivate::interpolateSequentialEdges( - AnchorVertex *base, SequentialAnchorData *data, Orientation orientation) + SequentialAnchorData *data, Orientation orientation) { - AnchorVertex *prev = base; + // This method is supposed to handle any sequential anchor, even out-of-order + // ones. However, in the current QGAL implementation we should get only the + // well behaved ones. + Q_ASSERT(data->m_edges.first()->from == data->from); + Q_ASSERT(data->m_edges.last()->to == data->to); - // ### I'm not sure whether this assumption is safe. If not, - // consider that m_edges.last() could be used instead (so - // at(0) would be the one to be treated specially). - Q_ASSERT(base == data->m_edges.at(0)->to || base == data->m_edges.at(0)->from); + // At this point, the two outter vertices already have their distance + // calculated. + // We use the first as the base to calculate the internal ones + + AnchorVertex *prev = data->from; - // Skip the last for (int i = 0; i < data->m_edges.count() - 1; ++i) { - AnchorData *child = data->m_edges.at(i); - interpolateEdge(prev, child, orientation); - prev = child->to; + AnchorData *edge = data->m_edges.at(i); + interpolateEdge(prev, edge, orientation); + + // Use the recently calculated vertex as the base for the next one + const bool edgeIsForward = (edge->from == prev); + prev = edgeIsForward ? edge->to : edge->from; } // Treat the last specially, since we already calculated it's end diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 8d77b1a..d8e62b4 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -475,10 +475,8 @@ public: void calculateVertexPositions(Orientation orientation); void setupEdgesInterpolation(Orientation orientation); void interpolateEdge(AnchorVertex *base, AnchorData *edge, Orientation orientation); - void interpolateSequentialEdges(AnchorVertex *base, SequentialAnchorData *edge, - Orientation orientation); - void interpolateParallelEdges(AnchorVertex *base, ParallelAnchorData *edge, - Orientation orientation); + void interpolateSequentialEdges(SequentialAnchorData *edge, Orientation orientation); + void interpolateParallelEdges(ParallelAnchorData *edge, Orientation orientation); // Linear Programming solver methods bool solveMinMax(const QList &constraints, -- cgit v0.12 From f2f7ad1e0a73ef28aee406de358e1308f817bf6d Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Thu, 5 Nov 2009 14:44:04 -0300 Subject: QGAL (Test): Add test where center anchor is simplified by parallel We were not handling the case where a parallel anchor is created to simplify a central anchor. Unfortunately no tests had shown that case yet. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- .../tst_qgraphicsanchorlayout.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index cc96edb..8b52674 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -83,6 +83,7 @@ private slots: void infiniteMaxSizes(); void simplifiableUnfeasible(); void simplificationVsOrder(); + void parallelSimplificationOfCenter(); }; class RectWidget : public QGraphicsWidget @@ -1801,5 +1802,30 @@ void tst_QGraphicsAnchorLayout::simplificationVsOrder() } } +void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter() +{ + QSizeF min(10, 10); + QSizeF pref(20, 10); + QSizeF max(50, 10); + + QGraphicsWidget *a = createItem(min, pref, max, "A"); + QGraphicsWidget *b = createItem(min, pref, max, "B"); + + QGraphicsWidget parent; + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&parent); + l->setContentsMargins(0, 0, 0, 0); + + l->addAnchor(l, Qt::AnchorLeft, a, Qt::AnchorLeft); + l->addAnchor(l, Qt::AnchorRight, a, Qt::AnchorRight); + + l->addAnchor(a, Qt::AnchorHorizontalCenter, b, Qt::AnchorLeft); + l->addAnchor(b, Qt::AnchorRight, a, Qt::AnchorRight); + + parent.resize(l->effectiveSizeHint(Qt::PreferredSize)); + + QCOMPARE(a->geometry(), QRectF(0, 0, 40, 10)); + QCOMPARE(b->geometry(), QRectF(20, 0, 20, 10)); +} + QTEST_MAIN(tst_QGraphicsAnchorLayout) #include "tst_qgraphicsanchorlayout.moc" -- cgit v0.12 From 92b51d119325adc7cef518c1260c71904fc68c40 Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Thu, 5 Nov 2009 20:11:37 -0300 Subject: QGAL (Test): Enable remaining tests in 'qgraphicsanchorlayout1' Some tests were still disabled because were not supported somewhere in the past. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- .../tst_qgraphicsanchorlayout1.cpp | 25 ++++++++-------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 57e5c41..0fbd069 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -423,7 +423,6 @@ void tst_QGraphicsAnchorLayout1::testAddAndRemoveAnchor() layout->setAnchor(layout, Qt::AnchorLeft, widget5, Qt::AnchorTop, 10); QCOMPARE( layout->count(), 4 ); - // ###: NOT SUPPORTED // anchor two edges of a widget (to define width / height) QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): Cannot anchor the item to itself"); layout->setAnchor(widget5, Qt::AnchorLeft, widget5, Qt::AnchorRight, 10); @@ -520,8 +519,6 @@ void tst_QGraphicsAnchorLayout1::testIsValid() widget->setLayout(layout); widget->setGeometry(QRectF(0,0,100,100)); - // ###: this shall change once isValid() is ready - // QCOMPARE(layout->isValid(), false); QCOMPARE(layout->isValid(), true); delete widget; } @@ -698,9 +695,8 @@ void tst_QGraphicsAnchorLayout1::testSpecialCases() layout2->setAnchor(widget1, Qt::AnchorRight, layout2, Qt::AnchorRight, 1); layout2->setAnchor(widget1, Qt::AnchorBottom, layout2, Qt::AnchorBottom, 1); - // ###: uncomment when simplification bug is solved - //widget->setGeometry(QRectF(0,0,100,100)); - //QCOMPARE(widget1->geometry(), QRectF(51,2,47,96)); + widget->setGeometry(QRectF(0,0,100,100)); + QCOMPARE(widget1->geometry(), QRectF(51,2,47,96)); delete widget; } @@ -900,9 +896,6 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout_data() << BasicData(-1, Qt::AnchorLeft, 1, Qt::AnchorRight, 20) ; - // ### SIMPLIFICATION BUG FOR ITEM 1 - // ### remove this when bug is solved - theResult << BasicResult(0, QRectF(10, 10, 180, 80) ) << BasicResult(1, QRectF(10, 80, 10, 10) ) @@ -1732,8 +1725,6 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() QCOMPARE(expected, actual); } - // ###: not supported yet -/* // Test mirrored mode widget->setLayoutDirection(Qt::RightToLeft); layout->activate(); @@ -1745,10 +1736,13 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() if (mirroredRect.isValid()){ mirroredRect.moveLeft(size.width()-item.rect.width()-item.rect.left()); } - QCOMPARE(widgets[item.index]->geometry(), mirroredRect); + QRectF expected = truncate(mirroredRect); + QRectF actual = truncate(widgets[item.index]->geometry()); + + QCOMPARE(expected, actual); delete widgets[item.index]; } -*/ + delete widget; } @@ -2447,6 +2441,8 @@ void tst_QGraphicsAnchorLayout1::testDoubleSizePolicy_data() QTest::newRow("double size policy: expanding-preferred") << sizePolicy1 << sizePolicy2 << width1 << width2; } + // QGAL handling of ignored flag is different + if (0) { QSizePolicy sizePolicy1( QSizePolicy::Ignored, QSizePolicy::Ignored ); QSizePolicy sizePolicy2( QSizePolicy::Preferred, QSizePolicy::Preferred ); @@ -2514,9 +2510,6 @@ void tst_QGraphicsAnchorLayout1::testDoubleSizePolicy_data() void tst_QGraphicsAnchorLayout1::testDoubleSizePolicy() { - // ### Size policy is not yet supported - return; - QFETCH(QSizePolicy, policy1); QFETCH(QSizePolicy, policy2); QFETCH(qreal, width1); -- cgit v0.12 From 2906522845d3ce9723b978b8b1490dfc9b9008f0 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Wed, 4 Nov 2009 19:48:54 -0300 Subject: QGAL: fix leak when restoring anchors The restore algorithm had a leak, so we did not delete all the sequences and parallel anchors that were not part of the simplified graph, i.e. that were nested inside other anchors. This commit fix the leak and clean the restore function a little bit, so the recursive function is called even for Normal anchors (which are dealt accordingly). Note that the before/after information is exactly the ->from/->to information available in the anchor being looked on. Also added an assertion to document the fact that at this point (restoring anchor simplification), one of the two anchors inside a parallel anchor must be a sequence. The algorithm depends on that because you can't have two anchors with the same start and end points. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 63 ++++++++++-------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 318ce20..ff3fe69 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -880,48 +880,40 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP return false; } -static void restoreSimplifiedAnchor(Graph &g, - AnchorData *edge, - AnchorVertex *before, - AnchorVertex *after) +static void restoreSimplifiedAnchor(Graph &g, AnchorData *edge) { - Q_ASSERT(edge->type != AnchorData::Normal); #if 0 static const char *anchortypes[] = {"Normal", "Sequential", "Parallel"}; qDebug("Restoring %s edge.", anchortypes[int(edge->type)]); #endif - if (edge->type == AnchorData::Sequential) { - SequentialAnchorData* seqEdge = static_cast(edge); - // restore the sequential anchor - AnchorVertex *prev = before; - AnchorVertex *last = after; - if (edge->from != prev) - qSwap(last, prev); - - for (int i = 0; i < seqEdge->m_edges.count(); ++i) { - AnchorVertex *v1 = (i < seqEdge->m_children.count()) ? seqEdge->m_children.at(i) : last; - AnchorData *data = seqEdge->m_edges.at(i); - if (data->type != AnchorData::Normal) { - restoreSimplifiedAnchor(g, data, prev, v1); - } else { - g.createEdge(prev, v1, data); - } - prev = v1; + + if (edge->type == AnchorData::Normal) { + g.createEdge(edge->from, edge->to, edge); + + } else if (edge->type == AnchorData::Sequential) { + SequentialAnchorData *sequence = static_cast(edge); + + for (int i = 0; i < sequence->m_edges.count(); ++i) { + AnchorData *data = sequence->m_edges.at(i); + restoreSimplifiedAnchor(g, data); } + + delete sequence; + } else if (edge->type == AnchorData::Parallel) { - ParallelAnchorData* parallelEdge = static_cast(edge); - AnchorData *parallelEdges[2] = {parallelEdge->firstEdge, - parallelEdge->secondEdge}; - for (int i = 0; i < 2; ++i) { - AnchorData *data = parallelEdges[i]; - if (data->type == AnchorData::Normal) { - g.createEdge(before, after, data); - } else { - restoreSimplifiedAnchor(g, data, before, after); - } - } + ParallelAnchorData* parallel = static_cast(edge); + + // ### Because of the way parallel anchors are created in the anchor simplification + // algorithm, we know that one of these will be a sequence, so it'll be safe if the other + // anchor create an edge between the same vertices as the parallel. + Q_ASSERT(parallel->firstEdge->type == AnchorData::Sequential + || parallel->secondEdge->type == AnchorData::Sequential); + restoreSimplifiedAnchor(g, parallel->firstEdge); + restoreSimplifiedAnchor(g, parallel->secondEdge); + + delete parallel; } } @@ -944,9 +936,8 @@ void QGraphicsAnchorLayoutPrivate::restoreSimplifiedGraph(Orientation orientatio AnchorVertex *v2 = connections.at(i).second; AnchorData *edge = g.edgeData(v1, v2); if (edge->type != AnchorData::Normal) { - AnchorData *oldEdge = g.takeEdge(v1, v2); - restoreSimplifiedAnchor(g, edge, v1, v2); - delete oldEdge; + g.takeEdge(v1, v2); + restoreSimplifiedAnchor(g, edge); } } } -- cgit v0.12 From 9d89f0bd155b9eccc89eac6ff30b572795062baa Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Thu, 5 Nov 2009 15:19:23 -0300 Subject: QGAL: allow parallel anchors simplify center anchors This commit make possible to parallelize anchors that are center anchors, i.e. that have extra constraints (stored in itemCenterConstraints). This is trivial to support since the parallel anchor will have the same size as its children, so it can just "take the place" of its children in the constraints. Restore function was added as well. To manipulate internal structures, relevant static functions were promoted to methods. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 80 ++++++++++++++++++++---- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 18 ++++-- 2 files changed, 82 insertions(+), 16 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index ff3fe69..ef89612 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -536,34 +536,67 @@ inline static qreal checkAdd(qreal a, qreal b) /*! \internal - Adds \a newAnchor to the graph \a g. + Adds \a newAnchor to the graph. Returns the newAnchor itself if it could be added without further changes to the graph. If a new parallel anchor had to be created, then returns the new parallel anchor. If a parallel anchor had to be created and it results in an unfeasible setup, \a feasible is set to false, otherwise true. + + Note that in the case a new parallel anchor is created, it might also take over some constraints + from its children anchors. */ -static AnchorData *addAnchorMaybeParallel(Graph *g, - AnchorData *newAnchor, bool *feasible) +AnchorData *QGraphicsAnchorLayoutPrivate::addAnchorMaybeParallel(AnchorData *newAnchor, bool *feasible) { + Orientation orientation = Orientation(newAnchor->orientation); + Graph &g = graph[orientation]; *feasible = true; // If already exists one anchor where newAnchor is supposed to be, we create a parallel // anchor. - if (AnchorData *oldAnchor = g->takeEdge(newAnchor->from, newAnchor->to)) { + if (AnchorData *oldAnchor = g.takeEdge(newAnchor->from, newAnchor->to)) { ParallelAnchorData *parallel = new ParallelAnchorData(oldAnchor, newAnchor); + // The parallel anchor will "replace" its children anchors in + // every center constraint that they appear. + + // ### If the dependent (center) anchors had reference(s) to their constraints, we + // could avoid traversing all the itemCenterConstraints. + QList &constraints = itemCenterConstraints[orientation]; + + AnchorData *children[2] = { oldAnchor, newAnchor }; + QList *childrenConstraints[2] = { ¶llel->m_firstConstraints, + ¶llel->m_secondConstraints }; + + for (int i = 0; i < 2; ++i) { + AnchorData *child = children[i]; + QList *childConstraints = childrenConstraints[i]; + + if (!child->isCenterAnchor) + continue; + + parallel->isCenterAnchor = true; + + for (int i = 0; i < constraints.count(); ++i) { + QSimplexConstraint *c = constraints[i]; + if (c->variables.contains(child)) { + childConstraints->append(c); + qreal v = c->variables.take(child); + c->variables.insert(parallel, v); + } + } + } + // At this point we can identify that the parallel anchor is not feasible, e.g. one // anchor minimum size is bigger than the other anchor maximum size. *feasible = parallel->refreshSizeHints_helper(0, false); newAnchor = parallel; } - g->createEdge(newAnchor->from, newAnchor->to, newAnchor); + g.createEdge(newAnchor->from, newAnchor->to, newAnchor); return newAnchor; } - /*! \internal @@ -858,7 +891,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP // If 'beforeSequence' and 'afterSequence' already had an anchor between them, we'll // create a parallel anchor between the new sequence and the old anchor. bool newFeasible; - AnchorData *newAnchor = addAnchorMaybeParallel(&g, sequence, &newFeasible); + AnchorData *newAnchor = addAnchorMaybeParallel(sequence, &newFeasible); if (!newFeasible) { *feasible = false; @@ -880,7 +913,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP return false; } -static void restoreSimplifiedAnchor(Graph &g, AnchorData *edge) +void QGraphicsAnchorLayoutPrivate::restoreSimplifiedAnchor(AnchorData *edge) { #if 0 static const char *anchortypes[] = {"Normal", @@ -889,6 +922,8 @@ static void restoreSimplifiedAnchor(Graph &g, AnchorDa qDebug("Restoring %s edge.", anchortypes[int(edge->type)]); #endif + Graph &g = graph[edge->orientation]; + if (edge->type == AnchorData::Normal) { g.createEdge(edge->from, edge->to, edge); @@ -897,26 +932,47 @@ static void restoreSimplifiedAnchor(Graph &g, AnchorDa for (int i = 0; i < sequence->m_edges.count(); ++i) { AnchorData *data = sequence->m_edges.at(i); - restoreSimplifiedAnchor(g, data); + restoreSimplifiedAnchor(data); } delete sequence; } else if (edge->type == AnchorData::Parallel) { ParallelAnchorData* parallel = static_cast(edge); + restoreSimplifiedConstraints(parallel); // ### Because of the way parallel anchors are created in the anchor simplification // algorithm, we know that one of these will be a sequence, so it'll be safe if the other // anchor create an edge between the same vertices as the parallel. Q_ASSERT(parallel->firstEdge->type == AnchorData::Sequential || parallel->secondEdge->type == AnchorData::Sequential); - restoreSimplifiedAnchor(g, parallel->firstEdge); - restoreSimplifiedAnchor(g, parallel->secondEdge); + restoreSimplifiedAnchor(parallel->firstEdge); + restoreSimplifiedAnchor(parallel->secondEdge); delete parallel; } } +void QGraphicsAnchorLayoutPrivate::restoreSimplifiedConstraints(ParallelAnchorData *parallel) +{ + if (!parallel->isCenterAnchor) + return; + + for (int i = 0; i < parallel->m_firstConstraints.count(); ++i) { + QSimplexConstraint *c = parallel->m_firstConstraints[i]; + qreal v = c->variables[parallel]; + c->variables.remove(parallel); + c->variables.insert(parallel->firstEdge, v); + } + + for (int i = 0; i < parallel->m_secondConstraints.count(); ++i) { + QSimplexConstraint *c = parallel->m_secondConstraints[i]; + qreal v = c->variables[parallel]; + c->variables.remove(parallel); + c->variables.insert(parallel->secondEdge, v); + } +} + void QGraphicsAnchorLayoutPrivate::restoreSimplifiedGraph(Orientation orientation) { if (!graphSimplified[orientation]) @@ -937,7 +993,7 @@ void QGraphicsAnchorLayoutPrivate::restoreSimplifiedGraph(Orientation orientatio AnchorData *edge = g.edgeData(v1, v2); if (edge->type != AnchorData::Normal) { g.takeEdge(v1, v2); - restoreSimplifiedAnchor(g, edge); + restoreSimplifiedAnchor(edge); } } } diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index d8e62b4..d7b3cfd 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -275,6 +275,9 @@ struct ParallelAnchorData : public AnchorData AnchorData* firstEdge; AnchorData* secondEdge; + + QList m_firstConstraints; + QList m_secondConstraints; }; /*! @@ -433,20 +436,27 @@ public: QLayoutStyleInfo &styleInfo() const; - // Activation methods - bool simplifyGraph(Orientation orientation); - bool simplifyGraphIteration(Orientation orientation, bool *feasible); - void restoreSimplifiedGraph(Orientation orientation); + AnchorData *addAnchorMaybeParallel(AnchorData *newAnchor, bool *feasible); + // Activation void calculateGraphs(); void calculateGraphs(Orientation orientation); + // Simplification + bool simplifyGraph(Orientation orientation); + bool simplifyGraphIteration(Orientation orientation, bool *feasible); + + void restoreSimplifiedGraph(Orientation orientation); + void restoreSimplifiedAnchor(AnchorData *edge); + void restoreSimplifiedConstraints(ParallelAnchorData *parallel); + bool calculateTrunk(Orientation orientation, const GraphPath &trunkPath, const QList &constraints, const QList &variables); bool calculateNonTrunk(const QList &constraints, const QList &variables); + // Support functions for calculateGraph() bool refreshAllSizeHints(Orientation orientation); void findPaths(Orientation orientation); void constraintsFromPaths(Orientation orientation); -- cgit v0.12 From 5f46db57f3baed15bfca2b4725e400808eabb7e5 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Thu, 5 Nov 2009 23:49:43 -0300 Subject: QGAL (Test): redundant anchors shouldn't harm simplification Adds a simple test to check whether redundant anchors avoid simplification to happen. In this case, the use of addCornerAnchors generate redundant anchors. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- .../tst_qgraphicsanchorlayout.cpp | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 8b52674..c7ed309 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -84,6 +84,7 @@ private slots: void simplifiableUnfeasible(); void simplificationVsOrder(); void parallelSimplificationOfCenter(); + void simplificationVsRedundance(); }; class RectWidget : public QGraphicsWidget @@ -1827,5 +1828,43 @@ void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter() QCOMPARE(b->geometry(), QRectF(20, 0, 20, 10)); } +/* + Test whether redundance of anchors (in this case by using addCornerAnchors), will + prevent simplification to take place when it should. +*/ +void tst_QGraphicsAnchorLayout::simplificationVsRedundance() +{ + QSizeF min(10, 10); + QSizeF pref(20, 10); + QSizeF max(50, 30); + + QGraphicsWidget *a = createItem(min, pref, max, "A"); + QGraphicsWidget *b = createItem(min, pref, max, "B"); + QGraphicsWidget *c = createItem(min, pref, max, "C"); + + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + + l->addCornerAnchors(a, Qt::TopLeftCorner, l, Qt::TopLeftCorner); + l->addCornerAnchors(a, Qt::BottomLeftCorner, l, Qt::BottomLeftCorner); + + l->addCornerAnchors(b, Qt::TopLeftCorner, a, Qt::TopRightCorner); + l->addCornerAnchors(b, Qt::TopRightCorner, l, Qt::TopRightCorner); + + l->addCornerAnchors(c, Qt::TopLeftCorner, b, Qt::BottomLeftCorner); + l->addCornerAnchors(c, Qt::BottomLeftCorner, a, Qt::BottomRightCorner); + l->addCornerAnchors(c, Qt::TopRightCorner, b, Qt::BottomRightCorner); + l->addCornerAnchors(c, Qt::BottomRightCorner, l, Qt::BottomRightCorner); + + l->effectiveSizeHint(Qt::MinimumSize); + + QCOMPARE(layoutHasConflict(l), false); + + if (!hasSimplification) + QEXPECT_FAIL("", "Test depends on simplification.", Abort); + + QCOMPARE(usedSimplex(l, Qt::Horizontal), false); + QCOMPARE(usedSimplex(l, Qt::Vertical), false); +} + QTEST_MAIN(tst_QGraphicsAnchorLayout) #include "tst_qgraphicsanchorlayout.moc" -- cgit v0.12 From 28f490b3edb7a47aa27db5ea427d91e082a59f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 6 Nov 2009 14:53:28 +0100 Subject: Improving reliability and information from the large file test Saw a couple of sporadic failures on Windows platforms. Debug output should help find what's happening. Once the fillFileSparsely test fails, there's no point in trying to read what we failed to write so maximum tested size is reset on a failed write. Reviewed-by: Markus Goetz --- tests/auto/qfile/largefile/tst_largefile.cpp | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index 8ab3275..9105063 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -339,12 +339,47 @@ void tst_LargeFile::fillFileSparsely() QFETCH( QByteArray, block ); QCOMPARE( block.size(), blockSize ); + static int lastKnownGoodIndex = 0; + struct ScopeGuard { + ScopeGuard(tst_LargeFile* test) + : this_(test) + , failed(true) + { + QFETCH( int, index ); + index_ = index; + } + + ~ScopeGuard() + { + if (failed) { + this_->maxSizeBits = lastKnownGoodIndex; + QWARN( qPrintable( + QString("QFile::error %1: '%2'. Maximum size bits reset to %3.") + .arg(this_->largeFile.error()) + .arg(this_->largeFile.errorString()) + .arg(this_->maxSizeBits)) ); + } else + lastKnownGoodIndex = qMax(index_, lastKnownGoodIndex); + } + + private: + tst_LargeFile * const this_; + int index_; + + public: + bool failed; + }; + + ScopeGuard resetMaxSizeBitsOnFailure(this); + QVERIFY( largeFile.seek(position) ); QCOMPARE( largeFile.pos(), position ); QCOMPARE( largeFile.write(block), (qint64)blockSize ); QCOMPARE( largeFile.pos(), position + blockSize ); QVERIFY( largeFile.flush() ); + + resetMaxSizeBitsOnFailure.failed = false; } void tst_LargeFile::fileCreated() -- cgit v0.12 From 2b91557c93354b766c78cbc4ab48bcd58207bf1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 6 Nov 2009 19:48:03 +0100 Subject: Fix a signed/unsigned comparison warning --- src/corelib/io/qfsfileengine_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 7824520..05e6fab 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1245,7 +1245,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla } if (offset < 0 || offset != qint64(QT_OFF_T(offset)) - || size < 0 || size > (size_t)-1) { + || size < 0 || size > qint64(size_t(-1))) { q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL))); return 0; } -- cgit v0.12 From 76a0ea27dd4e377ab5d32c7559f4b9700cd5618a Mon Sep 17 00:00:00 2001 From: Artur Duque de Souza Date: Fri, 6 Nov 2009 19:01:09 -0300 Subject: Make sizePolicy a property of QGraphicsWidget too The widget has sizePolicy as a property and declaring that properly helps scripting. Just as it was done with min/pref/max sizes. Signed-off-by: Artur Duque de Souza --- src/gui/graphicsview/qgraphicswidget.cpp | 6 ++++++ src/gui/graphicsview/qgraphicswidget.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 35a3c13..1496798 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -318,6 +318,12 @@ void QGraphicsWidget::resize(const QSizeF &size) */ /*! + \property QGraphicsWidget::sizePolicy + \brief the size policy for the widget + \sa sizePolicy(), setSizePolicy(), QWidget::sizePolicy() +*/ + +/*! \property QGraphicsWidget::geometry \brief the geometry of the widget diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 38f72f0..15dc878 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -77,6 +77,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize) Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize) Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize) + Q_PROPERTY(QSizePolicy::Policy sizePolicy READ sizePolicy WRITE setSizePolicy) Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) -- cgit v0.12 From 81955cdea96a7d95eec8df32923273be4df573b2 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Thu, 5 Nov 2009 15:04:45 -0300 Subject: QGAL: vertex simplification Some vertices are connected by anchors with size 0, which means that in practice, they represent the same point when positioning items, i.e. their distance value is the same. In those cases, we can merge the two anchors in one, that's what vertex simplification do. The algorithm is walking in the graph, merging vertices in pairs (this could be enhanced to allow groups with arbitrary number of children vertices) The vertex simplification stage happens before the anchor simplification, so it'll make less passes. Also, in some situations of redudant anchors it will allow more anchors to be simplified. This commit creates a new type of AnchorVertex, add the algorithm for vertex simplification and restoration, make sure that distribution also works with simplified vertices. Consequences: - the assert after creating a sequence might not be true anymore, it was a structural assumption that vertex simplification may destroy; - we assumed that a center anchor could appear only in the beginning or end of the candidates, because the "center vertex" always would have 3 adjacents. A mix of parallel+center and vertex simplification break that assumption. The commit deal with those consequences. We still have one limitation: vertex simplification needs to restore the graph in every invalidation (which might be caused by some child's updateGeometyry()), since a change in the sizeHint might cause a new anchor to have size 0 or a 0-sized anchor to have a different size. In the future we can track the 0 sized anchors and only restore/re-simplify when the set changes. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 315 +++++++++++++++++++++-- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 137 ++++++---- 2 files changed, 379 insertions(+), 73 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index ef89612..395c035 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -61,6 +61,8 @@ QGraphicsAnchorPrivate::QGraphicsAnchorPrivate(int version) QGraphicsAnchorPrivate::~QGraphicsAnchorPrivate() { + // ### + layoutPrivate->restoreSimplifiedGraph(QGraphicsAnchorLayoutPrivate::Orientation(data->orientation)); layoutPrivate->removeAnchor(data->from, data->to); } @@ -700,30 +702,185 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation) if (graphSimplified[orientation]) return true; - graphSimplified[orientation] = true; #if 0 qDebug("Simplifying Graph for %s", orientation == Horizontal ? "Horizontal" : "Vertical"); #endif - if (!layoutFirstVertex[orientation]) - return true; + // Vertex simplification + if (!simplifyVertices(orientation)) { + restoreVertices(orientation); + return false; + } + // Anchor simplification bool dirty; bool feasible = true; do { dirty = simplifyGraphIteration(orientation, &feasible); } while (dirty && feasible); - if (!feasible) - graphSimplified[orientation] = false; + // Note that if we are not feasible, we fallback and make sure that the graph is fully restored + if (!feasible) { + graphSimplified[orientation] = true; + restoreSimplifiedGraph(orientation); + restoreVertices(orientation); + return false; + } + + graphSimplified[orientation] = true; + return true; +} + +static AnchorVertex *replaceVertex_helper(AnchorData *data, AnchorVertex *oldV, AnchorVertex *newV) +{ + AnchorVertex *other; + if (data->from == oldV) { + data->from = newV; + other = data->to; + } else { + data->to = newV; + other = data->from; + } + return other; +} + +bool QGraphicsAnchorLayoutPrivate::replaceVertex(Orientation orientation, AnchorVertex *oldV, + AnchorVertex *newV, const QList &edges) +{ + Graph &g = graph[orientation]; + bool feasible = true; + + for (int i = 0; i < edges.count(); ++i) { + AnchorData *ad = edges[i]; + AnchorVertex *otherV = replaceVertex_helper(ad, oldV, newV); + +#if defined(QT_DEBUG) + ad->name = QString::fromAscii("%1 --to--> %2").arg(ad->from->toString()).arg(ad->to->toString()); +#endif + + bool newFeasible; + AnchorData *newAnchor = addAnchorMaybeParallel(ad, &newFeasible); + feasible &= newFeasible; + + if (newAnchor != ad) { + // A parallel was created, we mark that in the list of anchors created by vertex + // simplification. This is needed because we want to restore them in a separate step + // from the restoration of anchor simplification. + anchorsFromSimplifiedVertices[orientation].append(newAnchor); + } + + g.takeEdge(oldV, otherV); + } return feasible; } /*! \internal +*/ +bool QGraphicsAnchorLayoutPrivate::simplifyVertices(Orientation orientation) +{ + Q_Q(QGraphicsAnchorLayout); + Graph &g = graph[orientation]; + + // We'll walk through vertices + QStack stack; + stack.push(layoutFirstVertex[orientation]); + QSet visited; + + while (!stack.isEmpty()) { + AnchorVertex *v = stack.pop(); + visited.insert(v); + + // Each adjacent of 'v' is a possible vertex to be merged. So we traverse all of + // them. Since once a merge is made, we might add new adjacents, and we don't want to + // pass two times through one adjacent. The 'index' is used to track our position. + QList adjacents = g.adjacentVertices(v); + int index = 0; + + while (index < adjacents.count()) { + AnchorVertex *next = adjacents[index]; + index++; + + AnchorData *data = g.edgeData(v, next); + const bool bothLayoutVertices = v->m_item == q && next->m_item == q; + const bool zeroSized = !data->minSize && !data->maxSize; + + if (!bothLayoutVertices && zeroSized) { + + // Create a new vertex pair, note that we keep a list of those vertices so we can + // easily process them when restoring the graph. + AnchorVertexPair *newV = new AnchorVertexPair(v, next, data); + simplifiedVertices[orientation].append(newV); + + // Collect the anchors of both vertices, the new vertex pair will take their place + // in those anchors + const QList &vAdjacents = g.adjacentVertices(v); + const QList &nextAdjacents = g.adjacentVertices(next); + + for (int i = 0; i < vAdjacents.count(); ++i) { + AnchorVertex *adjacent = vAdjacents[i]; + if (adjacent != next) { + AnchorData *ad = g.edgeData(v, adjacent); + newV->m_firstAnchors.append(ad); + } + } + + for (int i = 0; i < nextAdjacents.count(); ++i) { + AnchorVertex *adjacent = nextAdjacents[i]; + if (adjacent != v) { + AnchorData *ad = g.edgeData(next, adjacent); + newV->m_secondAnchors.append(ad); + + // We'll also add new vertices to the adjacent list of the new 'v', to be + // created as a vertex pair and replace the current one. + if (!adjacents.contains(adjacent)) + adjacents.append(adjacent); + } + } + + // ### merge this loop into the ones that calculated m_firstAnchors/m_secondAnchors? + // Make newV take the place of v and next + bool feasible = replaceVertex(orientation, v, newV, newV->m_firstAnchors); + feasible &= replaceVertex(orientation, next, newV, newV->m_secondAnchors); + + // Update the layout vertex information if one of the vertices is a layout vertex. + AnchorVertex *layoutVertex = 0; + if (v->m_item == q) + layoutVertex = v; + else if (next->m_item == q) + layoutVertex = next; + + if (layoutVertex) { + // Layout vertices always have m_item == q... + newV->m_item = q; + changeLayoutVertex(orientation, layoutVertex, newV); + } + + g.takeEdge(v, next); + + // If a non-feasibility is found, we leave early and cancel the simplification + if (!feasible) + return false; + + v = newV; + visited.insert(newV); + + } else if (!visited.contains(next) && !stack.contains(next)) { + // If the adjacent is not fit for merge and it wasn't visited by the outermost + // loop, we add it to the stack. + stack.push(next); + } + } + } + + return true; +} + +/*! + \internal One iteration of the simplification algorithm. Returns true if another iteration is needed. @@ -763,7 +920,8 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP // (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). + // (d) its next adjacent is already visited (a cycle in the graph); + // (e) the next anchor is a center anchor. const QList &adjacents = g.adjacentVertices(v); const bool isLayoutVertex = v->m_item == q; @@ -786,13 +944,14 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP candidatesForward = (beforeSequence == data->from); } - // This is a tricky part. We peek at the next vertex to find out + // This is a tricky part. We peek at the next vertex to find out whether // - // - whether the edge from this vertex to the next vertex has the same direction; - // - whether we already visited the next vertex. + // - 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. // - // Those are needed to identify (c) and (d). Note that unlike (a) and (b), we preempt - // the end of sequence by looking into the next vertex. + // 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. // Peek at the next vertex AnchorVertex *after; @@ -810,8 +969,8 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP const bool willChangeDirection = (candidatesForward != (v == data->from)); const bool cycleFound = visited.contains(after); - // Now cases (c) and (d)... - endOfSequence = willChangeDirection || cycleFound; + // Now cases (c), (d) and (e)... + endOfSequence = willChangeDirection || cycleFound || data->isCenterAnchor; if (endOfSequence) { if (!willChangeDirection) { @@ -879,13 +1038,6 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP // Add the sequence to the graph. // - // ### At this point we assume that if some parallel anchor will be created because - // of the new sequence, the other anchor will not be a center anchor (since we - // not deal with that case yet). This assumption will break once we start simplifying - // vertices. - AnchorData *possibleParallel = g.edgeData(beforeSequence, afterSequence); - Q_ASSERT(!possibleParallel || !possibleParallel->isCenterAnchor); - AnchorData *sequence = createSequence(&g, beforeSequence, candidates, afterSequence); // If 'beforeSequence' and 'afterSequence' already had an anchor between them, we'll @@ -938,6 +1090,13 @@ void QGraphicsAnchorLayoutPrivate::restoreSimplifiedAnchor(AnchorData *edge) delete sequence; } else if (edge->type == AnchorData::Parallel) { + + // Skip parallel anchors that were created by vertex simplification, they will be processed + // later, when restoring vertex simplification. + // ### we could improve this check bit having a bit inside 'edge' + if (anchorsFromSimplifiedVertices[edge->orientation].contains(edge)) + return; + ParallelAnchorData* parallel = static_cast(edge); restoreSimplifiedConstraints(parallel); @@ -984,18 +1143,93 @@ void QGraphicsAnchorLayoutPrivate::restoreSimplifiedGraph(Orientation orientatio orientation == Horizontal ? "Horizontal" : "Vertical"); #endif + // Restore anchor simplification Graph &g = graph[orientation]; - QList > connections = g.connections(); for (int i = 0; i < connections.count(); ++i) { AnchorVertex *v1 = connections.at(i).first; AnchorVertex *v2 = connections.at(i).second; AnchorData *edge = g.edgeData(v1, v2); - if (edge->type != AnchorData::Normal) { + + // We restore only sequential anchors and parallels that were not created by + // vertex simplification. + if (edge->type == AnchorData::Sequential + || (edge->type == AnchorData::Parallel && + !anchorsFromSimplifiedVertices[orientation].contains(edge))) { + g.takeEdge(v1, v2); restoreSimplifiedAnchor(edge); } } + + restoreVertices(orientation); +} + +void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation) +{ + Q_Q(QGraphicsAnchorLayout); + + Graph &g = graph[orientation]; + QList &toRestore = simplifiedVertices[orientation]; + + // 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[i]; + QList adjacents = g.adjacentVertices(pair); + + // Restore the removed edge, this will also restore both vertices 'first' and 'second' to + // the graph structure. + AnchorVertex *first = pair->m_first; + AnchorVertex *second = pair->m_second; + g.createEdge(first, second, pair->m_removedAnchor); + + // Restore the anchors for the first child vertex + for (int j = 0; j < pair->m_firstAnchors.count(); ++j) { + AnchorData *ad = pair->m_firstAnchors[j]; + Q_ASSERT(ad->from == pair || ad->to == pair); + + replaceVertex_helper(ad, pair, first); + g.createEdge(ad->from, ad->to, ad); + } + + // Restore the anchors for the second child vertex + for (int j = 0; j < pair->m_secondAnchors.count(); ++j) { + AnchorData *ad = pair->m_secondAnchors[j]; + Q_ASSERT(ad->from == pair || ad->to == pair); + + replaceVertex_helper(ad, pair, second); + g.createEdge(ad->from, ad->to, ad); + } + + for (int j = 0; j < adjacents.count(); ++j) { + g.takeEdge(pair, adjacents[j]); + } + + // The pair simplified a layout vertex, so place back the correct vertex in the variable + // that track layout vertices + if (pair->m_item == q) { + AnchorVertex *layoutVertex = first->m_item == q ? first : second; + Q_ASSERT(layoutVertex->m_item == q); + changeLayoutVertex(orientation, pair, layoutVertex); + } + + 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 ¶llelAnchors = anchorsFromSimplifiedVertices[orientation]; + + for (int i = parallelAnchors.count() - 1; i >= 0; --i) { + ParallelAnchorData *parallel = static_cast(parallelAnchors[i]); + restoreSimplifiedConstraints(parallel); + delete parallel; + } + parallelAnchors.clear(); } QGraphicsAnchorLayoutPrivate::Orientation @@ -1149,7 +1383,6 @@ void QGraphicsAnchorLayoutPrivate::createCenterAnchors( if (item == q) { layoutCentralVertex[orientation] = internalVertex(q, centerEdge); } - } void QGraphicsAnchorLayoutPrivate::removeCenterAnchors( @@ -1811,6 +2044,15 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( lastCalculationUsedSimplex[orientation] = false; #endif + // ### This is necessary because now we do vertex simplification, we still don't know + // differentiate between invalidate()s that doesn't need resimplification and those which + // need. For example, when size hint of an item changes, this may cause an anchor to reach 0 or to + // leave 0 and get a size. In both cases we need resimplify. + // + // ### one possible solution would be tracking all the 0-sized anchors, if this set change, we need + // resimplify. + restoreSimplifiedGraph(orientation); + // Reset the nominal sizes of each anchor based on the current item sizes. This function // works with both simplified and non-simplified graphs, so it'll work when the // simplification is going to be reused. @@ -2379,6 +2621,21 @@ void QGraphicsAnchorLayoutPrivate::setItemsGeometries(const QRectF &geom) } /*! + \internal + + Fill the distance in the vertex and in the sub-vertices if its a combined vertex. +*/ +static void setVertexDistance(AnchorVertex *v, qreal distance) +{ + v->distance = distance; + if (v->m_type == AnchorVertex::Pair) { + AnchorVertexPair *pair = static_cast(v); + setVertexDistance(pair->m_first, distance); + setVertexDistance(pair->m_second, distance); + } +} + +/*! \internal Calculate the position of each vertex based on the paths to each of @@ -2393,7 +2650,7 @@ void QGraphicsAnchorLayoutPrivate::calculateVertexPositions( // Get root vertex AnchorVertex *root = layoutFirstVertex[orientation]; - root->distance = 0; + setVertexDistance(root, 0); visited.insert(root); // Add initial edges to the queue @@ -2483,10 +2740,12 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, Q_ASSERT(edge->from == base || edge->to == base); - if (edge->from == base) - edge->to->distance = base->distance + edgeDistance; - else - edge->from->distance = base->distance - edgeDistance; + // Calculate the distance for the vertex opposite to the base + if (edge->from == base) { + setVertexDistance(edge->to, base->distance + edgeDistance); + } else { + setVertexDistance(edge->from, base->distance - edgeDistance); + } // Process child anchors if (edge->type == AnchorData::Sequential) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index d7b3cfd..3a22db0 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -78,66 +78,30 @@ QT_BEGIN_NAMESPACE Represents a vertex (anchorage point) in the internal graph */ struct AnchorVertex { + enum Type { + Normal = 0, + Pair + }; + AnchorVertex(QGraphicsLayoutItem *item, Qt::AnchorPoint edge) - : m_item(item), m_edge(edge) {} + : m_item(item), m_edge(edge), m_type(Normal) {} AnchorVertex() - : m_item(0), m_edge(Qt::AnchorPoint(0)) {} + : m_item(0), m_edge(Qt::AnchorPoint(0)), m_type(Normal) {} #ifdef QT_DEBUG inline QString toString() const; #endif + QGraphicsLayoutItem *m_item; Qt::AnchorPoint m_edge; + uint m_type : 1; // Current distance from this vertex to the layout edge (Left or Top) // Value is calculated from the current anchors sizes. qreal distance; }; -#ifdef QT_DEBUG -inline QString AnchorVertex::toString() const -{ - if (!this || !m_item) { - return QLatin1String("NULL"); - } - QString edge; - switch (m_edge) { - case Qt::AnchorLeft: - edge = QLatin1String("Left"); - break; - case Qt::AnchorHorizontalCenter: - edge = QLatin1String("HorizontalCenter"); - break; - case Qt::AnchorRight: - edge = QLatin1String("Right"); - break; - case Qt::AnchorTop: - edge = QLatin1String("Top"); - break; - case Qt::AnchorVerticalCenter: - edge = QLatin1String("VerticalCenter"); - break; - case Qt::AnchorBottom: - edge = QLatin1String("Bottom"); - break; - default: - edge = QLatin1String("None"); - break; - } - QString itemName; - if (m_item->isLayout()) { - itemName = QLatin1String("layout"); - } else { - if (QGraphicsItem *item = m_item->graphicsItem()) { - itemName = item->data(0).toString(); - } - } - edge.insert(0, QLatin1String("%1_")); - return edge.arg(itemName); -} -#endif - /*! \internal @@ -280,6 +244,68 @@ struct ParallelAnchorData : public AnchorData QList m_secondConstraints; }; +struct AnchorVertexPair : public AnchorVertex { + AnchorVertexPair(AnchorVertex *v1, AnchorVertex *v2, AnchorData *data) + : AnchorVertex(), m_first(v1), m_second(v2), m_removedAnchor(data) { + m_type = AnchorVertex::Pair; + } + + AnchorVertex *m_first; + AnchorVertex *m_second; + + AnchorData *m_removedAnchor; + QList m_firstAnchors; + QList m_secondAnchors; +}; + +#ifdef QT_DEBUG +inline QString AnchorVertex::toString() const +{ + if (!this) { + return QLatin1String("NULL"); + } else if (m_type == Pair) { + const AnchorVertexPair *vp = static_cast(this); + return QString::fromAscii("(%1, %2)").arg(vp->m_first->toString()).arg(vp->m_second->toString()); + } else if (!m_item) { + return QString::fromAscii("NULL_%1").arg(int(this)); + } + QString edge; + switch (m_edge) { + case Qt::AnchorLeft: + edge = QLatin1String("Left"); + break; + case Qt::AnchorHorizontalCenter: + edge = QLatin1String("HorizontalCenter"); + break; + case Qt::AnchorRight: + edge = QLatin1String("Right"); + break; + case Qt::AnchorTop: + edge = QLatin1String("Top"); + break; + case Qt::AnchorVerticalCenter: + edge = QLatin1String("VerticalCenter"); + break; + case Qt::AnchorBottom: + edge = QLatin1String("Bottom"); + break; + default: + edge = QLatin1String("None"); + break; + } + QString itemName; + if (m_item->isLayout()) { + itemName = QLatin1String("layout"); + } else { + if (QGraphicsItem *item = m_item->graphicsItem()) { + itemName = item->data(0).toString(); + } + } + edge.insert(0, QLatin1String("%1_")); + return edge.arg(itemName); +} +#endif + /*! \internal @@ -444,11 +470,17 @@ public: // Simplification bool simplifyGraph(Orientation orientation); + bool simplifyVertices(Orientation orientation); bool simplifyGraphIteration(Orientation orientation, bool *feasible); + bool replaceVertex(Orientation orientation, AnchorVertex *oldV, + AnchorVertex *newV, const QList &edges); + + void restoreSimplifiedGraph(Orientation orientation); void restoreSimplifiedAnchor(AnchorData *edge); void restoreSimplifiedConstraints(ParallelAnchorData *parallel); + void restoreVertices(Orientation orientation); bool calculateTrunk(Orientation orientation, const GraphPath &trunkPath, const QList &constraints, @@ -476,6 +508,17 @@ public: return internalVertex(qMakePair(const_cast(item), edge)); } + inline void changeLayoutVertex(Orientation orientation, AnchorVertex *oldV, AnchorVertex *newV) + { + if (layoutFirstVertex[orientation] == oldV) + layoutFirstVertex[orientation] = newV; + else if (layoutCentralVertex[orientation] == oldV) + layoutCentralVertex[orientation] = newV; + else if (layoutLastVertex[orientation] == oldV) + layoutLastVertex[orientation] = newV; + } + + AnchorVertex *addInternalVertex(QGraphicsLayoutItem *item, Qt::AnchorPoint edge); void removeInternalVertex(QGraphicsLayoutItem *item, Qt::AnchorPoint edge); @@ -519,6 +562,10 @@ public: AnchorVertex *layoutCentralVertex[2]; AnchorVertex *layoutLastVertex[2]; + // Combined anchors in order of creation + QList simplifiedVertices[2]; + QList anchorsFromSimplifiedVertices[2]; + // Graph paths and constraints, for both orientations QMultiHash graphPaths[2]; QList constraints[2]; -- cgit v0.12 From 20f6d4080af9945b957fe74520373c015fbdacbc Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Fri, 6 Nov 2009 15:26:36 -0300 Subject: QGAL: avoid passing Orientation for interpolation functions Not all of the interpolation functions needed the orientation information, and the one that needs can look at the orientation of the anchor in the parameter. This simplified a little bit the function calls. Signed-off-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 33 ++++++++++-------------- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 6 ++--- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 395c035..f850b0d 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2674,7 +2674,7 @@ void QGraphicsAnchorLayoutPrivate::calculateVertexPositions( continue; visited.insert(pair.second); - interpolateEdge(pair.first, edge, orientation); + interpolateEdge(pair.first, edge); QList adjacents = graph[orientation].adjacentVertices(pair.second); for (int i = 0; i < adjacents.count(); ++i) { @@ -2728,10 +2728,9 @@ void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation( vertices to be initalized, so it calls specialized functions that will recurse back to interpolateEdge(). */ -void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, - AnchorData *edge, - Orientation orientation) +void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, AnchorData *edge) { + const Orientation orientation = Orientation(edge->orientation); const QPair factor(interpolationInterval[orientation], interpolationProgress[orientation]); @@ -2749,13 +2748,12 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, // Process child anchors if (edge->type == AnchorData::Sequential) - interpolateSequentialEdges(static_cast(edge), orientation); + interpolateSequentialEdges(static_cast(edge)); else if (edge->type == AnchorData::Parallel) - interpolateParallelEdges(static_cast(edge), orientation); + interpolateParallelEdges(static_cast(edge)); } -void QGraphicsAnchorLayoutPrivate::interpolateParallelEdges( - ParallelAnchorData *data, Orientation orientation) +void QGraphicsAnchorLayoutPrivate::interpolateParallelEdges(ParallelAnchorData *data) { // In parallels the boundary vertices are already calculate, we // just need to look for sequential groups inside, because only @@ -2763,23 +2761,18 @@ void QGraphicsAnchorLayoutPrivate::interpolateParallelEdges( // First edge if (data->firstEdge->type == AnchorData::Sequential) - interpolateSequentialEdges(static_cast(data->firstEdge), - orientation); + interpolateSequentialEdges(static_cast(data->firstEdge)); else if (data->firstEdge->type == AnchorData::Parallel) - interpolateParallelEdges(static_cast(data->firstEdge), - orientation); + interpolateParallelEdges(static_cast(data->firstEdge)); // Second edge if (data->secondEdge->type == AnchorData::Sequential) - interpolateSequentialEdges(static_cast(data->secondEdge), - orientation); + interpolateSequentialEdges(static_cast(data->secondEdge)); else if (data->secondEdge->type == AnchorData::Parallel) - interpolateParallelEdges(static_cast(data->secondEdge), - orientation); + interpolateParallelEdges(static_cast(data->secondEdge)); } -void QGraphicsAnchorLayoutPrivate::interpolateSequentialEdges( - SequentialAnchorData *data, Orientation orientation) +void QGraphicsAnchorLayoutPrivate::interpolateSequentialEdges(SequentialAnchorData *data) { // This method is supposed to handle any sequential anchor, even out-of-order // ones. However, in the current QGAL implementation we should get only the @@ -2795,7 +2788,7 @@ void QGraphicsAnchorLayoutPrivate::interpolateSequentialEdges( for (int i = 0; i < data->m_edges.count() - 1; ++i) { AnchorData *edge = data->m_edges.at(i); - interpolateEdge(prev, edge, orientation); + interpolateEdge(prev, edge); // Use the recently calculated vertex as the base for the next one const bool edgeIsForward = (edge->from == prev); @@ -2805,7 +2798,7 @@ void QGraphicsAnchorLayoutPrivate::interpolateSequentialEdges( // Treat the last specially, since we already calculated it's end // vertex, so it's only interesting if it's a complex one if (data->m_edges.last()->type != AnchorData::Normal) - interpolateEdge(prev, data->m_edges.last(), orientation); + interpolateEdge(prev, data->m_edges.last()); } bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList &constraints, diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 3a22db0..3ef37f9 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -527,9 +527,9 @@ public: void calculateVertexPositions(Orientation orientation); void setupEdgesInterpolation(Orientation orientation); - void interpolateEdge(AnchorVertex *base, AnchorData *edge, Orientation orientation); - void interpolateSequentialEdges(SequentialAnchorData *edge, Orientation orientation); - void interpolateParallelEdges(ParallelAnchorData *edge, Orientation orientation); + void interpolateEdge(AnchorVertex *base, AnchorData *edge); + void interpolateSequentialEdges(SequentialAnchorData *edge); + void interpolateParallelEdges(ParallelAnchorData *edge); // Linear Programming solver methods bool solveMinMax(const QList &constraints, -- cgit v0.12 From b897c194904fe201f348bf6129314fbd1dda8c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Sat, 7 Nov 2009 21:29:49 +0100 Subject: The sizePolicy property of QGraphicsWidget should be of type QSizePolicy of course! --- src/gui/graphicsview/qgraphicswidget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 15dc878..05d3a49 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -77,7 +77,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize) Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize) Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize) - Q_PROPERTY(QSizePolicy::Policy sizePolicy READ sizePolicy WRITE setSizePolicy) + Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy) Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) -- cgit v0.12 From 0000d60b8bf38c9869b5f3ca43828f97af5488c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Sun, 8 Nov 2009 00:03:28 +0100 Subject: Use at() instead of operator[] for vectors and lists. Using operator[] can cause a deep copy if the container is not const. Some of the containers were const, but I changed all of them to use at() since its more Qt-style. --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 48 ++++++++++++------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 42972d2..182594e 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -801,7 +801,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyVertices(Orientation orientation) int index = 0; while (index < adjacents.count()) { - AnchorVertex *next = adjacents[index]; + AnchorVertex *next = adjacents.at(index); index++; AnchorData *data = g.edgeData(v, next); @@ -821,7 +821,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyVertices(Orientation orientation) const QList &nextAdjacents = g.adjacentVertices(next); for (int i = 0; i < vAdjacents.count(); ++i) { - AnchorVertex *adjacent = vAdjacents[i]; + AnchorVertex *adjacent = vAdjacents.at(i); if (adjacent != next) { AnchorData *ad = g.edgeData(v, adjacent); newV->m_firstAnchors.append(ad); @@ -829,7 +829,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyVertices(Orientation orientation) } for (int i = 0; i < nextAdjacents.count(); ++i) { - AnchorVertex *adjacent = nextAdjacents[i]; + AnchorVertex *adjacent = nextAdjacents.at(i); if (adjacent != v) { AnchorData *ad = g.edgeData(next, adjacent); newV->m_secondAnchors.append(ad); @@ -1118,14 +1118,14 @@ void QGraphicsAnchorLayoutPrivate::restoreSimplifiedConstraints(ParallelAnchorDa return; for (int i = 0; i < parallel->m_firstConstraints.count(); ++i) { - QSimplexConstraint *c = parallel->m_firstConstraints[i]; + QSimplexConstraint *c = parallel->m_firstConstraints.at(i); qreal v = c->variables[parallel]; c->variables.remove(parallel); c->variables.insert(parallel->firstEdge, v); } for (int i = 0; i < parallel->m_secondConstraints.count(); ++i) { - QSimplexConstraint *c = parallel->m_secondConstraints[i]; + QSimplexConstraint *c = parallel->m_secondConstraints.at(i); qreal v = c->variables[parallel]; c->variables.remove(parallel); c->variables.insert(parallel->secondEdge, v); @@ -1175,7 +1175,7 @@ void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation) // 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[i]; + AnchorVertexPair *pair = toRestore.at(i); QList adjacents = g.adjacentVertices(pair); // Restore the removed edge, this will also restore both vertices 'first' and 'second' to @@ -1186,7 +1186,7 @@ void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation) // Restore the anchors for the first child vertex for (int j = 0; j < pair->m_firstAnchors.count(); ++j) { - AnchorData *ad = pair->m_firstAnchors[j]; + AnchorData *ad = pair->m_firstAnchors.at(j); Q_ASSERT(ad->from == pair || ad->to == pair); replaceVertex_helper(ad, pair, first); @@ -1195,7 +1195,7 @@ void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation) // Restore the anchors for the second child vertex for (int j = 0; j < pair->m_secondAnchors.count(); ++j) { - AnchorData *ad = pair->m_secondAnchors[j]; + AnchorData *ad = pair->m_secondAnchors.at(j); Q_ASSERT(ad->from == pair || ad->to == pair); replaceVertex_helper(ad, pair, second); @@ -1203,7 +1203,7 @@ void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation) } for (int j = 0; j < adjacents.count(); ++j) { - g.takeEdge(pair, adjacents[j]); + g.takeEdge(pair, adjacents.at(j)); } // The pair simplified a layout vertex, so place back the correct vertex in the variable @@ -1225,7 +1225,7 @@ void QGraphicsAnchorLayoutPrivate::restoreVertices(Orientation orientation) QList ¶llelAnchors = anchorsFromSimplifiedVertices[orientation]; for (int i = parallelAnchors.count() - 1; i >= 0; --i) { - ParallelAnchorData *parallel = static_cast(parallelAnchors[i]); + ParallelAnchorData *parallel = static_cast(parallelAnchors.at(i)); restoreSimplifiedConstraints(parallel); delete parallel; } @@ -1432,7 +1432,7 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors( AnchorData *oldData = g.edgeData(first, center); // Remove center constraint for (int i = itemCenterConstraints[orientation].count() - 1; i >= 0; --i) { - if (itemCenterConstraints[orientation][i]->variables.contains(oldData)) { + if (itemCenterConstraints[orientation].at(i)->variables.contains(oldData)) { delete itemCenterConstraints[orientation].takeAt(i); break; } @@ -1496,7 +1496,7 @@ void QGraphicsAnchorLayoutPrivate::removeCenterConstraints(QGraphicsLayoutItem * // Look for our anchor in all item center constraints, then remove it for (int i = 0; i < itemCenterConstraints[orientation].size(); ++i) { - if (itemCenterConstraints[orientation][i]->variables.contains(internalAnchor)) { + if (itemCenterConstraints[orientation].at(i)->variables.contains(internalAnchor)) { delete itemCenterConstraints[orientation].takeAt(i); break; } @@ -2006,7 +2006,7 @@ QList getVariables(QList constraints) { QSet variableSet; for (int i = 0; i < constraints.count(); ++i) { - const QSimplexConstraint *c = constraints[i]; + const QSimplexConstraint *c = constraints.at(i); foreach (QSimplexVariable *var, c->variables.keys()) { variableSet += static_cast(var); } @@ -2091,7 +2091,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( // Now run the simplex solver to calculate Minimum, Preferred and Maximum sizes // of the "trunk" set of constraints and variables. // ### does trunk always exist? empty = trunk is the layout left->center->right - QList trunkConstraints = parts[0]; + QList trunkConstraints = parts.at(0); QList trunkVariables = getVariables(trunkConstraints); // For minimum and maximum, use the path between the two layout sides as the @@ -2110,7 +2110,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( if (!feasible) break; - QList partConstraints = parts[i]; + QList partConstraints = parts.at(i); QList partVariables = getVariables(partConstraints); Q_ASSERT(!partVariables.isEmpty()); feasible &= calculateNonTrunk(partConstraints, partVariables); @@ -2212,7 +2212,7 @@ bool QGraphicsAnchorLayoutPrivate::calculateNonTrunk(const QListsizeAtMinimum = ad->sizeAtPreferred; ad->sizeAtMaximum = ad->sizeAtPreferred; @@ -2325,7 +2325,7 @@ void QGraphicsAnchorLayoutPrivate::constraintsFromPaths(Orientation orientation) QList pathsToVertex = graphPaths[orientation].values(vertex); for (int i = 1; i < valueCount; ++i) { constraints[orientation] += \ - pathsToVertex[0].constraint(pathsToVertex[i]); + pathsToVertex[0].constraint(pathsToVertex.at(i)); } } } @@ -2377,7 +2377,7 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin QList anchorConstraints; bool unboundedProblem = true; for (int i = 0; i < anchors.size(); ++i) { - AnchorData *ad = anchors[i]; + AnchorData *ad = anchors.at(i); // Anchors that have their size directly linked to another one don't need constraints // For exammple, the second half of an item has exactly the same size as the first half @@ -2448,10 +2448,10 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation) QLinkedList remainingConstraints; for (int i = 0; i < constraints[orientation].count(); ++i) { - remainingConstraints += constraints[orientation][i]; + remainingConstraints += constraints[orientation].at(i); } for (int i = 0; i < itemCenterConstraints[orientation].count(); ++i) { - remainingConstraints += itemCenterConstraints[orientation][i]; + remainingConstraints += itemCenterConstraints[orientation].at(i); } QList trunkConstraints; @@ -2824,7 +2824,7 @@ bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList // Save sizeAtMinimum results QList variables = getVariables(constraints); for (int i = 0; i < variables.size(); ++i) { - AnchorData *ad = static_cast(variables[i]); + AnchorData *ad = static_cast(variables.at(i)); ad->sizeAtMinimum = ad->result; Q_ASSERT(ad->sizeAtMinimum >= ad->minSize || qAbs(ad->sizeAtMinimum - ad->minSize) < 0.00000001); @@ -2835,7 +2835,7 @@ bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList // Save sizeAtMaximum results for (int i = 0; i < variables.size(); ++i) { - AnchorData *ad = static_cast(variables[i]); + AnchorData *ad = static_cast(variables.at(i)); ad->sizeAtMaximum = ad->result; // Q_ASSERT(ad->sizeAtMaximum <= ad->maxSize || // qAbs(ad->sizeAtMaximum - ad->maxSize) < 0.00000001); @@ -2869,7 +2869,7 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QListskipInPreferred) continue; @@ -2900,7 +2900,7 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QListsizeAtPreferred = ad->result; } -- cgit v0.12 From d57d5b955cce23ba453fea79c6dd64d12c1c8145 Mon Sep 17 00:00:00 2001 From: Sarah Smith Date: Mon, 9 Nov 2009 11:00:14 +1000 Subject: Changes file update for Sarah Smith 4.6 changes. Describe 4.6 changes by Sarah Smith Reviewed-by: TrustMe --- dist/changes-4.6.0 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 5cd74cd..ecda510 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -477,3 +477,6 @@ General changes on Mac OS X: * QAnimationGroup::takeAnimationAt() has been renames to takeAnimation() * QSequentialAnimationGroup::insertPauseAt() has been renames to insertPause() +- Refactoring in OpenGL examples to improve portability and utilize the + Animation framework for animation. The hellogl and overpainting examples + now compile on OpenGL/ES 1.1. Also common code is factored. -- cgit v0.12 From 4ac97bb145c0a4109670f34be0ec0762e30494b1 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 9 Nov 2009 11:47:16 +1000 Subject: Change file updates for Rhys Weatherley --- dist/changes-4.6.0 | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index ecda510..5321ed1 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -25,6 +25,17 @@ information about a particular change. - [MR#1742] Added new multimedia keys to the Qt::Key enum. + - QMatrix4x4, QGenericMatrix, QVector2D, QVector3D, QVector4D, QQuaternion + * New classes to support 3D applications. + + - QGLShaderProgram, QGLShader + * New classes for using shader programs written in the GL Shading Language. + + - Boxes demo ported to use new 3D math and shader program classes. + + - OpenVG graphics system added. + + - Add 800x480 screen mode to qvfb configuration dialog. Third party components ---------------------- @@ -57,6 +68,7 @@ QtCore * Added QVariant(float) constructor * qvariant_cast and qVariantFromValue are now identify functions + * Added support for math3d types. - Qt::escape * now escape the double quote (") @@ -215,6 +227,45 @@ QtGui * [254563] Fixed a crash when setting a focus in a widget tree that contains invisible widgets + - QFontEngineQPF + * Make alphaMapForGlyph() generate the correct color table for + Indexed8 and Mono glyph images. Fixed the "all glyphs are white + boxes" problem in OpenGL1 paint engine. + + - QPaintDevice + * New qt_paint_device_metric() function to replace the friend + declarations for window surface classes that need to access metric(). + +QtOpenGL + + - QGLFormat + * Increase unit test coverage and fix some long-standing issues. + * Improve performance of code that tests QGLFormat options. + * operator==() now tests for equality on all fields. + + - QGLColormap + * setEntry() was inserting entries instead of replacing them. + * Clarified documentation for isEmpty(). + + - QGLFramebufferObject + * Add support for the ARB_framebuffer_object, OES_framebuffer_object, + and OES_packed_depth_stencil extensions. + * Unbind the texture after it is initialized. + * Don't destroy the texture target on cleanup if one wasn't created. + + - QGLFramebufferObjectFormat + * New class for controlling fbo options. + + - Improvements to context sharing and object cleanup logic. + + - QGLContext + * Fix RGB565 mode in bindTexture(). + * Map mipmaps work on OpenGL/ES 2.0 systems in bindTexture(). + * Improve performance of QGLContext::currentContext(). + + - QGLGradientCache + * [249919] Clean up the gradient cache in the right context. + **************************************************************************** * Platform Specific Changes * **************************************************************************** @@ -245,6 +296,29 @@ QtGui QMAKE_LIBS_OPENGL_ES2 qmake variables for specifying OpenGL ES specific libraries. + - Compilation fixes for OpenGL/ES 1.0 and OpenGL/ES 1.1 Common Lite. + + - EGL and OpenGL/ES + * Protect the use of version-specific EGL symbols with #ifdef's. + * Make sure an EGL context is current when resolving GL extensions. + * Introduce "lazyDoneCurrent" for optimizing context switching in + paint engines. + * Separate EGLSurface from QEglContext so that the same context can + be used with multiple surfaces. + * Move common functions from system-specific files to qgl_egl.cpp. + * Fix a memory leak of EGLSurface's in QGLContext. + * Fix detection of pbuffers on OpenGL/ES systems. + * EGL_SAMPLES was being set to the wrong value for multisampled surfaces. + + - PowerVR + * Make the code better at detecting MBX vs SGX header files. + * Fix 32-bit screen support - some code was still assuming 16-bit. + * Stop GL window surfaces double-flushing their contents. + * Remove surface holder, which never worked all that well. + * Implement screen rotations. + + - Remove obsolete OpenGL/ES screen drivers: hybrid, ahigl. + - KDE Integration: Improved the integration into KDE desktop (loading of KDE palette, usage of KColorDialog and KFileDialog) using the GuiPlatformPlugin -- cgit v0.12 From b8b7f98b01d9ad03fecac7a0f593ac5734d7af1d Mon Sep 17 00:00:00 2001 From: Keith Isdale Date: Mon, 9 Nov 2009 14:49:45 +1000 Subject: Mistake in the example for QByteArray::lastIndexOf() Correct typing error "azy" -> "az" Ensure that the example code returns indicated values. Task-number: QTBUG-5571 Reviewed-by: Peter Yard --- doc/src/snippets/code/src_corelib_tools_qbytearray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp b/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp index e87408a..52fbd1a 100644 --- a/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp +++ b/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp @@ -234,7 +234,7 @@ ba.indexOf("X"); // returns -1 //! [23] QByteArray x("crazy azimuths"); -QByteArray y("azy"); +QByteArray y("az"); x.lastIndexOf(y); // returns 6 x.lastIndexOf(y, 6); // returns 6 x.lastIndexOf(y, 5); // returns 2 -- cgit v0.12
"; out() << ""; + if (!qpn->isWritable()) + out() << "read-only"; generateQmlItem(qpn, relative, marker, false); out() << "