summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeir Vattekar <geir.vattekar@trolltech.com>2009-05-15 13:23:00 (GMT)
committerGeir Vattekar <geir.vattekar@trolltech.com>2009-05-15 13:23:00 (GMT)
commitfe7040348d82c5e5d302e7ec674fc0e3f68f06e1 (patch)
tree6b40b8c1e69a044aebd23f7b137d9abb4720b5e8 /src
parenta830e5f22a42d00b0b92544cfcb56c79b2c3b6cd (diff)
parent3875cd2b0a81c190939ea2803a2efbe890ae38ec (diff)
downloadQt-fe7040348d82c5e5d302e7ec674fc0e3f68f06e1.zip
Qt-fe7040348d82c5e5d302e7ec674fc0e3f68f06e1.tar.gz
Qt-fe7040348d82c5e5d302e7ec674fc0e3f68f06e1.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/phonon/phononnamespace.h5
-rw-r--r--src/corelib/arch/qatomic_mips.h106
-rw-r--r--src/corelib/concurrent/qfuturewatcher.cpp2
-rw-r--r--src/corelib/io/qdatastream.cpp2
-rw-r--r--src/corelib/io/qdir.cpp47
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp2
-rw-r--r--src/corelib/io/qtemporaryfile.cpp9
-rw-r--r--src/corelib/io/qtextstream.cpp7
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp4
-rw-r--r--src/corelib/kernel/qvariant.cpp5
-rw-r--r--src/corelib/tools/qhash.cpp220
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--src/corelib/tools/qstring.h2
-rw-r--r--src/corelib/tools/qtimeline.cpp4
-rw-r--r--src/corelib/tools/qvector.h2
-rw-r--r--src/dbus/qdbusintegrator.cpp11
-rw-r--r--src/dbus/qdbuspendingcall.cpp10
-rw-r--r--src/gui/dialogs/qfiledialog.cpp1
-rw-r--r--src/gui/dialogs/qfiledialog_p.h2
-rw-r--r--src/gui/dialogs/qsidebar.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp21
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp14
-rw-r--r--src/gui/image/qicon.cpp3
-rw-r--r--src/gui/image/qpixmap_win.cpp1
-rw-r--r--src/gui/kernel/qapplication.cpp137
-rw-r--r--src/gui/kernel/qapplication_qws.cpp69
-rw-r--r--src/gui/kernel/qapplication_win.cpp23
-rw-r--r--src/gui/kernel/qapplication_x11.cpp42
-rw-r--r--src/gui/kernel/qevent.cpp13
-rw-r--r--src/gui/kernel/qlayout.cpp9
-rw-r--r--src/gui/kernel/qshortcutmap.cpp1
-rw-r--r--src/gui/kernel/qwidget.cpp16
-rw-r--r--src/gui/kernel/qwidget_mac.mm14
-rw-r--r--src/gui/kernel/qwidget_x11.cpp13
-rw-r--r--src/gui/painting/qbackingstore.cpp3
-rw-r--r--src/gui/painting/qcolor.cpp4
-rw-r--r--src/gui/painting/qdrawhelper.cpp3
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp22
-rw-r--r--src/gui/painting/qpaintdevice_qws.cpp3
-rw-r--r--src/gui/painting/qpaintdevice_win.cpp5
-rw-r--r--src/gui/painting/qpaintdevice_x11.cpp216
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp19
-rw-r--r--src/gui/painting/qpainter.cpp252
-rw-r--r--src/gui/painting/qprinter.cpp10
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp11
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp4
-rw-r--r--src/gui/styles/qmacstyle_mac.mm96
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp2
-rw-r--r--src/gui/text/qcssparser.cpp16
-rw-r--r--src/gui/text/qfont.cpp2
-rw-r--r--src/gui/text/qfontengine_ft.cpp45
-rw-r--r--src/gui/text/qfontengine_win.cpp6
-rw-r--r--src/gui/text/qtexttable.cpp7
-rw-r--r--src/gui/util/qcompleter.cpp2
-rw-r--r--src/gui/widgets/qmenu_wince.cpp18
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp34
-rw-r--r--src/network/access/qhttpnetworkreply.cpp59
-rw-r--r--src/network/access/qhttpnetworkreply_p.h2
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp42
-rw-r--r--src/network/access/qnetworkcookie.cpp33
-rw-r--r--src/network/access/qnetworkcookie_p.h1
-rw-r--r--src/network/kernel/qauthenticator.cpp9
-rw-r--r--src/network/kernel/qnetworkproxy.cpp22
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp9
-rw-r--r--src/opengl/qglpixelbuffer_mac.mm3
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.h1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp7
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp29
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp12
-rw-r--r--src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp12
-rw-r--r--src/script/qscriptvalueiterator.cpp4
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp17
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp123
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp1
-rw-r--r--src/sql/kernel/qsqldatabase.cpp2
-rw-r--r--src/xmlpatterns/expr/qapplytemplate.cpp3
-rw-r--r--src/xmlpatterns/functions/qsequencefns.cpp3
79 files changed, 1145 insertions, 864 deletions
diff --git a/src/3rdparty/phonon/phonon/phononnamespace.h b/src/3rdparty/phonon/phonon/phononnamespace.h
index 0bbf4f4..2492ee6 100644
--- a/src/3rdparty/phonon/phonon/phononnamespace.h
+++ b/src/3rdparty/phonon/phonon/phononnamespace.h
@@ -25,6 +25,11 @@
#include "phonon_export.h"
+#ifdef __QT_SYNCQT__
+// Tell syncqt to create a "Global" header here
+#pragma qt_class(Phonon::Global)
+#endif
+
/**
* Helper macro that can be used like
* \code
diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h
index b263aab..ea9954b 100644
--- a/src/corelib/arch/qatomic_mips.h
+++ b/src/corelib/arch/qatomic_mips.h
@@ -103,16 +103,25 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree()
#if defined(Q_CC_GNU) && !defined(Q_OS_IRIX)
+#if _MIPS_SIM == _ABIO32
+#define SET_MIPS2 ".set mips2\n\t"
+#else
+#define SET_MIPS2
+#endif
+
inline bool QBasicAtomicInt::ref()
{
register int originalValue;
register int newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"addiu %[newValue], %[originalValue], %[one]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -125,12 +134,15 @@ inline bool QBasicAtomicInt::deref()
{
register int originalValue;
register int newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"addiu %[newValue], %[originalValue], %[minusOne]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -143,7 +155,9 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
{
register int result;
register int tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
"bnez %[result], 0f\n"
@@ -153,6 +167,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -166,7 +181,9 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
{
register int result;
register int tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
"bnez %[result], 0f\n"
@@ -177,6 +194,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
"nop\n"
"sync\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -190,7 +208,9 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
{
register int result;
register int tempValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
"ll %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
@@ -201,6 +221,7 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -219,12 +240,15 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue)
{
register int originalValue;
register int tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
"sc %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -237,13 +261,16 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue)
{
register int originalValue;
register int tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
"sc %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
"sync\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -256,13 +283,16 @@ inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue)
{
register int originalValue;
register int tempValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
"ll %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
"sc %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -280,12 +310,15 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd)
{
register int originalValue;
register int newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -298,13 +331,16 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd)
{
register int originalValue;
register int newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
"sync\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -317,13 +353,16 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd)
{
register int originalValue;
register int newValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
"ll %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -350,7 +389,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu
{
register T *result;
register T *tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
"bnez %[result], 0f\n"
@@ -360,6 +401,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -374,7 +416,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu
{
register T *result;
register T *tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
"bnez %[result], 0f\n"
@@ -385,6 +429,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu
"nop\n"
"sync\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -399,7 +444,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu
{
register T *result;
register T *tempValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
LLP" %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
@@ -410,6 +457,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -430,12 +478,15 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue)
{
register T *originalValue;
register T *tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
SCP" %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -449,13 +500,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue)
{
register T *originalValue;
register T *tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
SCP" %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
"sync\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -469,13 +523,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue)
{
register T *originalValue;
register T *tempValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
LLP" %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
SCP" %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -495,12 +552,15 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueTo
{
register T *originalValue;
register T *newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
SCP" %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -514,13 +574,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueTo
{
register T *originalValue;
register T *newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
SCP" %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
"sync\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -534,13 +597,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueTo
{
register T *originalValue;
register T *newValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
LLP" %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
SCP" %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
diff --git a/src/corelib/concurrent/qfuturewatcher.cpp b/src/corelib/concurrent/qfuturewatcher.cpp
index ea35e9e..39d7698 100644
--- a/src/corelib/concurrent/qfuturewatcher.cpp
+++ b/src/corelib/concurrent/qfuturewatcher.cpp
@@ -465,7 +465,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
break;
emit q->progressValueChanged(event->index1);
- if (event->text != QString()) // ###
+ if (!event->text.isNull()) // ###
q->progressTextChanged(event->text);
break;
case QFutureCallOutEvent::ProgressRange:
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 9990696..b203899 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -514,7 +514,7 @@ void QDataStream::setByteOrder(ByteOrder bo)
\value Qt_4_2 Version 8 (Qt 4.2)
\value Qt_4_3 Version 9 (Qt 4.3)
\value Qt_4_4 Version 10 (Qt 4.4)
- \value Qt_4_5 Version 10 (Qt 4.5)
+ \value Qt_4_5 Version 11 (Qt 4.5)
\omitvalue Qt_4_6
\sa setVersion(), version()
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 6d75c59..b7861ba 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -50,6 +50,7 @@
#include "qstring.h"
#include "qregexp.h"
#include "qvector.h"
+#include "qalgorithms.h"
#ifdef QT_BUILD_CORE_LIB
# include "qresource.h"
#endif
@@ -190,32 +191,28 @@ QDirPrivate::~QDirPrivate()
/* For sorting */
struct QDirSortItem {
- QString filename_cache;
- QString suffix_cache;
+ mutable QString filename_cache;
+ mutable QString suffix_cache;
QFileInfo item;
};
-static int qt_cmp_si_sort_flags;
-#if defined(Q_C_CALLBACKS)
-extern "C" {
-#endif
-#ifdef Q_OS_WINCE
-static int __cdecl qt_cmp_si(const void *n1, const void *n2)
-#else
-static int qt_cmp_si(const void *n1, const void *n2)
-#endif
-{
- if (!n1 || !n2)
- return 0;
+class QDirSortItemComparator {
+ int qt_cmp_si_sort_flags;
+public:
+ QDirSortItemComparator(int flags) : qt_cmp_si_sort_flags(flags) {}
+ bool operator()(const QDirSortItem &, const QDirSortItem &);
+};
- QDirSortItem* f1 = (QDirSortItem*)n1;
- QDirSortItem* f2 = (QDirSortItem*)n2;
+bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortItem &n2)
+{
+ const QDirSortItem* f1 = &n1;
+ const QDirSortItem* f2 = &n2;
if ((qt_cmp_si_sort_flags & QDir::DirsFirst) && (f1->item.isDir() != f2->item.isDir()))
- return f1->item.isDir() ? -1 : 1;
+ return f1->item.isDir();
if ((qt_cmp_si_sort_flags & QDir::DirsLast) && (f1->item.isDir() != f2->item.isDir()))
- return f1->item.isDir() ? 1 : -1;
+ return !f1->item.isDir();
int r = 0;
int sortBy = (qt_cmp_si_sort_flags & QDir::SortByMask)
@@ -264,18 +261,11 @@ static int qt_cmp_si(const void *n1, const void *n2)
: f1->filename_cache.compare(f2->filename_cache);
}
- if (r == 0) // Enforce an order - the order the items appear in the array
- r = (char*)n1 - (char*)n2;
-
if (qt_cmp_si_sort_flags & QDir::Reversed)
- return -r;
- return r;
+ return r > 0;
+ return r < 0;
}
-#if defined(Q_C_CALLBACKS)
-}
-#endif
-
inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QStringList &l,
QStringList *names, QFileInfoList *infos) const
{
@@ -292,9 +282,8 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QStringList &l,
path += QLatin1Char('/');
si[i].item = QFileInfo(path + l.at(i));
}
- qt_cmp_si_sort_flags = sort;
if ((sort & QDir::SortByMask) != QDir::Unsorted)
- qsort(si, i, sizeof(si[0]), qt_cmp_si);
+ qStableSort(si, si+i, QDirSortItemComparator(sort));
// put them back in the list(s)
for (int j = 0; j<i; j++) {
if(infos)
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 0d88b06..18b92e2 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -780,7 +780,7 @@ QString QFSFileEngine::fileName(FileName file) const
#endif
if (len > 0) {
QString ret;
- if (S_ISDIR(d->st.st_mode) && s[0] != '/') {
+ if (d->doStat() && S_ISDIR(d->st.st_mode) && s[0] != '/') {
QDir parent(d->filePath);
parent.cdUp();
ret = parent.path();
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 4856353..6a9125c 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -294,6 +294,8 @@ public:
QTemporaryFileEngine(const QString &file) : QFSFileEngine(file) { }
~QTemporaryFileEngine();
+ void setFileName(const QString &file);
+
bool open(QIODevice::OpenMode flags);
bool remove();
bool close();
@@ -304,6 +306,13 @@ QTemporaryFileEngine::~QTemporaryFileEngine()
QFSFileEngine::close();
}
+void QTemporaryFileEngine::setFileName(const QString &file)
+{
+ // Really close the file, so we don't leak
+ QFSFileEngine::close();
+ QFSFileEngine::setFileName(file);
+}
+
bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
{
Q_D(QFSFileEngine);
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 2010008..1167671 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -67,9 +67,10 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
\snippet doc/src/snippets/code/src_corelib_io_qtextstream.cpp 1
Note that you cannot use QTextStream::atEnd(), which returns true when you
- have reached the end of the data stream, with stdin because as long as the
- application is running, stdin has no end.
-
+ have reached the end of the data stream, with stdin. The reason for this is
+ that as long as stdin doesn't give any input to the QTextStream, \c atEnd()
+ will return true even if the stdin is open and waiting for more characters.
+
Besides using QTextStream's constructors, you can also set the
device or string QTextStream operates on by calling setDevice() or
setString(). You can seek to a position by calling seek(), and
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index a23b2dd..f6ce4b3 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1696,7 +1696,7 @@ QString QCoreApplication::applicationDirPath()
}
QCoreApplicationPrivate *d = self->d_func();
- if (d->cachedApplicationDirPath == QString())
+ if (d->cachedApplicationDirPath.isNull())
d->cachedApplicationDirPath = QFileInfo(applicationFilePath()).path();
return d->cachedApplicationDirPath;
}
@@ -1724,7 +1724,7 @@ QString QCoreApplication::applicationFilePath()
}
QCoreApplicationPrivate *d = self->d_func();
- if (d->cachedApplicationFilePath != QString())
+ if (!d->cachedApplicationFilePath.isNull())
return d->cachedApplicationFilePath;
#if defined( Q_WS_WIN )
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index b4427c0..0a0500d 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1187,8 +1187,9 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler;
and versatile, but may prove less memory and speed efficient than
storing specific types in standard data structures.
- QVariant also supports the notion of null values, where you have
- a defined type with no value set.
+ QVariant also supports the notion of null values, where you can
+ have a defined type with no value set. However, note that QVariant
+ types can only be cast when they have had a value set.
\snippet doc/src/snippets/code/src_corelib_kernel_qvariant.cpp 1
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 21d98b5..2313e0e 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -379,6 +379,107 @@ void QHashData::checkSanity()
#endif
/*!
+ \fn uint qHash(const QPair<T1, T2> &key)
+ \since 4.3
+ \relates QHash
+
+ Returns the hash value for the \a key.
+
+ Types \c T1 and \c T2 must be supported by qHash().
+*/
+
+/*! \fn uint qHash(char key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(uchar key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(signed char key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(ushort key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(short key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(uint key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(int key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(ulong key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(long key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(quint64 key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(qint64 key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(QChar key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(const QByteArray &key)
+ \fn uint qHash(const QBitArray &key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(const QString &key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(const T *key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*!
\class QHash
\brief The QHash class is a template class that provides a hash-table-based dictionary.
@@ -401,7 +502,8 @@ void QHashData::checkSanity()
key. With QHash, the items are arbitrarily ordered.
\i The key type of a QMap must provide operator<(). The key
type of a QHash must provide operator==() and a global
- \l{qHash()}{qHash}(Key) function.
+ hash function called qHash() (see the related non-member
+ functions).
\endlist
Here's an example QHash with QString keys and \c int values:
@@ -732,7 +834,6 @@ void QHashData::checkSanity()
*/
/*! \fn const T QHash::value(const Key &key, const T &defaultValue) const
-
\overload
If the hash contains no item with the given \a key, the function returns
@@ -1490,121 +1591,6 @@ void QHashData::checkSanity()
\sa operator+=(), operator-()
*/
-/*! \fn uint qHash(char key)
- \relates QHash
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(uchar key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(signed char key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(ushort key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(short key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(uint key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(int key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(ulong key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(long key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(quint64 key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(qint64 key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(QChar key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(const QByteArray &key)
- \fn uint qHash(const QBitArray &key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(const QString &key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(const T *key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*!
- \fn uint qHash(const QPair<T1, T2> &key)
- \relates QHash
- \since 4.3
-
- Returns the hash value for the \a key.
-
- Types \c T1 and \c T2 must be supported by qHash().
-*/
-
/*! \fn QDataStream &operator<<(QDataStream &out, const QHash<Key, T>& hash)
\relates QHash
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 375d672..c3649e3 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -743,7 +743,9 @@ int QString::grow(int size)
/*!
\since 4.2
- Returns a copy of the \a string string encoded in ucs4.
+ Returns a copy of the \a string, where the encoding of \a string depends on
+ the size of wchar. If wchar is 4 bytes, the \a string is interpreted as ucs-4,
+ if wchar is 2 bytes it is interpreted as ucs-2.
If \a size is -1 (default), the \a string has to be 0 terminated.
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 1493dce..69c4f2f 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -113,7 +113,7 @@ public:
int capacity() const;
inline void reserve(int size);
- inline void squeeze() { if (d->size < d->alloc) realloc(); d->capacity = 0;}
+ inline void squeeze() { if (d->size < d->alloc || d->ref != 1) realloc(); d->capacity = 0;}
inline const QChar *unicode() const;
inline QChar *data();
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp
index 2979a09..3a03558 100644
--- a/src/corelib/tools/qtimeline.cpp
+++ b/src/corelib/tools/qtimeline.cpp
@@ -225,7 +225,9 @@ void QTimeLinePrivate::setCurrentTime(int msecs)
valueForTime() and emitting valueChanged(). By default, valueForTime()
applies an interpolation algorithm to generate these value. You can choose
from a set of predefined timeline algorithms by calling
- setCurveShape(). By default, QTimeLine uses the EaseInOut curve shape,
+ setCurveShape().
+
+ Note that by default, QTimeLine uses the EaseInOut curve shape,
which provides a value that grows slowly, then grows steadily, and
finally grows slowly. For a custom timeline, you can reimplement
valueForTime(), in which case QTimeLine's curveShape property is ignored.
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 3fd52ee..1f047b8 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -315,7 +315,7 @@ void QVector<T>::detach_helper()
{ realloc(d->size, d->alloc); }
template <typename T>
void QVector<T>::reserve(int asize)
-{ if (asize > d->alloc) realloc(d->size, asize); d->capacity = 1; }
+{ if (asize > d->alloc || d->ref != 1) realloc(d->size, asize); d->capacity = 1; }
template <typename T>
void QVector<T>::resize(int asize)
{ realloc(asize, (asize > d->alloc || (!d->capacity && asize < d->size && asize < (d->alloc >> 1))) ?
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 2c27381..f40a45f 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1125,12 +1125,7 @@ void QDBusConnectionPrivate::objectDestroyed(QObject *obj)
void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, int signalId,
const QVariantList &args)
{
- int mciid = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE);
- Q_ASSERT(mciid != -1);
-
- QMetaClassInfo mci = mo->classInfo(mciid);
- Q_ASSERT(mci.value());
- const char *interface = mci.value();
+ QString interface = qDBusInterfaceFromMetaObject(mo);
QMetaMethod mm = mo->method(signalId);
QByteArray memberName = mm.signature();
@@ -1146,12 +1141,12 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
}
QDBusReadLocker locker(RelaySignalAction, this);
- QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), QLatin1String(interface),
+ QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface,
QLatin1String(memberName));
message.setArguments(args);
DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
if (!msg) {
- qWarning("QDBusConnection: Could not emit signal %s.%s", interface, memberName.constData());
+ qWarning("QDBusConnection: Could not emit signal %s.%s", qPrintable(interface), memberName.constData());
return;
}
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index 9753bbe..955f4a0 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -432,9 +432,14 @@ inline void QDBusPendingCallWatcherPrivate::_q_finished()
QDBusPendingCallWatcher::QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent)
: QObject(*new QDBusPendingCallWatcherPrivate, parent), QDBusPendingCall(call)
{
- if (d) {
- if (!d->watcherHelper)
+ if (d) { // QDBusPendingCall::d
+ if (!d->watcherHelper) {
d->watcherHelper = new QDBusPendingCallWatcherHelper;
+ if (isFinished()) {
+ // cause a signal emission anyways
+ QMetaObject::invokeMethod(d->watcherHelper, "finished", Qt::QueuedConnection);
+ }
+ }
d->watcherHelper->add(this);
}
}
@@ -464,6 +469,7 @@ void QDBusPendingCallWatcher::waitForFinished()
d->waitForFinished();
// our signals were queued, so deliver them
+ QCoreApplication::sendPostedEvents(d->watcherHelper, QEvent::MetaCall);
QCoreApplication::sendPostedEvents(this, QEvent::MetaCall);
}
}
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 2f524cb..eeb2743 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -2142,7 +2142,6 @@ void QFileDialogPrivate::createWidgets()
#ifndef QT_NO_COMPLETER
completer = new QFSCompletor(model, q);
qFileDialogUi->fileNameEdit->setCompleter(completer);
- completer->sourceModel = model;
QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)),
q, SLOT(_q_autoCompleteFileName(QString)));
#endif // QT_NO_COMPLETER
diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h
index dc24390..ab4199e 100644
--- a/src/gui/dialogs/qfiledialog_p.h
+++ b/src/gui/dialogs/qfiledialog_p.h
@@ -97,7 +97,7 @@ class Ui_QFileDialog;
*/
class QFSCompletor : public QCompleter {
public:
- QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(0)
+ QFSCompletor(QFileSystemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(model)
{
#ifdef Q_OS_WIN
setCaseSensitivity(Qt::CaseInsensitive);
diff --git a/src/gui/dialogs/qsidebar.cpp b/src/gui/dialogs/qsidebar.cpp
index 26108d7..000a06b 100644
--- a/src/gui/dialogs/qsidebar.cpp
+++ b/src/gui/dialogs/qsidebar.cpp
@@ -249,9 +249,9 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move)
continue;
for (int j = 0; move && j < rowCount(); ++j) {
#if defined(Q_OS_WIN)
- if (index(j, 0).data(UrlRole).toUrl().toLocalFile().toLower() == url.toLocalFile().toLower()) {
+ if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()).toLower() == QDir::cleanPath(url.toLocalFile()).toLower()) {
#else
- if (index(j, 0).data(UrlRole) == url) {
+ if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()) == QDir::cleanPath(url.toLocalFile())) {
#endif
removeRow(j);
if (j <= row)
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 93cd7d9..4908296 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1225,8 +1225,8 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
return;
// Flags that alter the geometry of the item (or its children).
- int geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations);
- bool fullUpdate = (flags & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask);
+ const quint32 geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations);
+ bool fullUpdate = (quint32(flags) & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask);
if (fullUpdate)
d_ptr->fullUpdateHelper(false, true);
@@ -2572,6 +2572,10 @@ QTransform QGraphicsItem::sceneTransform() const
*/
QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) const
{
+ // Ensure we return the standard transform if we're not untransformable.
+ if (!d_ptr->itemIsUntransformable())
+ return sceneTransform() * viewportTransform;
+
// Find the topmost item that ignores view transformations.
const QGraphicsItem *untransformedAncestor = this;
QList<const QGraphicsItem *> parents;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 13f70e5..b89e352 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2289,12 +2289,7 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect
// Calculate a simple level-of-detail metric.
// ### almost identical code in QGraphicsView::paintEvent()
// and QGraphicsView::render() - consider refactoring
- QTransform itemToDeviceTransform;
- if (item->d_ptr->itemIsUntransformable()) {
- itemToDeviceTransform = item->deviceTransform(painterTransform);
- } else {
- itemToDeviceTransform = item->sceneTransform() * painterTransform;
- }
+ QTransform itemToDeviceTransform = item->deviceTransform(painterTransform);
option.levelOfDetail = qSqrt(itemToDeviceTransform.map(v1).length() * itemToDeviceTransform.map(v2).length());
option.matrix = itemToDeviceTransform.toAffine(); //### discards perspective
@@ -5078,11 +5073,7 @@ void QGraphicsScene::drawItems(QPainter *painter,
// optimization, but it's hit very rarely.
for (int i = clippers.size() - 1; i >= 0; --i) {
QGraphicsItem *clipper = clippers[i];
- if (clipper->d_ptr->itemIsUntransformable()) {
- painter->setWorldTransform(clipper->deviceTransform(viewTransform), false);
- } else {
- painter->setWorldTransform(clipper->sceneTransform() * viewTransform, false);
- }
+ painter->setWorldTransform(clipper->deviceTransform(viewTransform), false);
childClippers.append(clipper);
painter->save();
@@ -5093,12 +5084,8 @@ void QGraphicsScene::drawItems(QPainter *painter,
}
// Set up the painter transform
- if (item->d_ptr->itemIsUntransformable()) {
- painter->setWorldTransform(item->deviceTransform(viewTransform), false);
- } else {
- painter->setWorldTransform(item->sceneTransform() * viewTransform, false);
- }
-
+ painter->setWorldTransform(item->deviceTransform(viewTransform), false);
+
// Save painter
bool saveState = (d->painterStateProtection || (item->flags() & QGraphicsItem::ItemClipsToShape));
if (saveState)
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 05e4907..a795fb4 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -1153,11 +1153,7 @@ void QGraphicsViewPrivate::generateStyleOptions(const QList<QGraphicsItem *> &it
// Calculate a simple level-of-detail metric.
// ### almost identical code in QGraphicsScene::render()
// and QGraphicsView::render() - consider refactoring
- if (item->d_ptr->itemIsUntransformable()) {
- itemToViewportTransform = item->deviceTransform(worldTransform);
- } else {
- itemToViewportTransform = item->sceneTransform() * worldTransform;
- }
+ itemToViewportTransform = item->deviceTransform(worldTransform);
if (itemToViewportTransform.type() <= QTransform::TxTranslate) {
// Translation and rotation only? The LOD is 1.
@@ -1681,6 +1677,7 @@ void QGraphicsView::setScene(QGraphicsScene *scene)
disconnect(d->scene, SIGNAL(sceneRectChanged(QRectF)),
this, SLOT(updateSceneRect(QRectF)));
d->scene->d_func()->views.removeAll(this);
+ d->connectedToScene = false;
}
// Assign the new scene and update the contents (scrollbars, etc.)).
@@ -2159,12 +2156,7 @@ void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect
// Calculate a simple level-of-detail metric.
// ### almost identical code in QGraphicsScene::render()
// and QGraphicsView::paintEvent() - consider refactoring
- QTransform itemToViewportTransform;
- if (item->d_ptr->itemIsUntransformable()) {
- itemToViewportTransform = item->deviceTransform(painterMatrix);
- } else {
- itemToViewportTransform = item->sceneTransform() * painterMatrix;
- }
+ QTransform itemToViewportTransform = item->deviceTransform(painterMatrix);
option->levelOfDetail = qSqrt(itemToViewportTransform.map(v1).length() * itemToViewportTransform.map(v2).length());
option->matrix = itemToViewportTransform.toAffine();
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 3c71f15..53430ab 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -854,6 +854,9 @@ void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state)
QImageWriter::supportedImageFormats() functions to retrieve a
complete list of the supported file formats.
+ Note: When you add a non-empty filename to a QIcon, the icon becomes
+ non-null, even if the file doesn't exist or points to a corrupt file.
+
\sa addPixmap()
*/
void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State state)
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index 3ec441b..cbe9004 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -319,6 +319,7 @@ static QImage qt_fromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h)
} else {
qWarning("qt_fromWinHBITMAP(), failed to get bitmap bits");
}
+ qFree(data);
return image;
}
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index d0b1790..4cf0ad7 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -2032,12 +2032,10 @@ QWidget *QApplication::focusWidget()
void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
{
- if (focus && focus->window()
#ifndef QT_NO_GRAPHICSVIEW
- && focus->window()->graphicsProxyWidget()
-#endif
- )
+ if (focus && focus->window()->graphicsProxyWidget())
return;
+#endif
hidden_focus_widget = 0;
@@ -4998,6 +4996,137 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy)
return true;
}
+/*! \fn QDecoration &QApplication::qwsDecoration()
+ Return the QWSDecoration used for decorating windows.
+
+ \warning This method is non-portable. It is only available in
+ Qt for Embedded Linux.
+
+ \sa QDecoration
+*/
+
+/*!
+ \fn void QApplication::qwsSetDecoration(QDecoration *decoration)
+
+ Sets the QDecoration derived class to use for decorating the
+ windows used by Qt for Embedded Linux to the \a decoration
+ specified.
+
+ This method is non-portable. It is only available in Qt for Embedded Linux.
+
+ \sa QDecoration
+*/
+
+/*! \fn QDecoration* QApplication::qwsSetDecoration(const QString &decoration)
+ \overload
+
+ Requests a QDecoration object for \a decoration from the QDecorationFactory.
+
+ The string must be one of the QDecorationFactory::keys(). Keys are
+ case insensitive.
+
+ A later call to the QApplication constructor will override the
+ requested style when a "-style" option is passed in as a commandline
+ parameter.
+
+ Returns 0 if an unknown \a decoration is passed, otherwise the QStyle object
+ returned is set as the application's GUI style.
+*/
+
+/*!
+ \fn bool QApplication::qwsEventFilter(QWSEvent *event)
+
+ This virtual function is only implemented under Qt for Embedded Linux.
+
+ If you create an application that inherits QApplication and
+ reimplement this function, you get direct access to all QWS (Q
+ Window System) events that the are received from the QWS master
+ process. The events are passed in the \a event parameter.
+
+ Return true if you want to stop the event from being processed.
+ Return false for normal event dispatching. The default
+ implementation returns false.
+*/
+
+/*! \fn void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors)
+ Set Qt for Embedded Linux custom color table.
+
+ Qt for Embedded Linux on 8-bpp displays allocates a standard 216 color cube.
+ The remaining 40 colors may be used by setting a custom color
+ table in the QWS master process before any clients connect.
+
+ \a colorTable is an array of up to 40 custom colors. \a start is
+ the starting index (0-39) and \a numColors is the number of colors
+ to be set (1-40).
+
+ This method is non-portable. It is available \e only in
+ Qt for Embedded Linux.
+
+ \note The custom colors will not be used by the default screen
+ driver. To make use of the new colors, implement a custom screen
+ driver, or use QDirectPainter.
+*/
+
+/*! \fn int QApplication::qwsProcessEvent(QWSEvent* event)
+ \internal
+*/
+
+/*! \fn int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only)
+ \internal
+*/
+
+/*! \fn int QApplication::x11ProcessEvent(XEvent* event)
+ This function does the core processing of individual X
+ \a{event}s, normally by dispatching Qt events to the right
+ destination.
+
+ It returns 1 if the event was consumed by special handling, 0 if
+ the \a event was consumed by normal handling, and -1 if the \a
+ event was for an unrecognized widget.
+
+ \sa x11EventFilter()
+*/
+
+/*!
+ \fn bool QApplication::x11EventFilter(XEvent *event)
+
+ \warning This virtual function is only implemented under X11.
+
+ If you create an application that inherits QApplication and
+ reimplement this function, you get direct access to all X events
+ that the are received from the X server. The events are passed in
+ the \a event parameter.
+
+ Return true if you want to stop the event from being processed.
+ Return false for normal event dispatching. The default
+ implementation returns false.
+
+ It is only the directly addressed messages that are filtered.
+ You must install an event filter directly on the event
+ dispatcher, which is returned by
+ QAbstractEventDispatcher::instance(), to handle system wide
+ messages.
+
+ \sa x11ProcessEvent()
+*/
+
+/*! \fn void QApplication::winFocus(QWidget *widget, bool gotFocus)
+ \internal
+ \since 4.1
+
+ If \a gotFocus is true, \a widget will become the active window.
+ Otherwise the active window is reset to 0.
+*/
+
+/*! \fn void QApplication::winMouseButtonUp()
+ \internal
+ */
+
+/*! \fn void QApplication::syncX()
+ Synchronizes with the X server in the X11 implementation.
+ This normally takes some time. Does nothing on other platforms.
+*/
+
QT_END_NAMESPACE
#include "moc_qapplication.cpp"
diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp
index 2deda8e..018440f 100644
--- a/src/gui/kernel/qapplication_qws.cpp
+++ b/src/gui/kernel/qapplication_qws.cpp
@@ -2675,9 +2675,6 @@ void QApplication::alert(QWidget *, int)
{
}
-/*!
- \internal
-*/
int QApplication::qwsProcessEvent(QWSEvent* event)
{
Q_D(QApplication);
@@ -3056,43 +3053,11 @@ int QApplication::qwsProcessEvent(QWSEvent* event)
return 0;
}
-/*!
- \fn bool QApplication::qwsEventFilter(QWSEvent *event)
-
- This virtual function is only implemented under Qt for Embedded Linux.
-
- If you create an application that inherits QApplication and
- reimplement this function, you get direct access to all QWS (Q
- Window System) events that the are received from the QWS master
- process. The events are passed in the \a event parameter.
-
- Return true if you want to stop the event from being processed.
- Return false for normal event dispatching. The default
- implementation returns false.
-*/
bool QApplication::qwsEventFilter(QWSEvent *)
{
return false;
}
-/*!
- Set Qt for Embedded Linux custom color table.
-
- Qt for Embedded Linux on 8-bpp displays allocates a standard 216 color cube.
- The remaining 40 colors may be used by setting a custom color
- table in the QWS master process before any clients connect.
-
- \a colorTable is an array of up to 40 custom colors. \a start is
- the starting index (0-39) and \a numColors is the number of colors
- to be set (1-40).
-
- This method is non-portable. It is available \e only in
- Qt for Embedded Linux.
-
- \note The custom colors will not be used by the default screen
- driver. To make use of the new colors, implement a custom screen
- driver, or use QDirectPainter.
-*/
void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors)
{
if (start < 0 || start > 39) {
@@ -3111,30 +3076,11 @@ void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors
}
#ifndef QT_NO_QWS_MANAGER
-/*!
- Return the QWSDecoration used for decorating windows.
-
- \warning This method is non-portable. It is only available in
- Qt for Embedded Linux.
-
- \sa QDecoration
-*/
QDecoration &QApplication::qwsDecoration()
{
return *qws_decoration;
}
-/*!
- \fn void QApplication::qwsSetDecoration(QDecoration *decoration)
-
- Sets the QDecoration derived class to use for decorating the
- windows used by Qt for Embedded Linux to the \a decoration
- specified.
-
- This method is non-portable. It is only available in Qt for Embedded Linux.
-
- \sa QDecoration
-*/
void QApplication::qwsSetDecoration(QDecoration *dec)
{
if (dec) {
@@ -3153,21 +3099,6 @@ void QApplication::qwsSetDecoration(QDecoration *dec)
}
}
-/*!
- \overload
-
- Requests a QDecoration object for \a decoration from the QDecorationFactory.
-
- The string must be one of the QDecorationFactory::keys(). Keys are
- case insensitive.
-
- A later call to the QApplication constructor will override the
- requested style when a "-style" option is passed in as a commandline
- parameter.
-
- Returns 0 if an unknown \a decoration is passed, otherwise the QStyle object
- returned is set as the application's GUI style.
-*/
QDecoration* QApplication::qwsSetDecoration(const QString &decoration)
{
QDecoration *decore = QDecorationFactory::create(decoration);
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index bc32c14..f14ad6f 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1371,13 +1371,6 @@ QString QApplicationPrivate::appName() const
extern uint qGlobalPostedEventsCount();
-/*!
- \internal
- \since 4.1
-
- If \a gotFocus is true, \a widget will become the active window.
- Otherwise the active window is reset to 0.
-*/
void QApplication::winFocus(QWidget *widget, bool gotFocus)
{
if (d_func()->inPopupMode()) // some delayed focus event to ignore
@@ -1732,6 +1725,21 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
// fall-through intended
case WM_KEYUP:
case WM_SYSKEYUP:
+#if Q_OS_WINCE_WM
+ case WM_HOTKEY:
+ if(HIWORD(msg.lParam) == VK_TBACK) {
+ const bool hotKeyDown = !(LOWORD(msg.lParam) & MOD_KEYUP);
+ msg.lParam = 0x69 << 16;
+ msg.wParam = VK_BACK;
+ if (hotKeyDown) {
+ msg.message = WM_KEYDOWN;
+ qt_keymapper_private()->updateKeyMap(msg);
+ } else {
+ msg.message = WM_KEYUP;
+ }
+ }
+ // fall-through intended
+#endif
case WM_IME_CHAR:
case WM_IME_KEYDOWN:
case WM_CHAR: {
@@ -2921,7 +2929,6 @@ void qt_win_eatMouseMove()
// In DnD, the mouse release event never appears, so the
// mouse button state machine must be manually reset
-/*! \internal */
void QApplication::winMouseButtonUp()
{
qt_button_down = 0;
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 15149a5..a3c9406 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -2976,11 +2976,6 @@ QWidget *QApplication::topLevelAt(const QPoint &p)
#endif
}
-/*!
- Synchronizes with the X server in the X11 implementation. This
- normally takes some time. Does nothing on other platforms.
-*/
-
void QApplication::syncX()
{
if (X11->display)
@@ -3086,9 +3081,6 @@ static QETWidget *qPRFindWidget(Window oldwin)
return wPRmapper ? (QETWidget*)wPRmapper->value((int)oldwin, 0) : 0;
}
-/*!
- \internal
-*/
int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only)
{
if (w && !w->internalWinId())
@@ -3151,17 +3143,6 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only)
return 0;
}
-/*!
- This function does the core processing of individual X
- \a{event}s, normally by dispatching Qt events to the right
- destination.
-
- It returns 1 if the event was consumed by special handling, 0 if
- the \a event was consumed by normal handling, and -1 if the \a
- event was for an unrecognized widget.
-
- \sa x11EventFilter()
-*/
int QApplication::x11ProcessEvent(XEvent* event)
{
Q_D(QApplication);
@@ -3843,29 +3824,6 @@ int QApplication::x11ProcessEvent(XEvent* event)
return 0;
}
-/*!
- \fn bool QApplication::x11EventFilter(XEvent *event)
-
- \warning This virtual function is only implemented under X11.
-
- If you create an application that inherits QApplication and
- reimplement this function, you get direct access to all X events
- that the are received from the X server. The events are passed in
- the \a event parameter.
-
- Return true if you want to stop the event from being processed.
- Return false for normal event dispatching. The default
- implementation returns false.
-
- It is only the directly addressed messages that are filtered.
- You must install an event filter directly on the event
- dispatcher, which is returned by
- QAbstractEventDispatcher::instance(), to handle system wide
- messages.
-
- \sa x11ProcessEvent()
-*/
-
bool QApplication::x11EventFilter(XEvent *)
{
return false;
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 8c7e47d..2aed287 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -675,12 +675,13 @@ QWheelEvent::QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
The \a type parameter must be QEvent::KeyPress, QEvent::KeyRelease,
or QEvent::ShortcutOverride.
- If \a key is 0, the event is not a result of
- a known key; for example, it may be the result of a compose
- sequence or keyboard macro. The \a modifiers holds the keyboard
- modifiers, and the given \a text is the Unicode text that the
- key generated. If \a autorep is true, isAutoRepeat() will be
- true. \a count is the number of keys involved in the event.
+ Int \a key is the code for the Qt::Key that the event loop should listen
+ for. If \a key is 0, the event is not a result of a known key; for
+ example, it may be the result of a compose sequence or keyboard macro.
+ The \a modifiers holds the keyboard modifiers, and the given \a text
+ is the Unicode text that the key generated. If \a autorep is true,
+ isAutoRepeat() will be true. \a count is the number of keys involved
+ in the event.
*/
QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text,
bool autorep, ushort count)
diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp
index 1d5a70d..4463aab 100644
--- a/src/gui/kernel/qlayout.cpp
+++ b/src/gui/kernel/qlayout.cpp
@@ -1028,8 +1028,13 @@ void QLayout::freeze(int w, int h)
void QLayout::setMenuBar(QWidget *widget)
{
Q_D(QLayout);
- if (widget)
- addChildWidget(widget);
+
+#ifdef Q_OS_WINCE_WM
+ if (widget && widget->size().height() > 0)
+#else
+ if (widget)
+#endif
+ addChildWidget(widget);
d->menubar = widget;
}
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index ed9654b..86894b4 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -753,6 +753,7 @@ bool QShortcutMap::correctGraphicsWidgetContext(Qt::ShortcutContext context, QGr
tw = tw->parentWidget();
return tw == w;
}
+ return false;
}
// Below is Qt::WindowShortcut context
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index fb9c8cb..d911b48 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -4805,7 +4805,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
Q_ASSERT(engine);
QPaintEnginePrivate *enginePriv = engine->d_func();
Q_ASSERT(enginePriv);
- QPaintDevice *target = painter->worldMatrixEnabled() ? engine->paintDevice() : painter->device();
+ QPaintDevice *target = engine->paintDevice();
Q_ASSERT(target);
// Render via a pixmap when dealing with non-opaque painters or printers.
@@ -11432,3 +11432,17 @@ void QWidget::clearMask()
setMask(QRegion());
}
+/*! \fn const QX11Info &QWidget::x11Info() const
+ Returns information about the configuration of the X display used to display
+ the widget.
+
+ \warning This function is only available on X11.
+*/
+
+/*! \fn Qt::HANDLE QWidget::x11PictureHandle() const
+ Returns the X11 Picture handle of the widget for XRender
+ support. Use of this function is not portable. This function will
+ return 0 if XRender support is not compiled into Qt, if the
+ XRender extension is not supported on the X11 display, or if the
+ handle could not be created.
+*/
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index b315eaf..f863428 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -786,16 +786,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
// By also setting the current modal window back into the event, we
// help Carbon determining which window is supposed to be raised.
handled_event = qApp->activePopupWidget() ? true : false;
- QWidget *top = 0;
- if (!QApplicationPrivate::tryModalHelper(widget, &top) && top && top != widget){
- if(!qt_mac_is_macsheet(top) || top->parentWidget() != widget) {
- handled_event = true;
- WindowPtr topWindowRef = qt_mac_window_for(top);
- SetEventParameter(event, kEventParamModalWindow, typeWindowRef, sizeof(topWindowRef), &topWindowRef);
- HIModalClickResult clickResult = kHIModalClickIsModal;
- SetEventParameter(event, kEventParamModalClickResult, typeModalClickResult, sizeof(clickResult), &clickResult);
- }
- }
#endif
} else if(ekind == kEventWindowClose) {
widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
@@ -4045,8 +4035,8 @@ void QWidgetPrivate::applyMaxAndMinSizeOnWindow()
NSSize max = NSMakeSize(SF(extra->maxw), SF(extra->maxh));
NSSize min = NSMakeSize(SF(extra->minw), SF(extra->minh));
#undef SF
- [qt_mac_window_for(q) setMinSize:min];
- [qt_mac_window_for(q) setMaxSize:max];
+ [qt_mac_window_for(q) setContentMinSize:min];
+ [qt_mac_window_for(q) setContentMaxSize:max];
#endif
}
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 76734d4..6202b35 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -2747,12 +2747,6 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal opacity)
32, PropModeReplace, (uchar*)&value, 1);
}
-/*!
- Returns information about the configuration of the X display used to display
- the widget.
-
- \warning This function is only available on X11.
-*/
const QX11Info &QWidget::x11Info() const
{
Q_D(const QWidget);
@@ -2789,13 +2783,6 @@ QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys()
return new QX11WindowSurface(q_func());
}
-/*!
- Returns the X11 Picture handle of the widget for XRender
- support. Use of this function is not portable. This function will
- return 0 if XRender support is not compiled into Qt, if the
- XRender extension is not supported on the X11 display, or if the
- handle could not be created.
-*/
Qt::HANDLE QWidget::x11PictureHandle() const
{
#ifndef QT_NO_XRENDER
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 8fb7a12..0a3a8dd 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -492,7 +492,8 @@ static inline void sendUpdateRequest(QWidget *widget, bool updateImmediately)
return;
#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
- if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately) {
+ if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately
+ && !widget->testAttribute(Qt::WA_DontShowOnScreen)) {
// Tell Windows to send us a paint event if we're in WM_SIZE/WM_MOVE; posted events
// are blocked until the mouse button is released. See task 146849.
const QRegion rgn(qt_dirtyRegion(widget));
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 5d7d4ab..1723a19 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -1369,7 +1369,7 @@ QColor QColor::toRgb() const
*/
QColor QColor::toHsv() const
{
- if (!isValid())
+ if (!isValid() || cspec == Hsv)
return *this;
if (cspec != Rgb)
@@ -1421,7 +1421,7 @@ QColor QColor::toHsv() const
*/
QColor QColor::toCmyk() const
{
- if (!isValid())
+ if (!isValid() || cspec == Cmyk)
return *this;
if (cspec != Rgb)
return toRgb().toCmyk();
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index c11837a..9f2831d 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -2400,8 +2400,7 @@ static inline int color_burn_op(int dst, int src, int da, int sa)
if (src == 0 || src_da + dst_sa <= sa_da)
return qt_div_255(temp);
- else
- return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp);
+ return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp);
}
template <typename T>
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 3397c45..175f1ab 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -123,14 +123,30 @@ void QEmulationPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
real_engine->stroke(path, bgPen);
}
-
QBrush brush = pen.brush();
+ QPen copy = pen;
Qt::BrushStyle style = qbrush_style(brush);
if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
const QGradient *g = brush.gradient();
+
if (g->coordinateMode() > QGradient::LogicalMode) {
- QPaintEngineEx::stroke(path, pen);
- return;
+ if (g->coordinateMode() == QGradient::StretchToDeviceMode) {
+ QTransform mat = brush.transform();
+ mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height());
+ brush.setTransform(mat);
+ copy.setBrush(brush);
+ real_engine->stroke(path, copy);
+ return;
+ } else if (g->coordinateMode() == QGradient::ObjectBoundingMode) {
+ QTransform mat = brush.transform();
+ QRealRect r = path.controlPointRect();
+ mat.translate(r.x1, r.y1);
+ mat.scale(r.x2 - r.x1, r.y2 - r.y1);
+ brush.setTransform(mat);
+ copy.setBrush(brush);
+ real_engine->stroke(path, copy);
+ return;
+ }
}
}
diff --git a/src/gui/painting/qpaintdevice_qws.cpp b/src/gui/painting/qpaintdevice_qws.cpp
index 6a68d28..c67be86 100644
--- a/src/gui/painting/qpaintdevice_qws.cpp
+++ b/src/gui/painting/qpaintdevice_qws.cpp
@@ -81,9 +81,6 @@ int QPaintDevice::metric(PaintDeviceMetric m) const
}
}
-/*!
- \internal
-*/
QWSDisplay *QPaintDevice::qwsDisplay()
{
return qt_fbdpy;
diff --git a/src/gui/painting/qpaintdevice_win.cpp b/src/gui/painting/qpaintdevice_win.cpp
index 6cae744..7cd3392 100644
--- a/src/gui/painting/qpaintdevice_win.cpp
+++ b/src/gui/painting/qpaintdevice_win.cpp
@@ -71,16 +71,11 @@ int QPaintDevice::metric(PaintDeviceMetric) const
return 0;
}
-
-/*! \internal
-*/
HDC QPaintDevice::getDC() const
{
return 0;
}
-/*! \internal
-*/
void QPaintDevice::releaseDC(HDC) const
{
}
diff --git a/src/gui/painting/qpaintdevice_x11.cpp b/src/gui/painting/qpaintdevice_x11.cpp
index 4ea9f57..95cb115 100644
--- a/src/gui/painting/qpaintdevice_x11.cpp
+++ b/src/gui/painting/qpaintdevice_x11.cpp
@@ -106,33 +106,11 @@ int QPaintDevice::metric(PaintDeviceMetric) const
#ifdef QT3_SUPPORT
-/*!
- Use QX11Info::display() instead.
-
- \oldcode
- Display *display = widget->x11Display();
- \newcode
- Display *display = QX11Info::display();
- \endcode
-
- \sa QWidget::x11Info(), QX11Info::display()
-*/
Display *QPaintDevice::x11Display() const
{
return X11->display;
}
-/*!
- Use QX11Info::screen() instead.
-
- \oldcode
- int screen = widget->x11Screen();
- \newcode
- int screen = widget->x11Info().screen();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
int QPaintDevice::x11Screen() const
{
const QX11Info *info = qt_x11Info(this);
@@ -141,17 +119,6 @@ int QPaintDevice::x11Screen() const
return QX11Info::appScreen();
}
-/*!
- Use QX11Info::visual() instead.
-
- \oldcode
- void *visual = widget->x11Visual();
- \newcode
- void *visual = widget->x11Info().visual();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
void *QPaintDevice::x11Visual() const
{
const QX11Info *info = qt_x11Info(this);
@@ -160,17 +127,6 @@ void *QPaintDevice::x11Visual() const
return QX11Info::appVisual();
}
-/*!
- Use QX11Info::depth() instead.
-
- \oldcode
- int depth = widget->x11Depth();
- \newcode
- int depth = widget->x11Info().depth();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
int QPaintDevice::x11Depth() const
{
const QX11Info *info = qt_x11Info(this);
@@ -179,17 +135,6 @@ int QPaintDevice::x11Depth() const
return QX11Info::appDepth();
}
-/*!
- Use QX11Info::cells() instead.
-
- \oldcode
- int cells = widget->x11Cells();
- \newcode
- int cells = widget->x11Info().cells();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
int QPaintDevice::x11Cells() const
{
const QX11Info *info = qt_x11Info(this);
@@ -198,17 +143,6 @@ int QPaintDevice::x11Cells() const
return QX11Info::appCells();
}
-/*!
- Use QX11Info::colormap() instead.
-
- \oldcode
- unsigned long screen = widget->x11Colormap();
- \newcode
- unsigned long screen = widget->x11Info().colormap();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
Qt::HANDLE QPaintDevice::x11Colormap() const
{
const QX11Info *info = qt_x11Info(this);
@@ -217,17 +151,6 @@ Qt::HANDLE QPaintDevice::x11Colormap() const
return QX11Info::appColormap();
}
-/*!
- Use QX11Info::defaultColormap() instead.
-
- \oldcode
- bool isDefault = widget->x11DefaultColormap();
- \newcode
- bool isDefault = widget->x11Info().defaultColormap();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
bool QPaintDevice::x11DefaultColormap() const
{
const QX11Info *info = qt_x11Info(this);
@@ -236,17 +159,6 @@ bool QPaintDevice::x11DefaultColormap() const
return QX11Info::appDefaultColormap();
}
-/*!
- Use QX11Info::defaultVisual() instead.
-
- \oldcode
- bool isDefault = widget->x11DefaultVisual();
- \newcode
- bool isDefault = widget->x11Info().defaultVisual();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
bool QPaintDevice::x11DefaultVisual() const
{
const QX11Info *info = qt_x11Info(this);
@@ -255,176 +167,48 @@ bool QPaintDevice::x11DefaultVisual() const
return QX11Info::appDefaultVisual();
}
-/*!
- Use QX11Info::visual() instead.
-
- \oldcode
- void *visual = QPaintDevice::x11AppVisual(screen);
- \newcode
- void *visual = qApp->x11Info(screen).visual();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
void *QPaintDevice::x11AppVisual(int screen)
{ return QX11Info::appVisual(screen); }
-/*!
- Use QX11Info::colormap() instead.
-
- \oldcode
- unsigned long colormap = QPaintDevice::x11AppColormap(screen);
- \newcode
- unsigned long colormap = qApp->x11Info(screen).colormap();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
Qt::HANDLE QPaintDevice::x11AppColormap(int screen)
{ return QX11Info::appColormap(screen); }
-/*!
- Use QX11Info::display() instead.
-
- \oldcode
- Display *display = QPaintDevice::x11AppDisplay();
- \newcode
- Display *display = qApp->x11Info().display();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
Display *QPaintDevice::x11AppDisplay()
{ return QX11Info::display(); }
-/*!
- Use QX11Info::screen() instead.
-
- \oldcode
- int screen = QPaintDevice::x11AppScreen();
- \newcode
- int screen = qApp->x11Info().screen();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
int QPaintDevice::x11AppScreen()
{ return QX11Info::appScreen(); }
-/*!
- Use QX11Info::depth() instead.
-
- \oldcode
- int depth = QPaintDevice::x11AppDepth(screen);
- \newcode
- int depth = qApp->x11Info(screen).depth();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
int QPaintDevice::x11AppDepth(int screen)
{ return QX11Info::appDepth(screen); }
-/*!
- Use QX11Info::cells() instead.
-
- \oldcode
- int cells = QPaintDevice::x11AppCells(screen);
- \newcode
- int cells = qApp->x11Info(screen).cells();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
int QPaintDevice::x11AppCells(int screen)
{ return QX11Info::appCells(screen); }
-/*!
- Use QX11Info::appRootWindow() instead.
-
- \oldcode
- unsigned long window = QPaintDevice::x11AppRootWindow(screen);
- \newcode
- unsigned long window = qApp->x11Info(screen).appRootWindow();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen)
{ return QX11Info::appRootWindow(screen); }
-/*!
- Use QX11Info::defaultColormap() instead.
-
- \oldcode
- bool isDefault = QPaintDevice::x11AppDefaultColormap(screen);
- \newcode
- bool isDefault = qApp->x11Info(screen).defaultColormap();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
bool QPaintDevice::x11AppDefaultColormap(int screen)
{ return QX11Info::appDefaultColormap(screen); }
-/*!
- Use QX11Info::defaultVisual() instead.
-
- \oldcode
- bool isDefault = QPaintDevice::x11AppDefaultVisual(screen);
- \newcode
- bool isDefault = qApp->x11Info(screen).defaultVisual();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
bool QPaintDevice::x11AppDefaultVisual(int screen)
{ return QX11Info::appDefaultVisual(screen); }
-/*!
- Use QX11Info::setAppDpiX() instead.
-*/
void QPaintDevice::x11SetAppDpiX(int dpi, int screen)
{
QX11Info::setAppDpiX(dpi, screen);
}
-/*!
- Use QX11Info::setAppDpiY() instead.
-*/
void QPaintDevice::x11SetAppDpiY(int dpi, int screen)
{
QX11Info::setAppDpiY(dpi, screen);
}
-
-/*!
- Use QX11Info::appDpiX() instead.
-
- \oldcode
- bool isDefault = QPaintDevice::x11AppDpiX(screen);
- \newcode
- bool isDefault = qApp->x11Info(screen).appDpiX();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
int QPaintDevice::x11AppDpiX(int screen)
{
return QX11Info::appDpiX(screen);
}
-/*!
- Use QX11Info::appDpiY() instead.
-
- \oldcode
- bool isDefault = QPaintDevice::x11AppDpiY(screen);
- \newcode
- bool isDefault = qApp->x11Info(screen).appDpiY();
- \endcode
-
- \sa QWidget::x11Info(), QPixmap::x11Info()
-*/
int QPaintDevice::x11AppDpiY(int screen)
{
return QX11Info::appDpiY(screen);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index cbfd5e3..847904b 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2575,9 +2575,10 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
if (!aa && sr.size() == QSize(1, 1)) {
// as fillRect will apply the aliased coordinate delta we need to
// subtract it here as we don't use it for image drawing
- const QRectF targetRect = r.translated(-aliasedCoordinateDelta,
- -aliasedCoordinateDelta);
- fillRect(targetRect, QColor::fromRgba(img.pixel(sr.x(), sr.y())));
+ QTransform old = s->matrix;
+ s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta);
+ fillRect(r, QColor::fromRgba(img.pixel(sr.x(), sr.y())));
+ s->matrix = old;
return;
}
@@ -2611,6 +2612,18 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
return;
d->image_filler_xform.setupMatrix(copy, s->flags.bilinear);
+ if (!aa && s->matrix.type() == QTransform::TxScale) {
+ QRectF rr = s->matrix.mapRect(r);
+
+ const int x1 = qRound(rr.x());
+ const int y1 = qRound(rr.y());
+ const int x2 = qRound(rr.right());
+ const int y2 = qRound(rr.bottom());
+
+ fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d);
+ return;
+ }
+
#ifdef QT_FAST_SPANS
ensureState();
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index afc4211..cc48d24 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -7159,14 +7159,14 @@ QPoint QPainter::xFormDev(const QPoint &p) const
\fn QRect QPainter::xFormDev(const QRect &rectangle) const
\overload
- Use combineMatrix() combined with QMatrix::inverted() instead.
+ Use mapRect() combined with QMatrix::inverted() instead.
\oldcode
QPainter painter(this);
QRect transformed = painter.xFormDev(rectangle);
\newcode
QPainter painter(this);
- QRect transformed = rectangle * painter.combinedMatrix().inverted();
+ QRect transformed = painter.combinedMatrix().inverted(rectangle);
\endcode
*/
@@ -8571,4 +8571,252 @@ void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivat
p->draw_helper(path, operation);
}
+/*! \fn Display *QPaintDevice::x11Display() const
+ Use QX11Info::display() instead.
+
+ \oldcode
+ Display *display = widget->x11Display();
+ \newcode
+ Display *display = QX11Info::display();
+ \endcode
+
+ \sa QWidget::x11Info(), QX11Info::display()
+*/
+
+/*! \fn int QPaintDevice::x11Screen() const
+ Use QX11Info::screen() instead.
+
+ \oldcode
+ int screen = widget->x11Screen();
+ \newcode
+ int screen = widget->x11Info().screen();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn void *QPaintDevice::x11Visual() const
+ Use QX11Info::visual() instead.
+
+ \oldcode
+ void *visual = widget->x11Visual();
+ \newcode
+ void *visual = widget->x11Info().visual();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn int QPaintDevice::x11Depth() const
+ Use QX11Info::depth() instead.
+
+ \oldcode
+ int depth = widget->x11Depth();
+ \newcode
+ int depth = widget->x11Info().depth();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn int QPaintDevice::x11Cells() const
+ Use QX11Info::cells() instead.
+
+ \oldcode
+ int cells = widget->x11Cells();
+ \newcode
+ int cells = widget->x11Info().cells();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn Qt::HANDLE QPaintDevice::x11Colormap() const
+ Use QX11Info::colormap() instead.
+
+ \oldcode
+ unsigned long screen = widget->x11Colormap();
+ \newcode
+ unsigned long screen = widget->x11Info().colormap();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn bool QPaintDevice::x11DefaultColormap() const
+ Use QX11Info::defaultColormap() instead.
+
+ \oldcode
+ bool isDefault = widget->x11DefaultColormap();
+ \newcode
+ bool isDefault = widget->x11Info().defaultColormap();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn bool QPaintDevice::x11DefaultVisual() const
+ Use QX11Info::defaultVisual() instead.
+
+ \oldcode
+ bool isDefault = widget->x11DefaultVisual();
+ \newcode
+ bool isDefault = widget->x11Info().defaultVisual();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn void *QPaintDevice::x11AppVisual(int screen)
+ Use QX11Info::visual() instead.
+
+ \oldcode
+ void *visual = QPaintDevice::x11AppVisual(screen);
+ \newcode
+ void *visual = qApp->x11Info(screen).visual();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn Qt::HANDLE QPaintDevice::x11AppColormap(int screen)
+ Use QX11Info::colormap() instead.
+
+ \oldcode
+ unsigned long colormap = QPaintDevice::x11AppColormap(screen);
+ \newcode
+ unsigned long colormap = qApp->x11Info(screen).colormap();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn Display *QPaintDevice::x11AppDisplay()
+ Use QX11Info::display() instead.
+
+ \oldcode
+ Display *display = QPaintDevice::x11AppDisplay();
+ \newcode
+ Display *display = qApp->x11Info().display();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn int QPaintDevice::x11AppScreen()
+ Use QX11Info::screen() instead.
+
+ \oldcode
+ int screen = QPaintDevice::x11AppScreen();
+ \newcode
+ int screen = qApp->x11Info().screen();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn int QPaintDevice::x11AppDepth(int screen)
+ Use QX11Info::depth() instead.
+
+ \oldcode
+ int depth = QPaintDevice::x11AppDepth(screen);
+ \newcode
+ int depth = qApp->x11Info(screen).depth();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn int QPaintDevice::x11AppCells(int screen)
+ Use QX11Info::cells() instead.
+
+ \oldcode
+ int cells = QPaintDevice::x11AppCells(screen);
+ \newcode
+ int cells = qApp->x11Info(screen).cells();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen)
+ Use QX11Info::appRootWindow() instead.
+
+ \oldcode
+ unsigned long window = QPaintDevice::x11AppRootWindow(screen);
+ \newcode
+ unsigned long window = qApp->x11Info(screen).appRootWindow();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn bool QPaintDevice::x11AppDefaultColormap(int screen)
+ Use QX11Info::defaultColormap() instead.
+
+ \oldcode
+ bool isDefault = QPaintDevice::x11AppDefaultColormap(screen);
+ \newcode
+ bool isDefault = qApp->x11Info(screen).defaultColormap();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn bool QPaintDevice::x11AppDefaultVisual(int screen)
+ Use QX11Info::defaultVisual() instead.
+
+ \oldcode
+ bool isDefault = QPaintDevice::x11AppDefaultVisual(screen);
+ \newcode
+ bool isDefault = qApp->x11Info(screen).defaultVisual();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn void QPaintDevice::x11SetAppDpiX(int dpi, int screen)
+ Use QX11Info::setAppDpiX() instead.
+*/
+
+/*! \fn void QPaintDevice::x11SetAppDpiY(int dpi, int screen)
+ Use QX11Info::setAppDpiY() instead.
+*/
+
+/*! \fn int QPaintDevice::x11AppDpiX(int screen)
+ Use QX11Info::appDpiX() instead.
+
+ \oldcode
+ bool isDefault = QPaintDevice::x11AppDpiX(screen);
+ \newcode
+ bool isDefault = qApp->x11Info(screen).appDpiX();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn int QPaintDevice::x11AppDpiY(int screen)
+ Use QX11Info::appDpiY() instead.
+
+ \oldcode
+ bool isDefault = QPaintDevice::x11AppDpiY(screen);
+ \newcode
+ bool isDefault = qApp->x11Info(screen).appDpiY();
+ \endcode
+
+ \sa QWidget::x11Info(), QPixmap::x11Info()
+*/
+
+/*! \fn HDC QPaintDevice::getDC() const
+ \internal
+*/
+
+/*! \fn void QPaintDevice::releaseDC(HDC) const
+ \internal
+*/
+
+/*! \fn QWSDisplay *QPaintDevice::qwsDisplay()
+ \internal
+*/
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp
index 4f3e71c..5090b3a 100644
--- a/src/gui/painting/qprinter.cpp
+++ b/src/gui/painting/qprinter.cpp
@@ -284,8 +284,8 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke
to send PostScript or PDF output to the printer. As an alternative,
the printProgram() function can be used to specify the command or utility
to use instead of the system default.
-
- Note that setting parameters like paper size and resolution on an
+
+ Note that setting parameters like paper size and resolution on an
invalid printer is undefined. You can use QPrinter::isValid() to
verify this before changing any parameters.
@@ -744,7 +744,7 @@ void QPrinter::setOutputFormat(OutputFormat format)
#ifndef QT_NO_PDF
Q_D(QPrinter);
- if (d->outputFormat == format)
+ if (d->validPrinter && d->outputFormat == format)
return;
d->outputFormat = format;
@@ -773,8 +773,8 @@ void QPrinter::setOutputFormat(OutputFormat format)
if (def_engine)
delete oldPrintEngine;
- d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat;
-
+ if (d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat)
+ d->validPrinter = true;
#else
Q_UNUSED(format);
#endif
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 1ea40ba..3fd1ffb 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -88,11 +88,12 @@ void QTextureGlyphCache::populate(const QTextItemInt &ti,
ti.ascent.toReal(),
ti.descent.toReal());
#endif
- int glyph_width = metrics.width.ceil().toInt() + margin * 2;
- int glyph_height = metrics.height.ceil().toInt() + margin * 2;
+ int glyph_width = metrics.width.ceil().toInt();
+ int glyph_height = metrics.height.ceil().toInt();
if (glyph_height == 0 || glyph_width == 0)
continue;
-
+ glyph_width += margin * 2 + 2;
+ glyph_height += margin * 2 + 2;
// align to 8-bit boundary
if (m_type == QFontEngineGlyphCache::Raster_Mono)
glyph_width = (glyph_width+7)&~7;
@@ -188,11 +189,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height)
int QImageTextureGlyphCache::glyphMargin() const
{
-#ifdef Q_WS_MAC
return 2;
-#else
- return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0;
-#endif
}
void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g)
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index 7a74fe0..110ba2f 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -142,8 +142,7 @@ void QRasterWindowSurface::beginPaint(const QRegion &rgn)
p.fillRect(*it, blank);
}
}
-#endif
-#if defined(Q_OS_WINCE)
+#else
Q_UNUSED(rgn);
#endif
}
@@ -250,6 +249,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
// d->image->image.save("flush.png");
+ Q_UNUSED(offset);
// Get a context for the widget.
#ifndef QT_MAC_USE_COCOA
CGContextRef context;
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index c973b41..7a870fe 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -549,7 +549,6 @@ extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp
QMacCGStyle globals
*****************************************************************************/
const int qt_mac_hitheme_version = 0; //the HITheme version we speak
-const int macSpinBoxSep = 5; // distance between spinwidget and the lineedit
const int macItemFrame = 2; // menu item frame width
const int macItemHMargin = 3; // menu item hor text margin
const int macItemVMargin = 2; // menu item ver text margin
@@ -2376,7 +2375,14 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
break;
case PM_SpinBoxFrameWidth:
GetThemeMetric(kThemeMetricEditTextFrameOutset, &ret);
- ret += 2;
+ switch (d->aquaSizeConstrain(opt, widget)) {
+ default:
+ ret += 2;
+ break;
+ case QAquaSizeMini:
+ ret += 1;
+ break;
+ }
break;
case PM_ButtonShiftHorizontal:
case PM_ButtonShiftVertical:
@@ -5017,11 +5023,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
bdi.kind = kThemeIncDecButton;
break;
case QAquaSizeMini:
+ bdi.kind = kThemeIncDecButtonMini;
+ break;
case QAquaSizeSmall:
- if (aquaSize == QAquaSizeMini)
- bdi.kind = kThemeIncDecButtonMini;
- else
- bdi.kind = kThemeIncDecButtonSmall;
+ bdi.kind = kThemeIncDecButtonSmall;
break;
}
if (!(sb->stepEnabled & (QAbstractSpinBox::StepUpEnabled
@@ -5041,8 +5046,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
bdi.value = kThemeButtonOff;
bdi.adornment = kThemeAdornmentNone;
- QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp,
- widget);
+ QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
+
updown |= subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
HIRect newRect = qt_hirectForQRect(updown);
QRect off_rct;
@@ -5053,15 +5058,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
int(outRect.size.width - newRect.size.width),
int(outRect.size.height - newRect.size.height));
- // HIThemeGetButtonBackgroundBounds offsets non-focused normal sized
- // buttons by one in de y direction, account for that here.
- if (bdi.adornment == kThemeAdornmentNone && bdi.kind == kThemeIncDecButton)
- off_rct.adjust(0, 1, 0, 0);
-
- // Adjust the rect for small buttos also.
- if (bdi.adornment == kThemeAdornmentFocus && bdi.kind == kThemeIncDecButtonSmall)
- off_rct.adjust(0, 0, 0, -1);
-
newRect = qt_hirectForQRect(updown, off_rct);
HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
}
@@ -5726,39 +5722,61 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
break;
case CC_SpinBox:
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
- const int spinner_w = 14,
- fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
+ QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget);
+ int spinner_w;
+ int spinBoxSep;
+ int fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
+ switch (aquaSize) {
+ default:
+ case QAquaSizeUnknown:
+ case QAquaSizeLarge:
+ spinner_w = 14;
+ spinBoxSep = 2;
+ break;
+ case QAquaSizeSmall:
+ spinner_w = 12;
+ spinBoxSep = 2;
+ break;
+ case QAquaSizeMini:
+ spinner_w = 10;
+ spinBoxSep = 1;
+ break;
+ }
+
switch (sc) {
case SC_SpinBoxUp:
case SC_SpinBoxDown: {
if (spin->buttonSymbols == QAbstractSpinBox::NoButtons)
break;
- const int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
- const int spinner_w = 18;
- const int y = frameWidth;
- const int x = spin->rect.width() - spinner_w + frameWidth;
+
+ const int y = fw;
+ const int x = spin->rect.width() - spinner_w;
ret.setRect(x + spin->rect.x(), y + spin->rect.y(), spinner_w, spin->rect.height() - y * 2);
HIThemeButtonDrawInfo bdi;
bdi.version = qt_mac_hitheme_version;
bdi.kind = kThemeIncDecButton;
- QAquaWidgetSize aquaSize = d->aquaSizeConstrain(opt, widget);
+ int hackTranslateX;
switch (aquaSize) {
- case QAquaSizeUnknown:
- case QAquaSizeLarge:
- bdi.kind = kThemeIncDecButton;
- break;
- case QAquaSizeMini:
- case QAquaSizeSmall:
- if (aquaSize == QAquaSizeMini)
- bdi.kind = kThemeIncDecButtonMini;
- else
- bdi.kind = kThemeIncDecButtonSmall;
- break;
+ default:
+ case QAquaSizeUnknown:
+ case QAquaSizeLarge:
+ bdi.kind = kThemeIncDecButton;
+ hackTranslateX = 0;
+ break;
+ case QAquaSizeSmall:
+ bdi.kind = kThemeIncDecButtonSmall;
+ hackTranslateX = -2;
+ break;
+ case QAquaSizeMini:
+ bdi.kind = kThemeIncDecButtonMini;
+ hackTranslateX = -1;
+ break;
}
bdi.state = kThemeStateActive;
bdi.value = kThemeButtonOff;
bdi.adornment = kThemeAdornmentNone;
HIRect hirect = qt_hirectForQRect(ret);
+
HIRect outRect;
HIThemeGetButtonBackgroundBounds(&hirect, &bdi, &outRect);
ret = qt_qrectForHIRect(outRect);
@@ -5773,13 +5791,13 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
Q_ASSERT(0);
break;
}
- ret.translate(-1, -2); // hack: position the buttons correctly (weird that we need this)
+ ret.translate(hackTranslateX, 0); // hack: position the buttons correctly (weird that we need this)
ret = visualRect(spin->direction, spin->rect, ret);
break;
}
case SC_SpinBoxEditField:
ret.setRect(fw, fw,
- spin->rect.width() - spinner_w - fw * 2 - macSpinBoxSep + 1,
+ spin->rect.width() - spinner_w - fw * 2 - spinBoxSep,
spin->rect.height() - fw * 2);
ret = visualRect(spin->direction, spin->rect, ret);
break;
@@ -5811,8 +5829,8 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
switch (ct) {
case QStyle::CT_SpinBox:
- sz.setWidth(sz.width() + macSpinBoxSep);
- sz.setHeight(sz.height() - 3); // hack to work around horrible sizeHint() code in QAbstractSpinBox
+ // hack to work around horrible sizeHint() code in QAbstractSpinBox
+ sz.setHeight(sz.height() - 3);
break;
case QStyle::CT_TabBarTab:
if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) {
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 058660e..714b8c5 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -4926,7 +4926,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
case CT_LineEdit:
#ifndef QT_NO_SPINBOX
// ### hopelessly broken QAbstractSpinBox (part 2)
- if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w->parentWidget())) {
+ if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0)) {
QRenderRule rule = renderRule(spinBox, opt);
if (rule.hasBox() || !rule.hasNativeBorder())
return csz;
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index db1e781..8214e54 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -278,19 +278,15 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
{ "xx-large", Value_XXLarge }
};
+//Map id to strings as they appears in the 'values' array above
+static const int indexOfId[NumKnownValues] = { 0, 40, 47, 41, 48, 53, 34, 26, 68, 69, 25, 42, 5, 62, 46,
+ 29, 57, 58, 27, 50, 60, 6, 10, 38, 55, 19, 13, 17, 18, 20, 21, 49, 24, 45, 65, 36, 3, 2, 39, 61, 16,
+ 11, 56, 14, 32, 63, 54, 64, 33, 67, 8, 28, 37, 12, 35, 59, 7, 9, 4, 66, 52, 22, 23, 30, 31, 1, 15, 0,
+ 51, 44, 43 };
+
QString Value::toString() const
{
- static int indexOfId[NumKnownValues - 1];
- static bool hasCachedIndexes = false;
-
if (type == KnownIdentifier) {
- if (!hasCachedIndexes) {
- for (int i = 0; i < NumKnownValues - 1; ++i)
- indexOfId[values[i].id] = i;
-
- hasCachedIndexes = true;
- }
-
return QLatin1String(values[indexOfId[variant.toInt()]].name);
} else {
return variant.toString();
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 24ff10b..f73ffb5 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -913,7 +913,7 @@ void QFont::setPointSize(int pointSize)
void QFont::setPointSizeF(qreal pointSize)
{
if (pointSize <= 0) {
- qWarning("QFont::setPointSizeF: Point size <= 0 (%d), must be greater than 0", pointSize);
+ qWarning("QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0", pointSize);
return;
}
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index de03a3c..6f5ee1f 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -613,7 +613,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd)
subpixelType = Subpixel_None;
lcdFilterType = 0;
#if defined(FT_LCD_FILTER_H)
- lcdFilterType = (int) FT_LCD_FILTER_DEFAULT;
+ lcdFilterType = (int)((quintptr) FT_LCD_FILTER_DEFAULT);
#endif
defaultFormat = Format_None;
canUploadGlyphsToServer = false;
@@ -1521,6 +1521,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
return false;
}
+#if !defined(QT_NO_FONTCONFIG)
+ extern QMutex *qt_fontdatabase_mutex();
+ QMutex *mtx = 0;
+#endif
+
bool mirrored = flags & QTextEngine::RightToLeft;
int glyph_pos = 0;
if (freetype->symbol_map) {
@@ -1533,6 +1538,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
if ( !glyphs->glyphs[glyph_pos] ) {
glyph_t glyph;
#if !defined(QT_NO_FONTCONFIG)
+ if (!mtx) {
+ mtx = qt_fontdatabase_mutex();
+ mtx->lock();
+ }
+
if (FcCharSetHasChar(freetype->charset, uc)) {
#else
if (false) {
@@ -1561,20 +1571,26 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
if (mirrored)
uc = QChar::mirroredChar(uc);
glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
- if (!glyphs->glyphs[glyph_pos]
+ if (!glyphs->glyphs[glyph_pos]) {
#if !defined(QT_NO_FONTCONFIG)
- && FcCharSetHasChar(freetype->charset, uc)
+ if (!mtx) {
+ mtx = qt_fontdatabase_mutex();
+ mtx->lock();
+ }
+
+ if (FcCharSetHasChar(freetype->charset, uc))
#endif
- ) {
- redo:
- glyph_t glyph = FT_Get_Char_Index(face, uc);
- if (!glyph && (uc == 0xa0 || uc == 0x9)) {
- uc = 0x20;
- goto redo;
+ {
+ redo:
+ glyph_t glyph = FT_Get_Char_Index(face, uc);
+ if (!glyph && (uc == 0xa0 || uc == 0x9)) {
+ uc = 0x20;
+ goto redo;
+ }
+ glyphs->glyphs[glyph_pos] = glyph;
+ if (uc < QFreetypeFace::cmapCacheSize)
+ freetype->cmapCache[uc] = glyph;
}
- glyphs->glyphs[glyph_pos] = glyph;
- if (uc < QFreetypeFace::cmapCacheSize)
- freetype->cmapCache[uc] = glyph;
}
++glyph_pos;
}
@@ -1583,6 +1599,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
*nglyphs = glyph_pos;
glyphs->numGlyphs = glyph_pos;
+#if !defined(QT_NO_FONTCONFIG)
+ if (mtx)
+ mtx->unlock();
+#endif
+
if (flags & QTextEngine::GlyphIndicesOnly)
return true;
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index 1996d44..bf3a176 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -1406,8 +1406,8 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin
#endif
#endif
- QNativeImage *ni = new QNativeImage(iw + 2 * margin,
- ih + 2 * margin,
+ QNativeImage *ni = new QNativeImage(iw + 2 * margin + 2,
+ ih + 2 * margin + 2,
QNativeImage::systemFormat(), true);
ni->image.fill(0xffffffff);
@@ -1449,7 +1449,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
font = CreateFontIndirectW(&lf);
}
- QNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform);
+ QNativeImage *mask = drawGDIGlyph(font, glyph, 2, xform);
if (mask == 0)
return QImage();
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index ba1c04f..48708c9 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -525,7 +525,12 @@ void QTextTablePrivate::update() const
Rows and columns within a QTextTable can be merged and split using
the mergeCells() and splitCell() functions. However, only cells that span multiple
rows or columns can be split. (Merging or splitting does not increase or decrease
- the number of rows and columns.)
+ the number of rows and columns.)
+
+ Note that if you have merged multiple columns and rows into one cell, you will not
+ be able to split the merged cell into new cells spanning over more than one row
+ or column. To be able to split cells spanning over several rows and columns you
+ need to do this over several iterations.
\table 80%
\row
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index a622385..faa4e7b 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -824,7 +824,7 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted)
Q_Q(QCompleter);
QString completion;
- if (!index.isValid() || (index.row() >= proxy->engine->matchCount())) {
+ if (!index.isValid() || (!proxy->showAll && (index.row() >= proxy->engine->matchCount()))) {
completion = prefix;
} else {
QModelIndex si = proxy->mapToSource(index);
diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp
index ea58d46..42a4e0b 100644
--- a/src/gui/widgets/qmenu_wince.cpp
+++ b/src/gui/widgets/qmenu_wince.cpp
@@ -58,6 +58,9 @@
#include <QtCore/qlibrary.h>
#include <commctrl.h>
+#if Q_OS_WINCE_WM
+# include <windowsm.h>
+#endif
#include "qguifunctions_wince.h"
@@ -71,6 +74,12 @@
#define SHCMBM_GETSUBMENU (WM_USER + 401)
#endif
+#ifdef Q_OS_WINCE_WM
+# define SHMBOF_NODEFAULT 0x00000001
+# define SHMBOF_NOTIFY 0x00000002
+# define SHCMBM_OVERRIDEKEY (WM_USER + 0x193)
+#endif
+
extern bool qt_wince_is_smartphone();//defined in qguifunctions_wce.cpp
extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wce.cpp
@@ -204,8 +213,15 @@ static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, i
mbi.dwFlags = flags;
mbi.nToolBarId = toolbarID;
- if (ptrCreateMenuBar(&mbi))
+ if (ptrCreateMenuBar(&mbi)) {
+#ifdef Q_OS_WINCE_WM
+ // Tell the menu bar that we want to override hot key behaviour.
+ LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
+ SHMBOF_NODEFAULT | SHMBOF_NOTIFY);
+ SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam);
+#endif
return mbi.hwndMB;
+ }
}
return 0;
}
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 5940fba..ae518df 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -529,10 +529,20 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN
QHttpNetworkReplyPrivate::ReplyState state = reply ? reply->d_func()->state : QHttpNetworkReplyPrivate::AllDoneState;
switch (state) {
case QHttpNetworkReplyPrivate::NothingDoneState:
- case QHttpNetworkReplyPrivate::ReadingStatusState:
- bytes += reply->d_func()->readStatus(socket);
+ case QHttpNetworkReplyPrivate::ReadingStatusState: {
+ qint64 statusBytes = reply->d_func()->readStatus(socket);
+ if (statusBytes == -1) {
+ // error reading the status, close the socket and emit error
+ socket->close();
+ reply->d_func()->errorString = errorDetail(QNetworkReply::ProtocolFailure, socket);
+ emit reply->finishedWithError(QNetworkReply::ProtocolFailure, reply->d_func()->errorString);
+ QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
+ break;
+ }
+ bytes += statusBytes;
channels[i].lastStatus = reply->d_func()->statusCode;
break;
+ }
case QHttpNetworkReplyPrivate::ReadingHeaderState:
bytes += reply->d_func()->readHeader(socket);
if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) {
@@ -633,10 +643,21 @@ void QHttpNetworkConnectionPrivate::handleStatus(QAbstractSocket *socket, QHttpN
switch (statusCode) {
case 401:
case 407:
- handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend);
- if (resend) {
- eraseData(reply);
- sendRequest(socket);
+ if (handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend)) {
+ if (resend) {
+ eraseData(reply);
+ sendRequest(socket);
+ }
+ } else {
+ int i = indexOf(socket);
+ emit channels[i].reply->headerChanged();
+ emit channels[i].reply->readyRead();
+ QNetworkReply::NetworkError errorCode = (statusCode == 407)
+ ? QNetworkReply::ProxyAuthenticationRequiredError
+ : QNetworkReply::AuthenticationRequiredError;
+ reply->d_func()->errorString = errorDetail(errorCode, socket);
+ emit q->error(errorCode, reply->d_func()->errorString);
+ emit channels[i].reply->finished();
}
break;
default:
@@ -739,7 +760,6 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
// authentication is cancelled, send the current contents to the user.
emit channels[i].reply->headerChanged();
emit channels[i].reply->readyRead();
- emit channels[i].reply->finished();
QNetworkReply::NetworkError errorCode =
isProxy
? QNetworkReply::ProxyAuthenticationRequiredError
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index fe3f6af..69e0a4c 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -409,39 +409,62 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket)
if (fragment.endsWith('\r')) {
fragment.truncate(fragment.length()-1);
}
- parseStatus(fragment);
+ bool ok = parseStatus(fragment);
state = ReadingHeaderState;
fragment.clear(); // next fragment
+
+ if (!ok)
+ return -1;
break;
} else {
c = 0;
bytes += socket->read(&c, 1);
fragment.append(c);
}
+
+ // is this a valid reply?
+ if (fragment.length() >= 5 && !fragment.startsWith("HTTP/"))
+ return -1;
+
}
+
return bytes;
}
-void QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status)
+bool QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status)
{
- const QByteArrayMatcher sp(" ");
- int i = sp.indexIn(status);
- const QByteArray version = status.mid(0, i);
- int j = sp.indexIn(status, i + 1);
+ // from RFC 2616:
+ // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
+ // HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
+ // that makes: 'HTTP/n.n xxx Message'
+ // byte count: 0123456789012
+
+ static const int minLength = 11;
+ static const int dotPos = 6;
+ static const int spacePos = 8;
+ static const char httpMagic[] = "HTTP/";
+
+ if (status.length() < minLength
+ || !status.startsWith(httpMagic)
+ || status.at(dotPos) != '.'
+ || status.at(spacePos) != ' ') {
+ // I don't know how to parse this status line
+ return false;
+ }
+
+ // optimize for the valid case: defer checking until the end
+ majorVersion = status.at(dotPos - 1) - '0';
+ minorVersion = status.at(dotPos + 1) - '0';
+
+ int i = spacePos;
+ int j = status.indexOf(' ', i + 1); // j == -1 || at(j) == ' ' so j+1 == 0 && j+1 <= length()
const QByteArray code = status.mid(i + 1, j - i - 1);
- const QByteArray reason = status.mid(j + 1, status.count() - j);
- const QByteArrayMatcher slash("/");
- int k = slash.indexIn(version);
- const QByteArrayMatcher dot(".");
- int l = dot.indexIn(version, k);
- const QByteArray major = version.mid(k + 1, l - k - 1);
- const QByteArray minor = version.mid(l + 1, version.count() - l);
+ bool ok;
+ statusCode = code.toInt(&ok);
+ reasonPhrase = QString::fromLatin1(status.constData() + j + 1);
- majorVersion = QString::fromAscii(major.constData()).toInt();
- minorVersion = QString::fromAscii(minor.constData()).toInt();
- statusCode = QString::fromAscii(code.constData()).toInt();
- reasonPhrase = QString::fromAscii(reason.constData());
+ return ok && uint(majorVersion) <= 9 && uint(minorVersion) <= 9;
}
qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket)
@@ -660,4 +683,4 @@ void QHttpNetworkReply::ignoreSslErrors()
QT_END_NAMESPACE
-#endif // QT_NO_HTTP \ No newline at end of file
+#endif // QT_NO_HTTP
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index c17c65c..cb4d34f 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -154,7 +154,7 @@ public:
QHttpNetworkReplyPrivate(const QUrl &newUrl = QUrl());
~QHttpNetworkReplyPrivate();
qint64 readStatus(QAbstractSocket *socket);
- void parseStatus(const QByteArray &status);
+ bool parseStatus(const QByteArray &status);
qint64 readHeader(QAbstractSocket *socket);
void parseHeader(const QByteArray &header);
qint64 readBody(QAbstractSocket *socket, QIODevice *out);
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index a52b5a0..f214699 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -1036,21 +1036,39 @@ QNetworkCacheMetaData QNetworkAccessHttpBackend::fetchCacheMetaData(const QNetwo
if (it != cacheHeaders.rawHeaders.constEnd())
metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(it->second));
- bool canDiskCache = true; // Everything defaults to being cacheable on disk
-
- // 14.32
- // HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client
- // had sent "Cache-Control: no-cache".
- it = cacheHeaders.findRawHeader("pragma");
- if (it != cacheHeaders.rawHeaders.constEnd()
- && it->second == "no-cache")
- canDiskCache = false;
+ bool canDiskCache;
+ // only cache GET replies by default, all other replies (POST, PUT, DELETE)
+ // are not cacheable by default (according to RFC 2616 section 9)
+ if (httpReply->request().operation() == QHttpNetworkRequest::Get) {
+
+ canDiskCache = true;
+ // 14.32
+ // HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client
+ // had sent "Cache-Control: no-cache".
+ it = cacheHeaders.findRawHeader("pragma");
+ if (it != cacheHeaders.rawHeaders.constEnd()
+ && it->second == "no-cache")
+ canDiskCache = false;
+
+ // HTTP/1.1. Check the Cache-Control header
+ if (cacheControl.contains("no-cache"))
+ canDiskCache = false;
+ else if (cacheControl.contains("no-store"))
+ canDiskCache = false;
+
+ // responses to POST might be cacheable
+ } else if (httpReply->request().operation() == QHttpNetworkRequest::Post) {
- // HTTP/1.1. Check the Cache-Control header
- if (cacheControl.contains("no-cache"))
canDiskCache = false;
- else if (cacheControl.contains("no-store"))
+ // some pages contain "expires:" and "cache-control: no-cache" field,
+ // so we only might cache POST requests if we get "cache-control: max-age ..."
+ if (cacheControl.contains("max-age"))
+ canDiskCache = true;
+
+ // responses to PUT and DELETE are not cacheable
+ } else {
canDiskCache = false;
+ }
metaData.setSaveToDisk(canDiskCache);
int statusCode = httpReply->statusCode();
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 82c9344..67df526 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -913,6 +913,17 @@ static QDateTime parseDateString(const QByteArray &dateString)
*/
QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieString)
{
+ // cookieString can be a number of set-cookie header strings joined together
+ // by \n, parse each line separately.
+ QList<QNetworkCookie> cookies;
+ QList<QByteArray> list = cookieString.split('\n');
+ for (int a = 0; a < list.size(); a++)
+ cookies += QNetworkCookiePrivate::parseSetCookieHeaderLine(list.at(a));
+ return cookies;
+}
+
+QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByteArray &cookieString)
+{
// According to http://wp.netscape.com/newsref/std/cookie_spec.html,<
// the Set-Cookie response header is of the format:
//
@@ -930,12 +941,6 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
while (position < length) {
QNetworkCookie cookie;
- // When there are multiple SetCookie headers they are join with a new line
- // \n will always be the start of a new cookie
- int endOfSetCookie = cookieString.indexOf('\n', position);
- if (endOfSetCookie == -1)
- endOfSetCookie = length;
-
// The first part is always the "NAME=VALUE" part
QPair<QByteArray,QByteArray> field = nextField(cookieString, position);
if (field.first.isEmpty() || field.second.isNull())
@@ -946,7 +951,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
position = nextNonWhitespace(cookieString, position);
bool endOfCookie = false;
- while (!endOfCookie && position < endOfSetCookie)
+ while (!endOfCookie && position < length) {
switch (cookieString.at(position++)) {
case ',':
// end of the cookie
@@ -969,9 +974,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
position = end;
QDateTime dt = parseDateString(dateString.toLower());
if (!dt.isValid()) {
- cookie = QNetworkCookie();
- endOfCookie = true;
- continue;
+ return result;
}
cookie.setExpirationDate(dt);
} else if (field.first == "domain") {
@@ -988,8 +991,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
bool ok = false;
int secs = field.second.toInt(&ok);
if (!ok)
- // invalid cookie string
- return QList<QNetworkCookie>();
+ return result;
cookie.setExpirationDate(now.addSecs(secs));
} else if (field.first == "path") {
QString path = QUrl::fromPercentEncoding(field.second);
@@ -1003,9 +1005,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
} else if (field.first == "version") {
if (field.second != "1") {
// oops, we don't know how to handle this cookie
- cookie = QNetworkCookie();
- endOfCookie = true;
- continue;
+ return result;
}
} else {
// got an unknown field in the cookie
@@ -1013,9 +1013,8 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
}
position = nextNonWhitespace(cookieString, position);
- if (position > endOfSetCookie)
- endOfCookie = true;
}
+ }
if (!cookie.name().isEmpty())
result += cookie;
diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h
index 83ef14a..0c41322 100644
--- a/src/network/access/qnetworkcookie_p.h
+++ b/src/network/access/qnetworkcookie_p.h
@@ -61,6 +61,7 @@ class QNetworkCookiePrivate: public QSharedData
{
public:
inline QNetworkCookiePrivate() : secure(false), httpOnly(false) { }
+ static QList<QNetworkCookie> parseSetCookieHeaderLine(const QByteArray &cookieString);
QDateTime expirationDate;
QString domain;
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index c9161f8..33795aa 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -73,6 +73,15 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
authentication information to the socket when accessing services that
require authentication.
+ QAuthenticator supports the following authentication methods:
+ \list
+ \o Basic
+ \o NTLM version 1
+ \o Digest-MD5
+ \endlist
+
+ Note that, in particular, NTLM version 2 is not supported.
+
\sa QSslSocket
*/
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index f4ece97..62bdfc7 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -86,10 +86,11 @@
The SOCKS5 support in Qt 4 is based on \l{RFC 1928} and \l{RFC 1929}.
The supported authentication methods are no authentication and
username/password authentication. Both IPv4 and IPv6 are
- supported, but domain name resolution via the SOCKS server is not
- supported; i.e. all domain names are resolved locally. There are
- several things to remember when using SOCKS5 with QUdpSocket and
- QTcpServer:
+ supported. Domain names are resolved through the SOCKS5 server if
+ the QNetworkProxy::HostNameLookupCapability is enabled, otherwise
+ they are resolved locally and the IP address is sent to the
+ server. There are several things to remember when using SOCKS5
+ with QUdpSocket and QTcpServer:
With QUdpSocket, a call to \l {QUdpSocket::bind()}{bind()} may fail
with a timeout error. If a port number other than 0 is passed to
@@ -365,7 +366,8 @@ static QNetworkProxy::Capabilities defaultCapabilitiesForType(QNetworkProxy::Pro
int(QNetworkProxy::HostNameLookupCapability)),
};
- Q_ASSERT(int(type) >= 0 && int(type) <= int(QNetworkProxy::FtpCachingProxy));
+ if (int(type) < 0 && int(type) > int(QNetworkProxy::FtpCachingProxy))
+ type = QNetworkProxy::DefaultProxy;
return QNetworkProxy::Capabilities(defaults[int(type)]);
}
@@ -378,6 +380,7 @@ public:
QNetworkProxy::Capabilities capabilities;
quint16 port;
QNetworkProxy::ProxyType type;
+ bool capabilitiesSet;
inline QNetworkProxyPrivate(QNetworkProxy::ProxyType t = QNetworkProxy::DefaultProxy,
const QString &h = QString(), quint16 p = 0,
@@ -387,7 +390,8 @@ public:
password(pw),
capabilities(defaultCapabilitiesForType(t)),
port(p),
- type(t)
+ type(t),
+ capabilitiesSet(false)
{ }
inline bool operator==(const QNetworkProxyPrivate &other) const
@@ -490,13 +494,16 @@ QNetworkProxy &QNetworkProxy::operator=(const QNetworkProxy &other)
Sets the proxy type for this instance to be \a type.
Note that changing the type of a proxy does not change
- the set of capabilities this QNetworkProxy object holds.
+ the set of capabilities this QNetworkProxy object holds if any
+ capabilities have been set with setCapabilities().
\sa type(), setCapabilities()
*/
void QNetworkProxy::setType(QNetworkProxy::ProxyType type)
{
d->type = type;
+ if (!d->capabilitiesSet)
+ d->capabilities = defaultCapabilitiesForType(type);
}
/*!
@@ -519,6 +526,7 @@ QNetworkProxy::ProxyType QNetworkProxy::type() const
void QNetworkProxy::setCapabilities(Capabilities capabilities)
{
d->capabilities = capabilities;
+ d->capabilitiesSet = true;
}
/*!
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index e09e764..42c09f5 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -364,11 +364,14 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
// DT_RPATH tags on our library header as well as other system-specific search
// paths. See the man page for dlopen(3) on your system for more information.
+#ifdef Q_OS_OPENBSD
+ libcrypto->setLoadHints(QLibrary::ExportExternalSymbolsHint);
+#endif
#ifdef SHLIB_VERSION_NUMBER
// first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER>
libssl->setFileNameAndVersion(QLatin1String("ssl"), QLatin1String(SHLIB_VERSION_NUMBER));
libcrypto->setFileNameAndVersion(QLatin1String("crypto"), QLatin1String(SHLIB_VERSION_NUMBER));
- if (libssl->load() && libcrypto->load()) {
+ if (libcrypto->load() && libssl->load()) {
// libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found
return pair;
} else {
@@ -380,7 +383,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
// second attempt: find the development files libssl.so and libcrypto.so
libssl->setFileNameAndVersion(QLatin1String("ssl"), -1);
libcrypto->setFileNameAndVersion(QLatin1String("crypto"), -1);
- if (libssl->load() && libcrypto->load()) {
+ if (libcrypto->load() && libssl->load()) {
// libssl.so.0 and libcrypto.so.0 found
return pair;
} else {
@@ -395,7 +398,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
crypto.replace(QLatin1String("ssl"), QLatin1String("crypto"));
libssl->setFileNameAndVersion(ssl, -1);
libcrypto->setFileNameAndVersion(crypto, -1);
- if (libssl->load() && libcrypto->load()) {
+ if (libcrypto->load() && libssl->load()) {
// libssl.so.0 and libcrypto.so.0 found
return pair;
} else {
diff --git a/src/opengl/qglpixelbuffer_mac.mm b/src/opengl/qglpixelbuffer_mac.mm
index 9a679b1..e95e36b 100644
--- a/src/opengl/qglpixelbuffer_mac.mm
+++ b/src/opengl/qglpixelbuffer_mac.mm
@@ -299,9 +299,8 @@ void QGLPixelBuffer::releaseFromDynamicTexture()
GLuint QGLPixelBuffer::generateDynamicTexture() const
{
- Q_D(const QGLPixelBuffer);
-
#ifdef QT_MAC_USE_COCOA
+ Q_D(const QGLPixelBuffer);
NSOpenGLContext *oldContext = [NSOpenGLContext currentContext];
if (d->share_ctx != oldContext)
[static_cast<NSOpenGLContext *>(d->share_ctx) makeCurrentContext];
diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h
index d4552e3..d1fd0da 100644
--- a/src/plugins/accessible/widgets/simplewidgets.h
+++ b/src/plugins/accessible/widgets/simplewidgets.h
@@ -115,6 +115,7 @@ public:
class QAccessibleLineEdit : public QAccessibleWidgetEx, public QAccessibleTextInterface,
public QAccessibleSimpleEditableTextInterface
{
+ Q_ACCESSIBLE_OBJECT
public:
explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString());
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 6d8f617..989a37a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -80,7 +80,7 @@ template <typename T> inline const T *ptr(const T &t) { return &t; }
template <> inline const bool* ptr<bool>(const bool &) { return 0; }
template <typename device, typename T1, typename T2, typename T3>
static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
- QDirectFBPaintEnginePrivate::Scale scale, bool matrixRotShear, bool simplePen,
+ int scale, bool matrixRotShear, bool simplePen,
bool dfbHandledClip, bool forceRasterPrimitives,
const char *nameOne, const T1 &one,
const char *nameTwo, const T2 &two,
@@ -211,6 +211,8 @@ static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB
class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate
{
public:
+ enum Scale { NoScale, Scaled, NegativeScale };
+
QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p);
~QDirectFBPaintEnginePrivate();
@@ -266,14 +268,13 @@ private:
bool simplePen;
bool matrixRotShear;
- enum Scale { NoScale, Scaled, NegativeScale } scale;
+ Scale scale;
SurfaceCache *surfaceCache;
QTransform transform;
int lastLockedHeight;
IDirectFB *fb;
- DFBSurfaceDescription fbDescription;
int fbWidth;
int fbHeight;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 7297a99..c9b676a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -271,7 +271,7 @@ void QDirectFBPixmapData::fill(const QColor &color)
forceRaster = false;
setSerialNumber(++global_ser_no);
if (!dfbSurface) {
- qWarning("QDirecttFBPixmapData::fill()");
+ qWarning("QDirectFBPixmapData::fill()");
invalidate();
return;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 25e24fd..98e32ed 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -205,6 +205,7 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size,
SurfaceCreationOptions options)
{
DFBSurfaceDescription desc;
+ memset(&desc, 0, sizeof(DFBSurfaceDescription));
desc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH|DSDESC_HEIGHT);
if (!QDirectFBScreen::initSurfaceDescriptionPixelFormat(&desc, format))
return 0;
@@ -213,7 +214,6 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size,
return createDFBSurface(desc, options);
}
-
IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options)
{
DFBResult result = DFB_OK;
@@ -247,6 +247,7 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc,
}
desc.caps = DFBSurfaceCapabilities(desc.caps & ~DSCAPS_VIDEOONLY);
}
+
if (d_ptr->directFBFlags & SystemOnly)
desc.caps = DFBSurfaceCapabilities(desc.caps | DSCAPS_SYSTEMONLY);
@@ -293,14 +294,14 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img,
IDirectFBSurface *dfbSurface = createDFBSurface(image.size(), pixmapFormat, options);
if (!dfbSurface) {
- qWarning("QDirectFBPixmapData::fromImage() Couldn't create surface");
+ qWarning("QDirectFBScreen::copyToDFBSurface() Couldn't create surface");
return 0;
}
#ifndef QT_NO_DIRECTFB_PREALLOCATED
IDirectFBSurface *imgSurface = createDFBSurface(image, DontTrackSurface);
if (!imgSurface) {
- qWarning("QDirectFBPixmapData::fromImage()");
+ qWarning("QDirectFBScreen::copyToDFBSurface()");
QDirectFBScreen::releaseDFBSurface(dfbSurface);
return 0;
}
@@ -315,7 +316,7 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img,
dfbSurface->SetBlittingFlags(dfbSurface, flags);
DFBResult result = dfbSurface->Blit(dfbSurface, imgSurface, 0, 0, 0);
if (result != DFB_OK)
- DirectFBError("QDirectFBPixmapData::fromImage()", result);
+ DirectFBError("QDirectFBScreen::copyToDFBSurface()", result);
dfbSurface->ReleaseSource(dfbSurface);
imgSurface->Release(imgSurface);
#else // QT_NO_DIRECTFB_PREALLOCATED
@@ -445,6 +446,7 @@ QImage::Format QDirectFBScreen::getImageFormat(IDirectFBSurface *surface)
DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const QImage &image)
{
DFBSurfaceDescription description;
+ memset(&description, 0, sizeof(DFBSurfaceDescription));
const DFBSurfacePixelFormat format = getSurfacePixelFormat(image.format());
@@ -479,6 +481,7 @@ DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer,
int length)
{
DFBSurfaceDescription description;
+ memset(&description, 0, sizeof(DFBSurfaceDescription));
description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS
| DSDESC_WIDTH
@@ -818,7 +821,7 @@ static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags
-static void printDirectFBInfo(IDirectFB *fb)
+static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
{
DFBResult result;
DFBGraphicsDeviceDescription dev;
@@ -829,10 +832,14 @@ static void printDirectFBInfo(IDirectFB *fb)
return;
}
- qDebug("Device: %s (%s), Driver: %s v%i.%i (%s)\n"
+ DFBSurfacePixelFormat pixelFormat;
+ primarySurface->GetPixelFormat(primarySurface, &pixelFormat);
+
+ qDebug("Device: %s (%s), Driver: %s v%i.%i (%s) Pixelformat: %d (%d)\n"
"acceleration: 0x%x%s\nblit: 0x%x%s\ndraw: 0x%0x%s\nvideo: %iKB\n",
dev.name, dev.vendor, dev.driver.name, dev.driver.major,
- dev.driver.minor, dev.driver.vendor, dev.acceleration_mask,
+ dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat),
+ QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask,
::flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(),
dev.blitting_flags, ::flagDescriptions(dev.blitting_flags, blitDescriptions).constData(),
dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
@@ -883,9 +890,6 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
return false;
}
- if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive))
- printDirectFBInfo(d_ptr->dfb);
-
if (displayArgs.contains(QLatin1String("videoonly"), Qt::CaseInsensitive))
d_ptr->directFBFlags |= VideoOnly;
@@ -916,6 +920,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN);
DFBSurfaceDescription description;
+ memset(&description, 0, sizeof(DFBSurfaceDescription));
+
description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS);
if (::setIntOption(displayArgs, QLatin1String("width"), &description.width))
description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_WIDTH);
@@ -952,6 +958,9 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
return false;
}
+ if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive))
+ printDirectFBInfo(d_ptr->dfb, d_ptr->dfbSurface);
+
// Work out what format we're going to use for surfaces with an alpha channel
d_ptr->alphaPixmapFormat = QDirectFBScreen::getImageFormat(d_ptr->dfbSurface);
setPixelFormat(d_ptr->alphaPixmapFormat);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index f1e3c84..cd8796b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -178,15 +178,7 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect, const QRegion &mask)
"Unable to get DirectFB handle!");
}
- DFBSurfaceDescription description;
- description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH |
- DSDESC_HEIGHT |
- DSDESC_PIXELFORMAT);
- description.width = rect.width();
- description.height = rect.height();
- QDirectFBScreen::initSurfaceDescriptionPixelFormat(&description,
- screen->pixelFormat());
- dfbSurface = screen->createDFBSurface(description, false);
+ dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface);
forceRaster = (dfbSurface && QDirectFBScreen::getImageFormat(dfbSurface) == QImage::Format_RGB32);
} else {
Q_ASSERT(dfbSurface);
@@ -340,7 +332,7 @@ inline bool isWidgetOpaque(const QWidget *w)
return false;
}
void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion &region,
- const QPoint &offset)
+ const QPoint &offset)
{
Q_UNUSED(widget);
#ifdef QT_NO_DIRECTFB_WM
diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
index c7249d3..3273513 100644
--- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
+++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
@@ -122,16 +122,10 @@ QSize QSvgIconEngine::actualSize(const QSize &size, QIcon::Mode mode,
return size;
}
- QSvgRenderer renderer;
- d->loadDataForModeAndState(&renderer, mode, state);
- if (renderer.isValid()) {
- QSize defaultSize = renderer.defaultSize();
- if (!defaultSize.isNull())
- defaultSize.scale(size, Qt::KeepAspectRatio);
- return defaultSize;
- } else {
+ QPixmap pm = pixmap(size, mode, state);
+ if (pm.isNull())
return QSize();
- }
+ return pm.size();
}
void QSvgIconEnginePrivate::loadDataForModeAndState(QSvgRenderer *renderer, QIcon::Mode mode, QIcon::State state)
diff --git a/src/script/qscriptvalueiterator.cpp b/src/script/qscriptvalueiterator.cpp
index fe5ef9f..1a60632 100644
--- a/src/script/qscriptvalueiterator.cpp
+++ b/src/script/qscriptvalueiterator.cpp
@@ -106,6 +106,7 @@ QScriptValueIteratorPrivate::QScriptValueIteratorPrivate()
*/
QScriptValueIteratorPrivate::~QScriptValueIteratorPrivate()
{
+ delete it;
}
/*!
@@ -130,7 +131,6 @@ QScriptValueIterator::QScriptValueIterator(const QScriptValue &object)
QScriptValueIterator::~QScriptValueIterator()
{
if (d_ptr) {
- delete d_ptr->it;
delete d_ptr;
d_ptr = 0;
}
@@ -312,7 +312,7 @@ void QScriptValueIterator::remove()
QScriptValueIterator& QScriptValueIterator::operator=(QScriptValue &object)
{
if (d_ptr) {
- delete d_ptr->it;
+ delete d_ptr;
d_ptr = 0;
}
QScriptValueImpl val = QScriptValuePrivate::valueOf(object);
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index 9eeb41d..4f3d79d 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -66,8 +66,11 @@ QT_BEGIN_NAMESPACE
enum { QIBaseChunkSize = SHRT_MAX / 2 };
-static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode,
- QTextCodec *tc)
+#if defined(FB_API_VER) && FB_API_VER >= 20
+static bool getIBaseError(QString& msg, const ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc)
+#else
+static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc)
+#endif
{
if (status[0] != 1 || status[1] <= 0)
return false;
@@ -75,7 +78,11 @@ static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode,
msg.clear();
sqlcode = isc_sqlcode(status);
char buf[512];
+#if defined(FB_API_VER) && FB_API_VER >= 20
+ while(fb_interpret(buf, 512, &status)) {
+#else
while(isc_interprete(buf, &status)) {
+#endif
if(!msg.isEmpty())
msg += QLatin1String(" - ");
if (tc)
@@ -871,7 +878,7 @@ QIBaseResult::~QIBaseResult()
bool QIBaseResult::prepare(const QString& query)
{
- //qDebug("prepare: %s\n", qPrintable(query));
+// qDebug("prepare: %s", qPrintable(query));
if (!driver() || !driver()->isOpen() || driver()->isOpenError())
return false;
d->cleanup();
@@ -1025,7 +1032,7 @@ bool QIBaseResult::exec()
}
if (ok) {
- if (colCount()) {
+ if (colCount() && d->queryType != isc_info_sql_stmt_exec_procedure) {
isc_dsql_free_statement(d->status, &d->stmt, DSQL_close);
if (d->isError(QT_TRANSLATE_NOOP("QIBaseResult", "Unable to close statement")))
return false;
@@ -1039,7 +1046,7 @@ bool QIBaseResult::exec()
return false;
// Not all stored procedures necessarily return values.
- if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda->sqld == 0)
+ if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda && d->sqlda->sqld == 0)
delDA(d->sqlda);
if (d->sqlda)
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 1f54db7..fbefa0c 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -163,18 +163,21 @@ static inline QVariant qDateTimeFromString(QString &val)
#endif
}
-class QMYSQLResultPrivate
+class QMYSQLResultPrivate : public QObject
{
+ Q_OBJECT
public:
- QMYSQLResultPrivate(QMYSQLDriverPrivate* dp) : d(dp), result(0),
+ QMYSQLResultPrivate(const QMYSQLDriver* dp) : driver(dp), result(0),
rowsAffected(0), hasBlobs(false)
#if MYSQL_VERSION_ID >= 40108
, stmt(0), meta(0), inBinds(0), outBinds(0)
#endif
, precisionPolicy(QSql::HighPrecision)
- {}
+ {
+ connect(dp, SIGNAL(destroyed()), this, SLOT(driverDestroyed()));
+ }
- QMYSQLDriverPrivate* d;
+ const QMYSQLDriver* driver;
MYSQL_RES *result;
MYSQL_ROW row;
@@ -207,6 +210,8 @@ public:
MYSQL_BIND *outBinds;
#endif
QSql::NumericalPrecisionPolicy precisionPolicy;
+private Q_SLOTS:
+ void driverDestroyed() { driver = NULL; }
};
#ifndef QT_NO_TEXTCODEC
@@ -379,7 +384,7 @@ bool QMYSQLResultPrivate::bindInValues()
QMYSQLResult::QMYSQLResult(const QMYSQLDriver* db)
: QSqlResult(db)
{
- d = new QMYSQLResultPrivate(db->d);
+ d = new QMYSQLResultPrivate(db);
}
QMYSQLResult::~QMYSQLResult()
@@ -391,7 +396,7 @@ QMYSQLResult::~QMYSQLResult()
QVariant QMYSQLResult::handle() const
{
#if MYSQL_VERSION_ID >= 40108
- if(d->d->preparedQuerys)
+ if(d->driver && d->driver->d->preparedQuerys)
return d->meta ? qVariantFromValue(d->meta) : qVariantFromValue(d->stmt);
else
#endif
@@ -406,8 +411,8 @@ void QMYSQLResult::cleanup()
// must iterate trough leftover result sets from multi-selects or stored procedures
// if this isn't done subsequent queries will fail with "Commands out of sync"
#if MYSQL_VERSION_ID >= 40100
- while (d->d->mysql && mysql_next_result(d->d->mysql) == 0) {
- MYSQL_RES *res = mysql_store_result(d->d->mysql);
+ while (d->driver && d->driver->d->mysql && mysql_next_result(d->driver->d->mysql) == 0) {
+ MYSQL_RES *res = mysql_store_result(d->driver->d->mysql);
if (res)
mysql_free_result(res);
}
@@ -447,11 +452,14 @@ void QMYSQLResult::cleanup()
setAt(-1);
setActive(false);
- d->d->preparedQuerys = d->d->preparedQuerysEnabled;
+ if(d->driver)
+ d->driver->d->preparedQuerys = d->driver->d->preparedQuerysEnabled;
}
bool QMYSQLResult::fetch(int i)
{
+ if(!d->driver)
+ return false;
if (isForwardOnly()) { // fake a forward seek
if (at() < i) {
int x = i - at();
@@ -463,7 +471,7 @@ bool QMYSQLResult::fetch(int i)
}
if (at() == i)
return true;
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
#if MYSQL_VERSION_ID >= 40108
mysql_stmt_data_seek(d->stmt, i);
@@ -494,7 +502,9 @@ bool QMYSQLResult::fetch(int i)
bool QMYSQLResult::fetchNext()
{
- if (d->d->preparedQuerys) {
+ if(!d->driver)
+ return false;
+ if (d->driver->d->preparedQuerys) {
#if MYSQL_VERSION_ID >= 40108
if (mysql_stmt_fetch(d->stmt))
return false;
@@ -512,6 +522,8 @@ bool QMYSQLResult::fetchNext()
bool QMYSQLResult::fetchLast()
{
+ if(!d->driver)
+ return false;
if (isForwardOnly()) { // fake this since MySQL can't seek on forward only queries
bool success = fetchNext(); // did we move at all?
while (fetchNext()) {};
@@ -519,7 +531,7 @@ bool QMYSQLResult::fetchLast()
}
my_ulonglong numRows;
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
#if MYSQL_VERSION_ID >= 40108
numRows = mysql_stmt_num_rows(d->stmt);
#else
@@ -553,15 +565,18 @@ QVariant QMYSQLResult::data(int field)
return QVariant();
}
+ if (!d->driver)
+ return QVariant();
+
int fieldLength = 0;
const QMYSQLResultPrivate::QMyField &f = d->fields.at(field);
QString val;
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
if (f.nullIndicator)
return QVariant(f.type);
if (f.type != QVariant::ByteArray)
- val = toUnicode(d->d->tc, f.outField, f.bufLength);
+ val = toUnicode(d->driver->d->tc, f.outField, f.bufLength);
} else {
if (d->row[field] == NULL) {
// NULL value
@@ -569,7 +584,7 @@ QVariant QMYSQLResult::data(int field)
}
fieldLength = mysql_fetch_lengths(d->result)[field];
if (f.type != QVariant::ByteArray)
- val = toUnicode(d->d->tc, d->row[field], fieldLength);
+ val = toUnicode(d->driver->d->tc, d->row[field], fieldLength);
}
switch(f.type) {
@@ -614,7 +629,7 @@ QVariant QMYSQLResult::data(int field)
case QVariant::ByteArray: {
QByteArray ba;
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
ba = QByteArray(f.outField, f.bufLength);
} else {
ba = QByteArray(d->row[field], fieldLength);
@@ -631,7 +646,7 @@ QVariant QMYSQLResult::data(int field)
bool QMYSQLResult::isNull(int field)
{
- if (d->d->preparedQuerys)
+ if (d->driver->d->preparedQuerys)
return d->fields.at(field).nullIndicator;
else
return d->row[field] == NULL;
@@ -639,31 +654,31 @@ bool QMYSQLResult::isNull(int field)
bool QMYSQLResult::reset (const QString& query)
{
- if (!driver() || !driver()->isOpen() || driver()->isOpenError())
+ if (!driver() || !driver()->isOpen() || driver()->isOpenError() || !d->driver)
return false;
- if(d->d->preparedQuerysEnabled && prepare(query)) {
- d->d->preparedQuerys = true;
+ if(d->driver->d->preparedQuerysEnabled && prepare(query)) {
+ d->driver->d->preparedQuerys = true;
return exec();
}
- d->d->preparedQuerys = false;
+ d->driver->d->preparedQuerys = false;
- const QByteArray encQuery(fromUnicode(d->d->tc, query));
- if (mysql_real_query(d->d->mysql, encQuery.data(), encQuery.length())) {
+ const QByteArray encQuery(fromUnicode(d->driver->d->tc, query));
+ if (mysql_real_query(d->driver->d->mysql, encQuery.data(), encQuery.length())) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to execute query"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
}
- d->result = mysql_store_result(d->d->mysql);
- if (!d->result && mysql_field_count(d->d->mysql) > 0) {
+ d->result = mysql_store_result(d->driver->d->mysql);
+ if (!d->result && mysql_field_count(d->driver->d->mysql) > 0) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to store result"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
}
- int numFields = mysql_field_count(d->d->mysql);
+ int numFields = mysql_field_count(d->driver->d->mysql);
setSelect(numFields != 0);
d->fields.resize(numFields);
- d->rowsAffected = mysql_affected_rows(d->d->mysql);
+ d->rowsAffected = mysql_affected_rows(d->driver->d->mysql);
if (isSelect()) {
for(int i = 0; i < numFields; i++) {
MYSQL_FIELD* field = mysql_fetch_field_direct(d->result, i);
@@ -677,8 +692,8 @@ bool QMYSQLResult::reset (const QString& query)
int QMYSQLResult::size()
{
- if (isSelect())
- if (d->d->preparedQuerys)
+ if (d->driver && isSelect())
+ if (d->driver->d->preparedQuerys)
#if MYSQL_VERSION_ID >= 40108
return mysql_stmt_num_rows(d->stmt);
#else
@@ -697,17 +712,17 @@ int QMYSQLResult::numRowsAffected()
QVariant QMYSQLResult::lastInsertId() const
{
- if (!isActive())
+ if (!isActive() || !d->driver)
return QVariant();
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
#if MYSQL_VERSION_ID >= 40108
quint64 id = mysql_stmt_insert_id(d->stmt);
if (id)
return QVariant(id);
#endif
} else {
- quint64 id = mysql_insert_id(d->d->mysql);
+ quint64 id = mysql_insert_id(d->driver->d->mysql);
if (id)
return QVariant(id);
}
@@ -718,20 +733,20 @@ QSqlRecord QMYSQLResult::record() const
{
QSqlRecord info;
MYSQL_RES *res;
- if (!isActive() || !isSelect())
+ if (!isActive() || !isSelect() || !d->driver)
return info;
#if MYSQL_VERSION_ID >= 40108
- res = d->d->preparedQuerys ? d->meta : d->result;
+ res = d->driver->d->preparedQuerys ? d->meta : d->result;
#else
res = d->result;
#endif
- if (!mysql_errno(d->d->mysql)) {
+ if (!mysql_errno(d->driver->d->mysql)) {
mysql_field_seek(res, 0);
MYSQL_FIELD* field = mysql_fetch_field(res);
while(field) {
- info.append(qToField(field, d->d->tc));
+ info.append(qToField(field, d->driver->d->tc));
field = mysql_fetch_field(res);
}
}
@@ -741,6 +756,8 @@ QSqlRecord QMYSQLResult::record() const
bool QMYSQLResult::nextResult()
{
+ if(!d->driver)
+ return false;
#if MYSQL_VERSION_ID >= 40100
setAt(-1);
setActive(false);
@@ -754,26 +771,26 @@ bool QMYSQLResult::nextResult()
delete[] d->fields[i].outField;
d->fields.clear();
- int status = mysql_next_result(d->d->mysql);
+ int status = mysql_next_result(d->driver->d->mysql);
if (status > 0) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to execute next query"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
} else if (status == -1) {
return false; // No more result sets
}
- d->result = mysql_store_result(d->d->mysql);
- int numFields = mysql_field_count(d->d->mysql);
+ d->result = mysql_store_result(d->driver->d->mysql);
+ int numFields = mysql_field_count(d->driver->d->mysql);
if (!d->result && numFields > 0) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to store next result"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
}
setSelect(numFields > 0);
d->fields.resize(numFields);
- d->rowsAffected = mysql_affected_rows(d->d->mysql);
+ d->rowsAffected = mysql_affected_rows(d->driver->d->mysql);
if (isSelect()) {
for (int i = 0; i < numFields; i++) {
@@ -833,9 +850,11 @@ static MYSQL_TIME *toMySqlDate(QDate date, QTime time, QVariant::Type type)
bool QMYSQLResult::prepare(const QString& query)
{
+ if(!d->driver)
+ return false;
#if MYSQL_VERSION_ID >= 40108
cleanup();
- if (!d->d->preparedQuerys)
+ if (!d->driver->d->preparedQuerys)
return QSqlResult::prepare(query);
int r;
@@ -844,14 +863,14 @@ bool QMYSQLResult::prepare(const QString& query)
return false;
if (!d->stmt)
- d->stmt = mysql_stmt_init(d->d->mysql);
+ d->stmt = mysql_stmt_init(d->driver->d->mysql);
if (!d->stmt) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to prepare statement"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
}
- const QByteArray encQuery(fromUnicode(d->d->tc, query));
+ const QByteArray encQuery(fromUnicode(d->driver->d->tc, query));
r = mysql_stmt_prepare(d->stmt, encQuery.constData(), encQuery.length());
if (r != 0) {
setLastError(qMakeStmtError(QCoreApplication::translate("QMYSQLResult",
@@ -873,7 +892,9 @@ bool QMYSQLResult::prepare(const QString& query)
bool QMYSQLResult::exec()
{
- if (!d->d->preparedQuerys)
+ if (!d->driver)
+ return false;
+ if (!d->driver->d->preparedQuerys)
return QSqlResult::exec();
if (!d->stmt)
return false;
@@ -963,7 +984,7 @@ bool QMYSQLResult::exec()
break;
case QVariant::String:
default: {
- QByteArray ba = fromUnicode(d->d->tc, val.toString());
+ QByteArray ba = fromUnicode(d->driver->d->tc, val.toString());
stringVector.append(ba);
currBind->buffer_type = MYSQL_TYPE_STRING;
currBind->buffer = const_cast<char *>(ba.constData());
@@ -1459,3 +1480,5 @@ bool QMYSQLDriver::isIdentifierEscapedImplementation(const QString &identifier,
}
QT_END_NAMESPACE
+
+#include "qsql_mysql.moc" \ No newline at end of file
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 9932463..ee500a0 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -563,7 +563,6 @@ QChar QODBCDriverPrivate::quoteChar() const
static QChar quote = QChar::fromLatin1('"');
if (!isQuoteInitialized) {
char driverResponse[4];
- SQLUSMALLINT casing;
SQLSMALLINT length;
int r = SQLGetInfo(hDbc,
SQL_IDENTIFIER_QUOTE_CHAR,
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index 6232452..a270c0e 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -378,7 +378,7 @@ void QSqlDatabasePrivate::disable()
the connection name argument, if you don't pass the connection
name argument, the default connection is assumed. The following
snippet shows how to create and open a default connection to a
- MySQL database:
+ PostgreSQL database:
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 0
diff --git a/src/xmlpatterns/expr/qapplytemplate.cpp b/src/xmlpatterns/expr/qapplytemplate.cpp
index 95f4fdf..b91c2f0 100644
--- a/src/xmlpatterns/expr/qapplytemplate.cpp
+++ b/src/xmlpatterns/expr/qapplytemplate.cpp
@@ -160,8 +160,7 @@ Item::Iterator::Ptr ApplyTemplate::evaluateSequence(const DynamicContext::Ptr &c
focus->setFocusIterator(focusIterator);
return makeSequenceMappingIterator<Item>(ConstPtr(this), focusIterator, focus);
}
- else
- return CommonValues::emptyIterator;
+ return CommonValues::emptyIterator;
}
}
diff --git a/src/xmlpatterns/functions/qsequencefns.cpp b/src/xmlpatterns/functions/qsequencefns.cpp
index f6d5391..faa787e 100644
--- a/src/xmlpatterns/functions/qsequencefns.cpp
+++ b/src/xmlpatterns/functions/qsequencefns.cpp
@@ -246,8 +246,7 @@ Item::Iterator::Ptr SubsequenceFN::evaluateSequence(const DynamicContext::Ptr &c
if(length < 1 && length != -1)
return CommonValues::emptyIterator;
- else
- return Item::Iterator::Ptr(new SubsequenceIterator(it, startingLoc, length));
+ return Item::Iterator::Ptr(new SubsequenceIterator(it, startingLoc, length));
}
Item SubsequenceFN::evaluateSingleton(const DynamicContext::Ptr &context) const