summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@nokia.com>2009-12-01 07:42:46 (GMT)
committerMorten Johan Sørvig <morten.sorvig@nokia.com>2009-12-01 07:42:46 (GMT)
commitd8548a8e4696512c5e7796b866ed98a7bd52f673 (patch)
treecd70d093e4ee24ab27b9fecfa8ad77449d1794c9 /src
parent182efb3d2c5182a89d7416f474811309d7939786 (diff)
parent700a069591d29733609e619c224861ca774bfb32 (diff)
downloadQt-d8548a8e4696512c5e7796b866ed98a7bd52f673.zip
Qt-d8548a8e4696512c5e7796b866ed98a7bd52f673.tar.gz
Qt-d8548a8e4696512c5e7796b866ed98a7bd52f673.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp3
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h8
-rw-r--r--src/3rdparty/webkit/ChangeLog10
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog53
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp5
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h2
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog50
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp15
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp4
-rw-r--r--src/3rdparty/webkit/WebKit.pri2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp14
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog63
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro3
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp38
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp15
-rw-r--r--src/corelib/animation/qabstractanimation.cpp9
-rw-r--r--src/corelib/animation/qvariantanimation.cpp19
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_dnotify.cpp3
-rw-r--r--src/corelib/io/qfsfileengine.cpp15
-rw-r--r--src/corelib/io/qfsfileengine_p.h2
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp34
-rw-r--r--src/corelib/io/qiodevice.cpp6
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp2
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp70
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h1
-rw-r--r--src/corelib/kernel/qobject.cpp59
-rw-r--r--src/corelib/kernel/qobject_p.h21
-rw-r--r--src/corelib/thread/qbasicatomic.h7
-rw-r--r--src/corelib/xml/qxmlstream.g1
-rw-r--r--src/corelib/xml/qxmlstream_p.h323
-rw-r--r--src/dbus/qdbusconnection.cpp3
-rw-r--r--src/dbus/qdbusconnection_p.h5
-rw-r--r--src/dbus/qdbusconnectioninterface.cpp11
-rw-r--r--src/dbus/qdbusintegrator.cpp18
-rw-r--r--src/dbus/qdbusservicewatcher.cpp5
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm1
-rw-r--r--src/gui/egl/qegl.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp26
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp215
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h34
-rw-r--r--src/gui/graphicsview/qgraphicsitemanimation.cpp1
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp9
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h6
-rw-r--r--src/gui/graphicsview/qgraphicsview_p.h7
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/gui/image/qiconloader.cpp28
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp28
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks_p.h3
-rw-r--r--src/gui/image/qpixmap_s60.cpp5
-rw-r--r--src/gui/image/qpixmap_s60_p.h2
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp49
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h3
-rw-r--r--src/gui/itemviews/qheaderview.cpp25
-rw-r--r--src/gui/itemviews/qlistview.cpp8
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp6
-rw-r--r--src/gui/itemviews/qtableview.cpp33
-rw-r--r--src/gui/itemviews/qtreeview.cpp7
-rw-r--r--src/gui/itemviews/qtreewidget.cpp2
-rw-r--r--src/gui/kernel/qapplication.cpp3
-rw-r--r--src/gui/kernel/qapplication_mac.mm2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp65
-rw-r--r--src/gui/kernel/qapplication_win.cpp199
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac.mm3
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm7
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm59
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm9
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm10
-rw-r--r--src/gui/kernel/qkeysequence.cpp6
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm8
-rw-r--r--src/gui/kernel/qwidget.cpp35
-rw-r--r--src/gui/kernel/qwidget_mac.mm25
-rw-r--r--src/gui/kernel/qwidget_s60.cpp18
-rw-r--r--src/gui/kernel/qwidget_x11.cpp7
-rw-r--r--src/gui/painting/qbackingstore.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp92
-rw-r--r--src/gui/painting/qprintengine_pdf.cpp2
-rw-r--r--src/gui/styles/qgtkstyle.cpp2
-rw-r--r--src/gui/styles/qmacstyle_mac.mm12
-rw-r--r--src/gui/styles/qs60style.cpp25
-rw-r--r--src/gui/styles/qs60style_p.h11
-rw-r--r--src/gui/styles/qs60style_s60.cpp2
-rw-r--r--src/gui/text/qfontengine_win.cpp107
-rw-r--r--src/gui/text/qfontengine_win_p.h4
-rw-r--r--src/gui/text/qtextcontrol.cpp9
-rw-r--r--src/gui/text/qtextdocument.cpp6
-rw-r--r--src/gui/widgets/qabstractbutton.cpp7
-rw-r--r--src/gui/widgets/qabstractbutton_p.h1
-rw-r--r--src/gui/widgets/qabstractslider.cpp45
-rw-r--r--src/gui/widgets/qabstractslider_p.h33
-rw-r--r--src/gui/widgets/qcommandlinkbutton.cpp3
-rw-r--r--src/gui/widgets/qdialogbuttonbox.cpp24
-rw-r--r--src/gui/widgets/qlinecontrol.cpp23
-rw-r--r--src/gui/widgets/qlineedit.cpp4
-rw-r--r--src/gui/widgets/qmainwindow.cpp1
-rw-r--r--src/gui/widgets/qmdiarea.cpp6
-rw-r--r--src/gui/widgets/qmenu.cpp12
-rw-r--r--src/gui/widgets/qmenu_mac.mm6
-rw-r--r--src/gui/widgets/qmenubar.cpp6
-rw-r--r--src/gui/widgets/qplaintextedit.cpp3
-rw-r--r--src/gui/widgets/qsizegrip.cpp29
-rw-r--r--src/gui/widgets/qspinbox.cpp100
-rw-r--r--src/gui/widgets/qtabbar.cpp4
-rw-r--r--src/gui/widgets/qtabbar_p.h3
-rw-r--r--src/gui/widgets/qtoolbararealayout_p.h2
-rw-r--r--src/network/access/qnetworkcookiejar.cpp7
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp5
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp5
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker.cpp204
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker_p.h158
-rw-r--r--src/openvg/qpaintengine_vg.cpp47
-rw-r--r--src/openvg/qpaintengine_vg_p.h2
-rw-r--r--src/openvg/qpixmapdata_vg.cpp53
-rw-r--r--src/openvg/qpixmapdata_vg_p.h1
-rw-r--r--src/openvg/qvgcompositionhelper_p.h4
-rw-r--r--src/openvg/qwindowsurface_vg.cpp14
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp42
-rw-r--r--src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro6
-rw-r--r--src/qt3support/other/q3process_unix.cpp2
-rw-r--r--src/script/api/qscriptengine.cpp21
-rw-r--r--src/script/api/qscriptengineagent.cpp10
-rw-r--r--src/script/bridge/qscriptqobject.cpp27
-rw-r--r--src/script/script.pro2
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp18
-rw-r--r--src/tools/bootstrap/bootstrap.pro10
-rw-r--r--src/xmlpatterns/api/qxmlschema.cpp5
-rw-r--r--src/xmlpatterns/api/qxmlschemavalidator.cpp5
138 files changed, 1859 insertions, 1278 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
index f3ec8e1..bfb03ab 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
@@ -975,7 +975,7 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
face->glyphs_substituted = false;
face->buffer = 0;
- HB_Error error;
+ HB_Error error = HB_Err_Ok;
HB_Stream stream;
HB_Stream gdefStream;
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri
index 28328e7..a6fb2f8 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri
@@ -39,10 +39,12 @@ win32-* {
contains(JAVASCRIPTCORE_JIT,yes) {
DEFINES+=ENABLE_JIT=1
DEFINES+=ENABLE_YARR_JIT=1
+ DEFINES+=ENABLE_YARR=1
}
contains(JAVASCRIPTCORE_JIT,no) {
DEFINES+=ENABLE_JIT=0
DEFINES+=ENABLE_YARR_JIT=0
+ DEFINES+=ENABLE_YARR=0
}
# In debug mode JIT disabled until crash fixed
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp
index 073b35a..b098728 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp
@@ -561,6 +561,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
asm volatile (
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
SYMBOL_STRING(ctiTrampoline) ":" "\n"
"stmdb sp!, {r1-r3}" "\n"
"stmdb sp!, {r4-r8, lr}" "\n"
@@ -584,6 +585,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
asm volatile (
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"mov r0, sp" "\n"
"mov lr, r6" "\n"
@@ -593,6 +595,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
// Both has the same return sequence
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"add sp, sp, #32" "\n"
"ldmia sp!, {r4-r8, lr}" "\n"
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h
index 43975ff..c2b8c02 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h
@@ -246,6 +246,10 @@ namespace JSC {
MacroAssemblerCodePtr m_ctiNativeCallThunk;
};
+#if COMPILER(GCC)
+#pragma GCC visibility push(hidden)
+#endif
+
extern "C" {
EncodedJSValue JIT_STUB cti_op_add(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_bitand(STUB_ARGS_DECLARATION);
@@ -363,6 +367,10 @@ extern "C" {
void* JIT_STUB cti_vm_lazyLinkCall(STUB_ARGS_DECLARATION);
} // extern "C"
+#if COMPILER(GCC)
+#pragma GCC visibility pop
+#endif
+
} // namespace JSC
#endif // ENABLE(JIT)
diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog
index 26dbaf7..1e89d1e 100644
--- a/src/3rdparty/webkit/ChangeLog
+++ b/src/3rdparty/webkit/ChangeLog
@@ -1,3 +1,13 @@
+2009-11-30 Jan-Arve Sæther <jan-arve.saether@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix compilation with win32-icc
+
+ Include os-win32 for stdint.h since MS does not ship that in their PSDK.
+
+ * WebKit.pri:
+
2009-10-30 Adam Barth <abarth@webkit.org>
Reviewed by Mark Rowe.
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index 304f9ef..d7d2d57 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,56 @@
+2009-11-30 Jan-Arve Sæther <jan-arve.saether@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix compilation with win32-icc
+
+ The Intel compiler does not support the __has_trivial_constructor type
+ trait. The Intel Compiler can report itself as _MSC_VER >= 1400. The
+ reason for that is that the Intel Compiler depends on the Microsoft
+ Platform SDK, and in order to try to be "fully" MS compatible it will
+ "pretend" to be the same MS compiler as was shipped with the MS PSDK.
+ (Thus, compiling with win32-icc with VC8 SDK will make the source code
+ "think" the compiler at hand supports this type trait).
+
+ * wtf/TypeTraits.h:
+
+2009-11-28 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ Apply workaround for the limitation of VirtualFree with MEM_RELEASE to all ports running on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=31943
+
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStackArray::shrinkAllocation):
+
+2009-11-18 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Fix the clobber list of cacheFlush for ARM and Thumb2 on Linux
+ https://bugs.webkit.org/show_bug.cgi?id=31631
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-11-23 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Symbian] Fix lastIndexOf() for Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=31773
+
+ Symbian soft floating point library has problems with operators
+ comparing NaN to numbers. Without a workaround lastIndexOf()
+ function does not work.
+
+ Patch developed by David Leong.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncLastIndexOf):Add an extra test
+ to check for NaN for Symbian.
+
2009-11-18 Harald Fernengel <harald.fernengel@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h
index 5c43eeb..9ca62c8 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h
@@ -203,7 +203,7 @@ public:
"pop {r7}\n"
:
: "r" (code), "r" (reinterpret_cast<char*>(code) + size)
- : "r0", "r1");
+ : "r0", "r1", "r2");
}
#elif PLATFORM(SYMBIAN)
static void cacheFlush(void* code, size_t size)
@@ -224,7 +224,7 @@ public:
"pop {r7}\n"
:
: "r" (code), "r" (reinterpret_cast<char*>(code) + size)
- : "r0", "r1");
+ : "r0", "r1", "r2");
}
#else
#error "The cacheFlush support is missing on this platform."
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h
index ea09f54..a114ae0 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h
@@ -153,7 +153,7 @@ namespace JSC {
ASSERT(0 == (size % MarkStack::pageSize()));
if (size == m_allocated)
return;
-#if PLATFORM(WIN) || PLATFORM(SYMBIAN)
+#if PLATFORM(WIN_OS) || PLATFORM(SYMBIAN)
// We cannot release a part of a region with VirtualFree. To get around this,
// we'll release the entire region and reallocate the size that we want.
releaseStack(m_data, m_allocated);
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp
index a0713b8..a0cc9f1 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp
@@ -469,6 +469,11 @@ JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec, JSObject*, JSV
dpos = 0;
else if (!(dpos <= len)) // true for NaN
dpos = len;
+#if PLATFORM(SYMBIAN)
+ // Work around for broken NaN compare operator
+ else if (isnan(dpos))
+ dpos = len;
+#endif
return jsNumber(exec, s.rfind(u2, static_cast<int>(dpos)));
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h
index 6ce6a3e..9e75e7a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h
@@ -155,7 +155,7 @@ namespace WTF {
typedef IntegralConstant<bool, true> true_type;
typedef IntegralConstant<bool, false> false_type;
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER)
// VC8 (VS2005) and later have built-in compiler support for HasTrivialConstructor / HasTrivialDestructor,
// but for some unexplained reason it doesn't work on built-in types.
template <typename T> struct HasTrivialConstructor : public IntegralConstant<bool, __has_trivial_constructor(T)>{ };
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index f40dda4..62acbdf 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -8,4 +8,4 @@ The commit imported was from the
and has the sha1 checksum
- 7bdf90f753d25fb1b5628b0980827df11110ad5a
+ 9de63cde0ac8aa08e207d4ffce2846df1a44a364
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 6daf411..4f6146f 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,53 @@
+2009-11-23 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Wrong runtime instance objects of wrapped QObjects may be used if
+ the wrapped object died before the gc removed the instance.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31681
+
+ Before using a cached instance, verify that its wrapped QObject is
+ still alive.
+
+ * bridge/qt/qt_instance.cpp:
+ (JSC::Bindings::QtInstance::getQtInstance):
+ * bridge/qt/qt_instance.h:
+ (JSC::Bindings::QtInstance::hashKey):
+
+2009-11-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix crash of QtWebKit on any page with Flash when compiled with MinGW.
+
+ Fix inline assembly, don't dereference the function pointer twice.
+
+ * plugins/win/PluginViewWin.cpp:
+ (WebCore::PluginView::hookedBeginPaint):
+ (WebCore::PluginView::hookedEndPaint):
+
+2009-11-22 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Adam Barth.
+
+ [Qt] Remove the Referer header when redirecting to a non-secure site
+ https://bugs.webkit.org/show_bug.cgi?id=31785
+
+ This makes Qt pass two tests introduced in r50226.
+
+ * platform/network/qt/QNetworkReplyHandler.cpp:
+ (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
+
+2009-11-19 Olivier Goffart <ogoffart@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Normalize signal and slot signatures.
+
+ * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp:
+ (WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
+
2009-11-18 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp
index 0546014..ec362ec 100644
--- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp
@@ -111,10 +111,17 @@ PassRefPtr<QtInstance> QtInstance::getQtInstance(QObject* o, PassRefPtr<RootObje
{
JSLock lock(SilenceAssertionsOnly);
- foreach(QtInstance* instance, cachedInstances.values(o)) {
- if (instance->rootObject() == rootObject)
- return instance;
- }
+ foreach(QtInstance* instance, cachedInstances.values(o))
+ if (instance->rootObject() == rootObject) {
+ // The garbage collector removes instances, but it may happen that the wrapped
+ // QObject dies before the gc kicks in. To handle that case we have to do an additional
+ // check if to see if the instance's wrapped object is still alive. If it isn't, then
+ // we have to create a new wrapper.
+ if (!instance->getObject())
+ cachedInstances.remove(instance->hashKey());
+ else
+ return instance;
+ }
RefPtr<QtInstance> ret = QtInstance::create(o, rootObject, ownership);
cachedInstances.insert(o, ret.get());
diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h
index 00aaa5b..0afc6c7 100644
--- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h
+++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h
@@ -59,6 +59,7 @@ public:
JSValue booleanValue() const;
QObject* getObject() const { return m_object; }
+ QObject* hashKey() const { return m_hashkey; }
static PassRefPtr<QtInstance> getQtInstance(QObject*, PassRefPtr<RootObject>, QScriptEngine::ValueOwnership ownership);
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index 2f4722f..1ac80f6 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -325,6 +325,10 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
newRequest.setHTTPMethod("GET");
}
+ // Should not set Referer after a redirect from a secure resource to non-secure one.
+ if (!newRequest.url().protocolIs("https") && protocolIs(newRequest.httpReferrer(), "https"))
+ newRequest.clearHTTPReferrer();
+
client->willSendRequest(m_resourceHandle, newRequest, response);
m_redirected = true;
m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame);
diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp
index 5ccce0e..b313afb 100644
--- a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp
@@ -145,7 +145,7 @@ HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint)
"push %3\n"
"call *%4\n"
: "=a" (result)
- : "a" (beginPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*beginPaint)
+ : "a" (beginPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (beginPaint)
: "memory"
);
return result;
@@ -175,7 +175,7 @@ BOOL WINAPI PluginView::hookedEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint)
"push %3\n"
"call *%4\n"
: "=a" (result)
- : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*endPaint)
+ : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (endPaint)
);
return result;
#elif defined (_M_IX86)
diff --git a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri
index 10291b4..5188662 100644
--- a/src/3rdparty/webkit/WebKit.pri
+++ b/src/3rdparty/webkit/WebKit.pri
@@ -11,7 +11,7 @@ isEmpty(OUTPUT_DIR) {
DEFINES += BUILDING_QT__=1
building-libs {
- win32-msvc*: INCLUDEPATH += $$PWD/JavaScriptCore/os-win32
+ win32-msvc*|win32-icc: INCLUDEPATH += $$PWD/JavaScriptCore/os-win32
} else {
CONFIG(QTDIR_build) {
QT += webkit
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
index 8922150..441bec7 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
@@ -99,6 +99,14 @@ public:
It is possible to replace the contents of child elements using
setPlainText() and setInnerXml(). To replace the element itself and its
contents, use setOuterXml().
+
+ \section1 Examples
+
+ The \l{DOM Traversal Example} shows one way to traverse documents in a running
+ example.
+
+ The \l{Simple Selector Example} can be used to experiment with the searching
+ features of this class and provides sample code you can start working with.
*/
/*!
@@ -195,8 +203,7 @@ bool QWebElement::isNull() const
\a selectorQuery. If there are no matching elements, an empty list is
returned.
- \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector}
- syntax is used for the query.
+ \l{Standard CSS2 selector} syntax is used for the query.
\note This search is performed recursively.
@@ -211,8 +218,7 @@ QWebElementCollection QWebElement::findAll(const QString &selectorQuery) const
Returns the first child element that matches the given CSS selector
\a selectorQuery.
- \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector}
- syntax is used for the query.
+ \l{Standard CSS2 selector} syntax is used for the query.
\note This search is performed recursively.
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index aedf95a..1bdc3ed 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -864,7 +864,12 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev)
void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button)
{
#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ Frame* frame = page->focusController()->focusedFrame();
+ if (!frame)
+ return;
+
if (client && client->inputMethodEnabled()
+ && frame->document()->focusedNode()
&& button == Qt::LeftButton && qApp->autoSipEnabled()) {
QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
client->ownerWidget()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 457e9c2..2f0bf17 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,66 @@
+2009-11-28 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] SoftwareInputPanelRequest event sent when clicking in newly loaded page
+
+ https://bugs.webkit.org/show_bug.cgi?id=31401
+
+ Don't set the event unless there is a focused node we can use
+ for editing afterwards.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::handleSoftwareInputPanel):
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::inputMethods):
+
+2009-11-23 David Boddie <dboddie@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Updated the QWebElement documentation with links to examples and
+ external resources.
+ Fixed the project file for the webelement snippet and tidied up the
+ markers used for quoting the code.
+
+ * Api/qwebelement.cpp:
+ * docs/webkitsnippets/webelement/main.cpp:
+ (findAll):
+ * docs/webkitsnippets/webelement/webelement.pro:
+
+2009-11-23 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Wrong runtime instance objects of wrapped QObjects may be used if
+ the wrapped object died before the gc removed the instance.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31681
+
+ Added a unit-test to verify that wrapping a QObject with the
+ same identity as a previously but now dead object works.
+
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2009-11-19 Olivier Goffart <ogoffart@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Normalize signal and slot signatures.
+
+ * Api/qgraphicswebview.cpp:
+ (QGraphicsWebView::setPage):
+ * Api/qwebview.cpp:
+ (QWebView::setPage):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::setFrame):
+ * docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp:
+ (wrapInFunction):
+ * tests/qwebframe/tst_qwebframe.cpp:
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::modified):
+ (tst_QWebPage::database):
+
2009-11-18 Paul Olav Tvete <paul.tvete@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp
index d437a6f..2707ffb 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp
@@ -22,7 +22,6 @@
#include <qwebview.h>
#include <qwebframe.h>
#include <qwebelement.h>
-#include <qdebug.h>
static QWebFrame *frame;
@@ -53,9 +52,10 @@ static void findAll()
</p>
*/
+//! [FindAll intro]
QList<QWebElement> allSpans = document.findAll("span");
QList<QWebElement> introSpans = document.findAll("p.intro span");
-//! [FindAll]
+//! [FindAll intro] //! [FindAll]
}
int main(int argc, char *argv[])
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro
index f9b403b..8ca4b59 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro
@@ -1,5 +1,8 @@
TEMPLATE = app
CONFIG -= app_bundle
+CONFIG(QTDIR_build) {
+ QT += webkit
+}
SOURCES = main.cpp
include(../../../../../WebKit.pri)
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index d88d905..8cc7953 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -605,6 +605,7 @@ private slots:
void render();
void scrollPosition();
void evaluateWillCauseRepaint();
+ void qObjectWrapperWithSameIdentity();
private:
QString evalJS(const QString&s) {
@@ -2785,6 +2786,43 @@ void tst_QWebFrame::evaluateWillCauseRepaint()
QTest::qWait(2000);
}
+class TestFactory : public QObject
+{
+ Q_OBJECT
+public:
+ TestFactory()
+ : obj(0), counter(0)
+ {}
+
+ Q_INVOKABLE QObject* getNewObject()
+ {
+ delete obj;
+ obj = new QObject(this);
+ obj->setObjectName(QLatin1String("test") + QString::number(++counter));
+ return obj;
+
+ }
+
+ QObject* obj;
+ int counter;
+};
+
+void tst_QWebFrame::qObjectWrapperWithSameIdentity()
+{
+ m_view->setHtml("<script>function triggerBug() { document.getElementById('span1').innerText = test.getNewObject().objectName; }</script>"
+ "<body><span id='span1'>test</span></body>");
+
+ QWebFrame* mainFrame = m_view->page()->mainFrame();
+ QCOMPARE(mainFrame->toPlainText(), QString("test"));
+
+ mainFrame->addToJavaScriptWindowObject("test", new TestFactory, QScriptEngine::ScriptOwnership);
+
+ mainFrame->evaluateJavaScript("triggerBug();");
+ QCOMPARE(mainFrame->toPlainText(), QString("test1"));
+
+ mainFrame->evaluateJavaScript("triggerBug();");
+ QCOMPARE(mainFrame->toPlainText(), QString("test2"));
+}
QTEST_MAIN(tst_QWebFrame)
#include "tst_qwebframe.moc"
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 32002e7..ee1969d 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -1487,6 +1487,21 @@ void tst_QWebPage::inputMethods()
QVERIFY(!(inputMethodHints(view) & Qt::ImhHiddenText));
#endif
+ page->mainFrame()->setHtml("<html><body><p>nothing to input here");
+ viewEventSpy.clear();
+
+ QWebElement para = page->mainFrame()->findFirstElement("p");
+ {
+ QMouseEvent evpres(QEvent::MouseButtonPress, para.geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
+ page->event(&evpres);
+ QMouseEvent evrel(QEvent::MouseButtonRelease, para.geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
+ page->event(&evrel);
+ }
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
+#endif
+
delete container;
}
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index ef4989b..299585a 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -229,7 +229,10 @@ void QUnifiedTimer::restartAnimationTimer()
void QUnifiedTimer::timerEvent(QTimerEvent *event)
{
- if (event->timerId() == startStopAnimationTimer.timerId()) {
+ //in the case of consistent timing we make sure the orders in which events come is always the same
+ //for that purpose we do as if the startstoptimer would always fire before the animation timer
+ if ((consistentTiming && startStopAnimationTimer.isActive()) ||
+ event->timerId() == startStopAnimationTimer.timerId()) {
startStopAnimationTimer.stop();
//we transfer the waiting animations into the "really running" state
@@ -247,7 +250,9 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event)
time.start();
}
}
- } else if (event->timerId() == animationTimer.timerId()) {
+ }
+
+ if (event->timerId() == animationTimer.timerId()) {
// update current time on all top level animations
updateAnimationsTime();
restartAnimationTimer();
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index c735778..d529f67 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -104,15 +104,32 @@ QT_BEGIN_NAMESPACE
\o \l{QMetaType::}{QLine}
\o \l{QMetaType::}{QLineF}
\o \l{QMetaType::}{QPoint}
+ \o \l{QMetaType::}{QPointF}
\o \l{QMetaType::}{QSize}
\o \l{QMetaType::}{QSizeF}
\o \l{QMetaType::}{QRect}
\o \l{QMetaType::}{QRectF}
+ \o \l{QMetaType::}{QColor}
\endlist
If you need to interpolate other variant types, including custom
types, you have to implement interpolation for these yourself.
- You do this by reimplementing interpolated(), which returns
+ To do this, you can register an interpolator function for a given
+ type. This function takes 3 parameters: the start value, the end value
+ and the current progress.
+
+ Example:
+ \code
+ QVariant myColorInterpolator(const QColor &start, const QColor &end, qreal progress)
+ {
+ ...
+ return QColor(...);
+ }
+ ...
+ qRegisterAnimationInterpolator<QColor>(myColorInterpolator);
+ \endcode
+
+ Another option is to reimplement interpolated(), which returns
interpolation values for the value being interpolated.
\omit We need some snippets around here. \endomit
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index 8c4cc82..0fb78d5 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -378,7 +378,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
}
int invalidCount = 0;
- do {
+ while (inBytesLeft != 0) {
if (iconv(state->cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) {
if (errno == EINVAL && convState) {
// buffer ends in a surrogate
@@ -418,7 +418,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
}
}
}
- } while (inBytesLeft != 0);
+ }
// reset to initial state
iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
index 17ac9c6..03172e5 100644
--- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
@@ -295,6 +295,9 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
pathToFD.insert(path, fd);
if(parentFd)
parentToFD.insert(parentFd, fd);
+
+ ::closedir(d);
+ if(parent) ::closedir(parent);
}
Directory &directory = fdToDirectory[fd];
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 3cf9b7e..b8f6e2c 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -55,6 +55,7 @@
#include "private/qcore_unix_p.h"
#endif
#include <stdio.h>
+#include <stdlib.h>
QT_BEGIN_NAMESPACE
@@ -137,6 +138,20 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path)
if (path.isEmpty())
return path;
+#if defined(Q_OS_UNIX) || defined(Q_OS_SYMBIAN)
+ // FIXME let's see if this stuff works, then we might be able to remove some of the other code.
+ // baaad Mac: 10.5 and 10.6 crash if trying to free a value returned by
+ // realpath() if the input path is just the root component.
+ if (path.size() == 1 && path.at(0) == QLatin1Char('/'))
+ return path;
+ char *ret = realpath(path.toLocal8Bit().constData(), (char*)0);
+ if (ret) {
+ QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret));
+ free(ret);
+ return canonicalPath;
+ }
+#endif
+
QFileInfo fi;
const QChar slash(QLatin1Char('/'));
QString tmpPath = path;
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index 87f0737..41a6a1b 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
#define Q_USE_DEPRECATED_MAP_API 1
#endif
-class QFSFileEnginePrivate : public QAbstractFileEnginePrivate
+class Q_AUTOTEST_EXPORT QFSFileEnginePrivate : public QAbstractFileEnginePrivate
{
Q_DECLARE_PUBLIC(QFSFileEngine)
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 35737b3..71414ce 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -191,12 +191,16 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
return false;
}
- QT_STATBUF statBuf;
- if (QT_FSTAT(fd, &statBuf) != -1) {
- if ((statBuf.st_mode & S_IFMT) == S_IFDIR) {
- q->setError(QFile::OpenError, QLatin1String("file to open is a directory"));
- QT_CLOSE(fd);
- return false;
+ if (!(openMode & QIODevice::WriteOnly)) {
+ // we don't need this check if we tried to open for writing because then
+ // we had received EISDIR anyway.
+ QT_STATBUF statBuf;
+ if (QT_FSTAT(fd, &statBuf) != -1) {
+ if ((statBuf.st_mode & S_IFMT) == S_IFDIR) {
+ q->setError(QFile::OpenError, QLatin1String("file to open is a directory"));
+ QT_CLOSE(fd);
+ return false;
+ }
}
}
@@ -230,12 +234,16 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
return false;
}
- QT_STATBUF statBuf;
- if (QT_FSTAT(fileno(fh), &statBuf) != -1) {
- if ((statBuf.st_mode & S_IFMT) == S_IFDIR) {
- q->setError(QFile::OpenError, QLatin1String("file to open is a directory"));
- fclose(fh);
- return false;
+ if (!(openMode & QIODevice::WriteOnly)) {
+ // we don't need this check if we tried to open for writing because then
+ // we had received EISDIR anyway.
+ QT_STATBUF statBuf;
+ if (QT_FSTAT(fileno(fh), &statBuf) != -1) {
+ if ((statBuf.st_mode & S_IFMT) == S_IFDIR) {
+ q->setError(QFile::OpenError, QLatin1String("file to open is a directory"));
+ fclose(fh);
+ return false;
+ }
}
}
@@ -1245,7 +1253,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla
}
if (offset < 0 || offset != qint64(QT_OFF_T(offset))
- || size < 0 || size > qint64(size_t(-1))) {
+ || size < 0 || quint64(size) > quint64(size_t(-1))) {
q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL)));
return 0;
}
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index b84961f..0e5a2de 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1157,6 +1157,10 @@ QByteArray QIODevice::readLine(qint64 maxSize)
// If resize fails or maxSize == 0, read incrementally
if (maxSize == 0)
maxSize = INT_MAX;
+
+ // The first iteration needs to leave an extra byte for the terminating null
+ result.resize(1);
+
qint64 readResult;
do {
result.resize(int(qMin(maxSize, result.size() + QIODEVICE_BUFFERSIZE)));
@@ -1164,7 +1168,7 @@ QByteArray QIODevice::readLine(qint64 maxSize)
if (readResult > 0 || readBytes == 0)
readBytes += readResult;
} while (readResult == QIODEVICE_BUFFERSIZE
- && result[int(readBytes)] != '\n');
+ && result[int(readBytes - 1)] != '\n');
} else
readBytes = readLine(result.data(), result.size());
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 10a61ca..9335085 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -2546,9 +2546,9 @@ bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sour
int destinationLast = destinationChild + (sourceLast - sourceFirst);
d->changes.push(QAbstractItemModelPrivate::Change(destinationParent, destinationChild, destinationLast));
- d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical);
emit rowsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild);
emit layoutAboutToBeChanged();
+ d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical);
return true;
}
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index b3497b9..c6eef5e 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -336,6 +336,7 @@ public:
// internal window handle used for socketnotifiers/timers/etc
HWND internalHwnd;
+ HHOOK getMessageHook;
// for controlling when to send posted events
QAtomicInt serialNumber;
@@ -363,7 +364,7 @@ public:
};
QEventDispatcherWin32Private::QEventDispatcherWin32Private()
- : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), serialNumber(0), lastSerialNumber(0), wakeUps(0)
+ : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), wakeUps(0)
{
resolveTimerAPI();
}
@@ -471,37 +472,11 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
}
return 0;
} else if (message == WM_TIMER) {
- if (wp == SendPostedEventsTimerId) {
- KillTimer(d->internalHwnd, wp);
- int localSerialNumber = d->serialNumber;
- (void) d->wakeUps.fetchAndStoreRelease(0);
- if (localSerialNumber != d->lastSerialNumber) {
- PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
- }
- } else {
- Q_ASSERT(d != 0);
- d->sendTimerEvent(wp);
- }
+ Q_ASSERT(d != 0);
+ d->sendTimerEvent(wp);
return 0;
} else if (message == WM_QT_SENDPOSTEDEVENTS) {
int localSerialNumber = d->serialNumber;
-
- if (GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER) != 0) {
- // delay the next pass of sendPostedEvents() until we get the special
- // WM_TIMER, which allows all pending Windows messages to be processed
- if (SetTimer(d->internalHwnd, SendPostedEventsTimerId, 0, 0) == 0) {
- // failed to start the timer, oops, clear wakeUps in an attempt to keep things running
- qErrnoWarning("Qt: INTERNAL ERROR: failed to start sendPostedEvents() timer");
- d->wakeUps.fetchAndStoreRelease(0);
- } else {
- // SetTimer() succeeded, nothing to do now
- ;
- }
- } else {
- // nothing pending in the queue, let sendPostedEvents go through
- d->wakeUps.fetchAndStoreRelease(0);
- }
-
if (localSerialNumber != d->lastSerialNumber) {
d->lastSerialNumber = localSerialNumber;
QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
@@ -512,6 +487,31 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
return DefWindowProc(hwnd, message, wp, lp);
}
+LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
+{
+ if (wp == PM_REMOVE) {
+ QEventDispatcherWin32 *q = qobject_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance());
+ Q_ASSERT(q != 0);
+ if (q) {
+ QEventDispatcherWin32Private *d = q->d_func();
+ int localSerialNumber = d->serialNumber;
+ if (HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER)) == 0) {
+ // no more input or timer events in the message queue, we can allow posted events to be
+ // sent now
+ (void) d->wakeUps.fetchAndStoreRelease(0);
+ MSG *msg = (MSG *) lp;
+ if (localSerialNumber != d->lastSerialNumber
+ // if this message IS the one that triggers sendPostedEvents(), no need to post it again
+ && msg->hwnd != d->internalHwnd
+ && msg->message != WM_QT_SENDPOSTEDEVENTS) {
+ PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
+ }
+ }
+ }
+ }
+ return CallNextHookEx(0, code, wp, lp);
+}
+
static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher)
{
// make sure that multiple Qt's can coexist in the same process
@@ -636,6 +636,12 @@ void QEventDispatcherWin32::createInternalHwnd()
return;
d->internalHwnd = qt_create_internal_window(this);
+ // setup GetMessage hook needed to drive our posted events
+ d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId());
+ if (!d->getMessageHook) {
+ qFatal("Qt: INTERNALL ERROR: failed to install GetMessage hook");
+ }
+
// register all socket notifiers
QList<int> sockets = (d->sn_read.keys().toSet()
+ d->sn_write.keys().toSet()
@@ -725,7 +731,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
}
}
if (haveMessage) {
- if (msg.message == WM_QT_SENDPOSTEDEVENTS) {
+ if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
if (seenWM_QT_SENDPOSTEDEVENTS) {
needWM_QT_SENDPOSTEDEVENTS = true;
continue;
@@ -1058,6 +1064,10 @@ void QEventDispatcherWin32::closingDown()
d->unregisterTimer(d->timerVec.at(i), true);
d->timerVec.clear();
d->timerDict.clear();
+
+ if (d->getMessageHook)
+ UnhookWindowsHookEx(d->getMessageHook);
+ d->getMessageHook = 0;
}
bool QEventDispatcherWin32::event(QEvent *e)
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index a5ef4d4..7f0e87d 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -102,6 +102,7 @@ public:
private:
friend LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
+ friend LRESULT CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM);
};
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 1260d47..4321c59 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -145,8 +145,7 @@ QObjectPrivate::QObjectPrivate(int version)
receiveChildEvents = true;
postedEvents = 0;
extraData = 0;
- for (uint i = 0; i < (sizeof connectedSignals / sizeof connectedSignals[0]); ++i)
- connectedSignals[i] = 0;
+ connectedSignals = 0;
inEventHandler = false;
inThreadChangeEvent = false;
deleteWatch = 0;
@@ -154,6 +153,15 @@ QObjectPrivate::QObjectPrivate(int version)
hasGuards = false;
}
+#ifdef Q_CC_INTEL
+/* Workaround for a bug in win32-icc where it seems to inline ~QObjectPrivate too aggressive.
+ When icc compiles QtGui, it inlines ~QObjectPrivate so that it would generate a call to
+ ~QObjectData. However, ~QObjectData is not exported from QtCore, so it does not link.
+ See also QTBUG-5145 for info on how this manifested itself.
+ */
+# pragma auto_inline(off)
+#endif
+
QObjectPrivate::~QObjectPrivate()
{
delete static_cast<QAbstractDynamicMetaObject*>(metaObject);
@@ -165,6 +173,9 @@ QObjectPrivate::~QObjectPrivate()
delete extraData;
#endif
}
+#ifdef Q_CC_INTEL
+# pragma auto_inline(on)
+#endif
int *QObjectPrivate::setDeleteWatch(QObjectPrivate *d, int *w) {
@@ -2925,13 +2936,9 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
QObjectPrivate *const sender_d = QObjectPrivate::get(s);
if (signal_index < 0) {
- for (uint i = 0; i < (sizeof sender_d->connectedSignals
- / sizeof sender_d->connectedSignals[0] ); ++i)
- sender_d->connectedSignals[i] = ~0u;
- } else if (signal_index < (int)sizeof sender_d->connectedSignals * 8) {
- uint n = (signal_index / (8 * sizeof sender_d->connectedSignals[0]));
- sender_d->connectedSignals[n] |= (1 << (signal_index - n * 8
- * sizeof sender_d->connectedSignals[0]));
+ sender_d->connectedSignals = ~ulong(0);
+ } else if (signal_index < (int)sizeof(sender_d->connectedSignals) * 8) {
+ sender_d->connectedSignals |= ulong(1) << signal_index;
}
return true;
@@ -3189,15 +3196,9 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
computeOffsets(m, &signalOffset, &methodOffset);
int signal_index = signalOffset + local_signal_index;
- if (signal_index < (int)sizeof(sender->d_func()->connectedSignals) * 8
- && !qt_signal_spy_callback_set.signal_begin_callback
- && !qt_signal_spy_callback_set.signal_end_callback) {
- uint n = (signal_index / (8 * sizeof sender->d_func()->connectedSignals[0]));
- uint m = 1 << (signal_index - n * 8 * sizeof sender->d_func()->connectedSignals[0]);
- if ((sender->d_func()->connectedSignals[n] & m) == 0)
- // nothing connected to these signals, and no spy
- return;
- }
+
+ if (!sender->d_func()->isSignalConnected(signal_index))
+ return; // nothing connected to these signals, and no spy
if (sender->d_func()->blockSig)
return;
@@ -3358,28 +3359,6 @@ int QObjectPrivate::signalIndex(const char *signalName) const
return relative_index + signalOffset;
}
-/*! \internal
-
- Returns true if the signal with index \a signal_index from object \a sender is connected.
- Signals with indices above a certain range are always considered connected (see connectedSignals
- in QObjectPrivate). If a signal spy is installed, all signals are considered connected.
-
- \a signal_index must be the index returned by QObjectPrivate::signalIndex;
-*/
-bool QObjectPrivate::isSignalConnected(int signal_index) const
-{
- if (signal_index < (int)sizeof(connectedSignals) * 8
- && !qt_signal_spy_callback_set.signal_begin_callback
- && !qt_signal_spy_callback_set.signal_end_callback) {
- uint n = (signal_index / (8 * sizeof connectedSignals[0]));
- uint m = 1 << (signal_index - n * 8 * sizeof connectedSignals[0]);
- if ((connectedSignals[n] & m) == 0)
- // nothing connected to these signals, and no spy
- return false;
- }
- return true;
-}
-
/*****************************************************************************
Properties
*****************************************************************************/
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index f087407..f899c78 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -172,7 +172,7 @@ public:
}
int signalIndex(const char *signalName) const;
- bool isSignalConnected(int signalIdx) const;
+ inline bool isSignalConnected(int signalIdx) const;
public:
QString objectName;
@@ -183,7 +183,7 @@ public:
Connection *senders; // linked list of connections connected to this object
Sender *currentSender; // object currently activating the object
- mutable quint32 connectedSignals[2]; // 64-bit, so doesn't cause padding on 64-bit platforms
+ mutable ulong connectedSignals;
#ifdef QT3_SUPPORT
QList<QObject *> pendingChildInsertedEvents;
@@ -205,6 +205,23 @@ public:
int *deleteWatch;
};
+/*! \internal
+
+ Returns true if the signal with index \a signal_index from object \a sender is connected.
+ Signals with indices above a certain range are always considered connected (see connectedSignals
+ in QObjectPrivate). If a signal spy is installed, all signals are considered connected.
+
+ \a signal_index must be the index returned by QObjectPrivate::signalIndex;
+*/
+inline bool QObjectPrivate::isSignalConnected(int signal_index) const
+{
+ return signal_index >= (int)sizeof(connectedSignals) * 8
+ || qt_signal_spy_callback_set.signal_begin_callback
+ || qt_signal_spy_callback_set.signal_end_callback
+ || (connectedSignals & (ulong(1) << signal_index));
+}
+
+
inline void q_guard_addGuard(QGuard<QObject> *g)
{
QObjectPrivate *p = QObjectPrivate::get(g->o);
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index 7b86ee0..5017dbd 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -137,7 +137,12 @@ public:
#if defined(QT_ARCH_WINDOWS) || defined(QT_ARCH_WINDOWSCE)
union {
T * volatile _q_value;
- long volatile _q_value_integral;
+# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
+ qint64
+# else
+ long
+# endif
+ volatile _q_value_integral;
};
#else
T * volatile _q_value;
diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g
index 22ba33d..9921d41 100644
--- a/src/corelib/xml/qxmlstream.g
+++ b/src/corelib/xml/qxmlstream.g
@@ -915,6 +915,7 @@ markup ::= markup_start markup_list RBRACK;
markup_list ::= markup_decl | space | pereference;
markup_list ::= markup_list markup_decl | markup_list space | markup_list pereference;
+markup_list ::=;
markup_decl ::= element_decl | attlist_decl | entity_decl | entity_done | notation_decl | processing_instruction | comment;
diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h
index 253f8bd..5eea065 100644
--- a/src/corelib/xml/qxmlstream_p.h
+++ b/src/corelib/xml/qxmlstream_p.h
@@ -121,7 +121,7 @@ public:
XML = 54,
ACCEPT_STATE = 416,
- RULE_COUNT = 269,
+ RULE_COUNT = 270,
STATE_COUNT = 427,
TERMINAL_COUNT = 57,
NON_TERMINAL_COUNT = 84,
@@ -172,105 +172,105 @@ const char *const QXmlStreamReader_Table::spell [] = {
const short QXmlStreamReader_Table::lhs [] = {
57, 57, 59, 59, 59, 59, 59, 59, 59, 59,
67, 68, 64, 72, 72, 72, 75, 66, 66, 66,
- 66, 79, 78, 80, 80, 80, 80, 80, 80, 81,
- 81, 81, 81, 81, 81, 81, 87, 83, 88, 88,
- 88, 88, 91, 92, 93, 93, 93, 93, 94, 94,
- 96, 96, 96, 97, 97, 98, 98, 99, 99, 100,
- 100, 89, 89, 95, 90, 101, 101, 103, 103, 103,
- 103, 103, 103, 103, 103, 103, 103, 104, 105, 105,
- 105, 105, 107, 108, 109, 109, 84, 84, 110, 110,
- 112, 112, 85, 85, 85, 65, 65, 76, 114, 63,
- 115, 116, 86, 86, 86, 117, 117, 117, 117, 117,
+ 66, 79, 78, 80, 80, 80, 80, 80, 80, 80,
+ 81, 81, 81, 81, 81, 81, 81, 87, 83, 88,
+ 88, 88, 88, 91, 92, 93, 93, 93, 93, 94,
+ 94, 96, 96, 96, 97, 97, 98, 98, 99, 99,
+ 100, 100, 89, 89, 95, 90, 101, 101, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 104, 105,
+ 105, 105, 105, 107, 108, 109, 109, 84, 84, 110,
+ 110, 112, 112, 85, 85, 85, 65, 65, 76, 114,
+ 63, 115, 116, 86, 86, 86, 117, 117, 117, 117,
117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 118, 118,
- 119, 119, 119, 119, 119, 119, 119, 119, 122, 70,
- 70, 70, 70, 123, 124, 123, 124, 123, 124, 123,
- 124, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 117, 117, 117, 117, 117, 117, 117, 117, 117, 118,
+ 118, 119, 119, 119, 119, 119, 119, 119, 119, 122,
+ 70, 70, 70, 70, 123, 124, 123, 124, 123, 124,
+ 123, 124, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
- 126, 126, 126, 125, 73, 113, 113, 113, 113, 127,
- 128, 127, 128, 127, 128, 127, 128, 129, 129, 129,
+ 126, 126, 126, 126, 125, 73, 113, 113, 113, 113,
+ 127, 128, 127, 128, 127, 128, 127, 128, 129, 129,
129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
- 129, 129, 106, 106, 106, 106, 131, 132, 131, 132,
- 131, 131, 132, 132, 133, 133, 133, 133, 135, 71,
- 71, 71, 136, 136, 137, 62, 60, 61, 138, 121,
- 82, 130, 134, 120, 139, 139, 139, 139, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 74, 69,
- 69, 77, 111, 102, 102, 102, 102, 102, 140};
+ 129, 129, 129, 106, 106, 106, 106, 131, 132, 131,
+ 132, 131, 131, 132, 132, 133, 133, 133, 133, 135,
+ 71, 71, 71, 136, 136, 137, 62, 60, 61, 138,
+ 121, 82, 130, 134, 120, 139, 139, 139, 139, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 74,
+ 69, 69, 77, 111, 102, 102, 102, 102, 102, 140};
const short QXmlStreamReader_Table::rhs [] = {
2, 1, 4, 2, 2, 2, 2, 2, 2, 0,
1, 1, 9, 2, 4, 0, 4, 4, 6, 6,
- 4, 1, 3, 1, 1, 1, 2, 2, 2, 1,
- 1, 1, 1, 1, 1, 1, 4, 4, 1, 1,
- 1, 1, 1, 2, 1, 1, 1, 0, 2, 2,
- 2, 6, 6, 1, 5, 1, 5, 3, 5, 0,
- 1, 6, 8, 4, 2, 1, 5, 1, 1, 1,
- 1, 1, 1, 1, 1, 6, 7, 1, 2, 2,
- 1, 4, 3, 3, 1, 2, 5, 6, 4, 6,
- 3, 5, 5, 3, 4, 4, 5, 2, 3, 2,
- 2, 4, 5, 5, 7, 1, 1, 1, 1, 1,
+ 4, 1, 3, 1, 1, 1, 2, 2, 2, 0,
+ 1, 1, 1, 1, 1, 1, 1, 4, 4, 1,
+ 1, 1, 1, 1, 2, 1, 1, 1, 0, 2,
+ 2, 2, 6, 6, 1, 5, 1, 5, 3, 5,
+ 0, 1, 6, 8, 4, 2, 1, 5, 1, 1,
+ 1, 1, 1, 1, 1, 1, 6, 7, 1, 2,
+ 2, 1, 4, 3, 3, 1, 2, 5, 6, 4,
+ 6, 3, 5, 5, 3, 4, 4, 5, 2, 3,
+ 2, 2, 4, 5, 5, 7, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 1, 1, 1, 1, 1, 2,
- 2, 3, 3, 2, 2, 2, 2, 1, 1, 1,
+ 1, 2, 2, 2, 2, 1, 1, 1, 1, 1,
+ 2, 2, 3, 3, 2, 2, 2, 2, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 2, 2, 3, 3, 2,
- 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 2, 3, 3,
+ 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 2, 2, 3, 3, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 5, 0,
- 1, 3, 1, 3, 2, 4, 3, 5, 1, 3,
- 3, 3, 3, 4, 1, 1, 2, 2, 2, 4,
- 2, 2, 2, 2, 2, 2, 2, 0, 1, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2};
+ 1, 1, 1, 2, 2, 3, 3, 2, 2, 2,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 5,
+ 0, 1, 3, 1, 3, 2, 4, 3, 5, 1,
+ 3, 3, 3, 3, 4, 1, 1, 2, 2, 2,
+ 4, 2, 2, 2, 2, 2, 2, 2, 0, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 2};
const short QXmlStreamReader_Table::action_default [] = {
- 10, 258, 0, 2, 1, 0, 124, 116, 118, 119,
- 126, 128, 122, 11, 113, 107, 0, 108, 127, 110,
- 114, 112, 120, 123, 125, 106, 109, 111, 117, 115,
- 130, 121, 239, 12, 253, 135, 249, 252, 0, 129,
- 139, 256, 16, 251, 137, 136, 0, 255, 138, 258,
- 230, 257, 254, 0, 0, 263, 0, 246, 245, 0,
- 248, 247, 244, 240, 98, 262, 0, 235, 0, 0,
- 259, 96, 97, 100, 0, 131, 133, 132, 134, 0,
- 0, 260, 0, 0, 175, 0, 172, 164, 166, 167,
- 141, 153, 170, 161, 155, 156, 152, 158, 162, 160,
- 168, 171, 151, 154, 157, 159, 165, 163, 173, 169,
- 149, 174, 0, 143, 147, 145, 150, 140, 148, 0,
- 146, 142, 144, 0, 15, 14, 261, 0, 22, 21,
- 260, 0, 0, 20, 0, 0, 31, 36, 30, 0,
- 32, 260, 0, 33, 0, 24, 0, 34, 0, 26,
- 35, 25, 0, 241, 40, 39, 260, 42, 48, 260,
- 41, 0, 43, 260, 48, 260, 0, 260, 0, 48,
- 0, 47, 45, 46, 50, 51, 260, 260, 0, 56,
- 260, 53, 260, 0, 57, 0, 54, 260, 52, 260,
- 0, 55, 64, 0, 260, 60, 260, 0, 58, 61,
- 62, 0, 260, 0, 0, 59, 63, 44, 49, 65,
- 0, 38, 0, 0, 260, 0, 93, 94, 0, 0,
- 0, 0, 260, 0, 209, 200, 202, 204, 177, 189,
- 207, 198, 192, 190, 193, 188, 195, 197, 205, 208,
- 187, 191, 194, 196, 201, 199, 203, 206, 210, 212,
- 211, 185, 0, 0, 242, 179, 183, 181, 0, 0,
- 92, 186, 176, 184, 0, 182, 178, 180, 91, 0,
- 95, 0, 0, 0, 0, 0, 260, 85, 260, 0,
- 261, 0, 86, 0, 88, 68, 73, 72, 69, 70,
- 71, 260, 74, 75, 0, 0, 0, 268, 267, 265,
- 266, 264, 66, 260, 0, 260, 0, 0, 67, 76,
- 260, 0, 260, 0, 0, 77, 0, 78, 0, 81,
- 84, 0, 0, 214, 224, 223, 0, 226, 228, 227,
- 225, 0, 243, 216, 220, 218, 222, 213, 221, 0,
- 219, 215, 217, 0, 80, 79, 0, 82, 0, 83,
- 87, 99, 0, 37, 0, 0, 0, 0, 90, 89,
- 0, 102, 23, 27, 29, 28, 0, 0, 260, 261,
- 0, 260, 0, 105, 104, 260, 0, 103, 101, 0,
- 0, 18, 260, 17, 0, 19, 0, 0, 250, 0,
- 260, 0, 238, 0, 231, 237, 0, 236, 233, 260,
- 260, 261, 232, 234, 0, 260, 0, 229, 260, 0,
- 260, 0, 230, 0, 0, 13, 269, 9, 5, 8,
- 4, 0, 7, 258, 6, 0, 3};
+ 10, 259, 0, 2, 1, 0, 125, 117, 119, 120,
+ 127, 129, 123, 11, 114, 108, 0, 109, 128, 111,
+ 115, 113, 121, 124, 126, 107, 110, 112, 118, 116,
+ 131, 122, 240, 12, 254, 136, 250, 253, 0, 130,
+ 140, 257, 16, 252, 138, 137, 0, 256, 139, 259,
+ 231, 258, 255, 0, 0, 264, 0, 247, 246, 0,
+ 249, 248, 245, 241, 99, 263, 0, 236, 0, 0,
+ 260, 97, 98, 101, 0, 132, 134, 133, 135, 0,
+ 0, 261, 0, 0, 176, 0, 173, 165, 167, 168,
+ 142, 154, 171, 162, 156, 157, 153, 159, 163, 161,
+ 169, 172, 152, 155, 158, 160, 166, 164, 174, 170,
+ 150, 175, 0, 144, 148, 146, 151, 141, 149, 0,
+ 147, 143, 145, 0, 15, 14, 262, 0, 22, 21,
+ 261, 30, 0, 20, 0, 0, 32, 37, 31, 0,
+ 33, 261, 0, 34, 0, 24, 0, 35, 0, 26,
+ 36, 25, 0, 242, 41, 40, 261, 43, 49, 261,
+ 42, 0, 44, 261, 49, 261, 0, 261, 0, 49,
+ 0, 48, 46, 47, 51, 52, 261, 261, 0, 57,
+ 261, 54, 261, 0, 58, 0, 55, 261, 53, 261,
+ 0, 56, 65, 0, 261, 61, 261, 0, 59, 62,
+ 63, 0, 261, 0, 0, 60, 64, 45, 50, 66,
+ 0, 39, 0, 0, 261, 0, 94, 95, 0, 0,
+ 0, 0, 261, 0, 210, 201, 203, 205, 178, 190,
+ 208, 199, 193, 191, 194, 189, 196, 198, 206, 209,
+ 188, 192, 195, 197, 202, 200, 204, 207, 211, 213,
+ 212, 186, 0, 0, 243, 180, 184, 182, 0, 0,
+ 93, 187, 177, 185, 0, 183, 179, 181, 92, 0,
+ 96, 0, 0, 0, 0, 0, 261, 86, 261, 0,
+ 262, 0, 87, 0, 89, 69, 74, 73, 70, 71,
+ 72, 261, 75, 76, 0, 0, 0, 269, 268, 266,
+ 267, 265, 67, 261, 0, 261, 0, 0, 68, 77,
+ 261, 0, 261, 0, 0, 78, 0, 79, 0, 82,
+ 85, 0, 0, 215, 225, 224, 0, 227, 229, 228,
+ 226, 0, 244, 217, 221, 219, 223, 214, 222, 0,
+ 220, 216, 218, 0, 81, 80, 0, 83, 0, 84,
+ 88, 100, 0, 38, 0, 0, 0, 0, 91, 90,
+ 0, 103, 23, 27, 29, 28, 0, 0, 261, 262,
+ 0, 261, 0, 106, 105, 261, 0, 104, 102, 0,
+ 0, 18, 261, 17, 0, 19, 0, 0, 251, 0,
+ 261, 0, 239, 0, 232, 238, 0, 237, 234, 261,
+ 261, 262, 233, 235, 0, 261, 0, 230, 261, 0,
+ 261, 0, 231, 0, 0, 13, 270, 9, 5, 8,
+ 4, 0, 7, 259, 6, 0, 3};
const short QXmlStreamReader_Table::goto_default [] = {
2, 4, 3, 49, 388, 43, 37, 52, 47, 41,
@@ -736,8 +736,8 @@ public:
}
};
-class QXmlStreamEntityResolver;
+class QXmlStreamEntityResolver;
#ifndef QT_NO_XMLSTREAMREADER
class QXmlStreamReaderPrivate : public QXmlStreamReader_Table, public QXmlStreamPrivateTagStack{
QXmlStreamReader *q_ptr;
@@ -1355,44 +1355,44 @@ bool QXmlStreamReaderPrivate::parse()
scanDtd = false;
break;
- case 36:
+ case 37:
if (!scanString(spell[EMPTY], EMPTY, false)
&& !scanString(spell[ANY], ANY, false)
&& atEnd) {
- resume(36);
+ resume(37);
return false;
}
break;
- case 42:
+ case 43:
if (!scanString(spell[PCDATA], PCDATA, false) && atEnd) {
- resume(42);
+ resume(43);
return false;
}
break;
- case 67: {
+ case 68: {
lastAttributeIsCData = true;
} break;
- case 77:
+ case 78:
if (!scanAfterDefaultDecl() && atEnd) {
- resume(77);
+ resume(78);
return false;
}
break;
- case 82:
+ case 83:
sym(1) = sym(2);
lastAttributeValue.clear();
lastAttributeIsCData = false;
if (!scanAttType() && atEnd) {
- resume(82);
+ resume(83);
return false;
}
break;
- case 83: {
+ case 84: {
DtdAttribute &dtdAttribute = dtdAttributes.push();
dtdAttribute.tagName.clear();
dtdAttribute.isCDATA = lastAttributeIsCData;
@@ -1413,7 +1413,7 @@ bool QXmlStreamReaderPrivate::parse()
}
} break;
- case 87: {
+ case 88: {
if (referenceToUnparsedEntityDetected && !standalone)
break;
int n = dtdAttributes.size();
@@ -1433,9 +1433,9 @@ bool QXmlStreamReaderPrivate::parse()
}
} break;
- case 88: {
+ case 89: {
if (!scanPublicOrSystem() && atEnd) {
- resume(88);
+ resume(89);
return false;
}
EntityDeclaration &entityDeclaration = entityDeclarations.push();
@@ -1443,9 +1443,9 @@ bool QXmlStreamReaderPrivate::parse()
entityDeclaration.name = symString(3);
} break;
- case 89: {
+ case 90: {
if (!scanPublicOrSystem() && atEnd) {
- resume(89);
+ resume(90);
return false;
}
EntityDeclaration &entityDeclaration = entityDeclarations.push();
@@ -1454,9 +1454,9 @@ bool QXmlStreamReaderPrivate::parse()
entityDeclaration.parameter = true;
} break;
- case 90: {
+ case 91: {
if (!scanNData() && atEnd) {
- resume(90);
+ resume(91);
return false;
}
EntityDeclaration &entityDeclaration = entityDeclarations.top();
@@ -1464,9 +1464,9 @@ bool QXmlStreamReaderPrivate::parse()
entityDeclaration.external = true;
} break;
- case 91: {
+ case 92: {
if (!scanNData() && atEnd) {
- resume(91);
+ resume(92);
return false;
}
EntityDeclaration &entityDeclaration = entityDeclarations.top();
@@ -1475,7 +1475,7 @@ bool QXmlStreamReaderPrivate::parse()
entityDeclaration.external = true;
} break;
- case 92: {
+ case 93: {
EntityDeclaration &entityDeclaration = entityDeclarations.top();
entityDeclaration.notationName = symString(3);
if (entityDeclaration.parameter)
@@ -1483,8 +1483,8 @@ bool QXmlStreamReaderPrivate::parse()
}
//fall through
- case 93:
- case 94: {
+ case 94:
+ case 95: {
if (referenceToUnparsedEntityDetected && !standalone) {
entityDeclarations.pop();
break;
@@ -1502,7 +1502,7 @@ bool QXmlStreamReaderPrivate::parse()
}
} break;
- case 95: {
+ case 96: {
setType(QXmlStreamReader::ProcessingInstruction);
int pos = sym(4).pos + sym(4).len;
processingInstructionTarget = symString(3);
@@ -1515,39 +1515,39 @@ bool QXmlStreamReaderPrivate::parse()
else if(!QXmlUtils::isNCName(piTarget))
raiseWellFormedError(QXmlStream::tr("%1 is an invalid processing instruction name.").arg(piTarget));
} else if (type != QXmlStreamReader::Invalid){
- resume(95);
+ resume(96);
return false;
}
} break;
- case 96:
+ case 97:
setType(QXmlStreamReader::ProcessingInstruction);
processingInstructionTarget = symString(3);
if (!processingInstructionTarget.toString().compare(QLatin1String("xml"), Qt::CaseInsensitive))
raiseWellFormedError(QXmlStream::tr("Invalid processing instruction name."));
break;
- case 97:
+ case 98:
if (!scanAfterLangleBang() && atEnd) {
- resume(97);
+ resume(98);
return false;
}
break;
- case 98:
+ case 99:
if (!scanUntil("--")) {
- resume(98);
+ resume(99);
return false;
}
break;
- case 99: {
+ case 100: {
setType(QXmlStreamReader::Comment);
int pos = sym(1).pos + 4;
text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3);
} break;
- case 100: {
+ case 101: {
setType(QXmlStreamReader::Characters);
isCDATA = true;
isWhitespace = false;
@@ -1555,131 +1555,131 @@ bool QXmlStreamReaderPrivate::parse()
if (scanUntil("]]>", -1)) {
text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3);
} else {
- resume(100);
+ resume(101);
return false;
}
} break;
- case 101: {
+ case 102: {
if (!scanPublicOrSystem() && atEnd) {
- resume(101);
+ resume(102);
return false;
}
NotationDeclaration &notationDeclaration = notationDeclarations.push();
notationDeclaration.name = symString(3);
} break;
- case 102: {
+ case 103: {
NotationDeclaration &notationDeclaration = notationDeclarations.top();
notationDeclaration.systemId = symString(3);
notationDeclaration.publicId.clear();
} break;
- case 103: {
+ case 104: {
NotationDeclaration &notationDeclaration = notationDeclarations.top();
notationDeclaration.systemId.clear();
checkPublicLiteral((notationDeclaration.publicId = symString(3)));
} break;
- case 104: {
+ case 105: {
NotationDeclaration &notationDeclaration = notationDeclarations.top();
checkPublicLiteral((notationDeclaration.publicId = symString(3)));
notationDeclaration.systemId = symString(5);
} break;
- case 128:
+ case 129:
isWhitespace = false;
// fall through
- case 129:
+ case 130:
sym(1).len += fastScanContentCharList();
if (atEnd && !inParseEntity) {
- resume(129);
+ resume(130);
return false;
}
break;
- case 138:
+ case 139:
if (!textBuffer.isEmpty()) {
setType(QXmlStreamReader::Characters);
text = &textBuffer;
}
break;
- case 139:
case 140:
+ case 141:
clearSym();
break;
- case 141:
case 142:
+ case 143:
sym(1) = sym(2);
break;
- case 143:
case 144:
case 145:
case 146:
+ case 147:
sym(1).len += sym(2).len;
break;
- case 172:
+ case 173:
if (normalizeLiterals)
textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' ');
break;
- case 173:
+ case 174:
sym(1).len += fastScanLiteralContent();
if (atEnd) {
- resume(173);
+ resume(174);
return false;
}
break;
- case 174: {
+ case 175: {
if (!QXmlUtils::isPublicID(symString(1).toString())) {
raiseWellFormedError(QXmlStream::tr("%1 is an invalid PUBLIC identifier.").arg(symString(1).toString()));
- resume(174);
+ resume(175);
return false;
}
} break;
- case 175:
case 176:
+ case 177:
clearSym();
break;
- case 177:
case 178:
+ case 179:
sym(1) = sym(2);
break;
- case 179:
case 180:
case 181:
case 182:
+ case 183:
sym(1).len += sym(2).len;
break;
- case 212:
case 213:
+ case 214:
clearSym();
break;
- case 214:
case 215:
+ case 216:
sym(1) = sym(2);
lastAttributeValue = symString(1);
break;
- case 216:
case 217:
case 218:
case 219:
+ case 220:
sym(1).len += sym(2).len;
break;
- case 228: {
+ case 229: {
QStringRef prefix = symPrefix(1);
if (prefix.isEmpty() && symString(1) == QLatin1String("xmlns") && namespaceProcessing) {
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
@@ -1749,7 +1749,7 @@ bool QXmlStreamReaderPrivate::parse()
}
} break;
- case 234: {
+ case 235: {
normalizeLiterals = true;
Tag &tag = tagStack_push();
prefix = tag.namespaceDeclaration.prefix = addToStringStorage(symPrefix(2));
@@ -1759,11 +1759,11 @@ bool QXmlStreamReaderPrivate::parse()
raiseWellFormedError(QXmlStream::tr("Invalid XML name."));
} break;
- case 235:
+ case 236:
isEmptyElement = true;
// fall through
- case 236:
+ case 237:
setType(QXmlStreamReader::StartElement);
resolveTag();
if (tagStack.size() == 1 && hasSeenTag && !inParseEntity)
@@ -1771,7 +1771,7 @@ bool QXmlStreamReaderPrivate::parse()
hasSeenTag = true;
break;
- case 237: {
+ case 238: {
setType(QXmlStreamReader::EndElement);
Tag &tag = tagStack_pop();
@@ -1782,7 +1782,7 @@ bool QXmlStreamReaderPrivate::parse()
raiseWellFormedError(QXmlStream::tr("Opening and ending tag mismatch."));
} break;
- case 238:
+ case 239:
if (entitiesMustBeDeclared()) {
raiseWellFormedError(QXmlStream::tr("Entity '%1' not declared.").arg(unresolvedEntity));
break;
@@ -1791,7 +1791,7 @@ bool QXmlStreamReaderPrivate::parse()
name = &unresolvedEntity;
break;
- case 239: {
+ case 240: {
sym(1).len += sym(2).len + 1;
QString reference = symString(2).toString();
if (entityHash.contains(reference)) {
@@ -1830,7 +1830,7 @@ bool QXmlStreamReaderPrivate::parse()
} break;
- case 240: {
+ case 241: {
sym(1).len += sym(2).len + 1;
QString reference = symString(2).toString();
if (parameterEntityHash.contains(reference)) {
@@ -1849,11 +1849,11 @@ bool QXmlStreamReaderPrivate::parse()
}
} break;
- case 241:
+ case 242:
sym(1).len += sym(2).len + 1;
break;
- case 242: {
+ case 243: {
sym(1).len += sym(2).len + 1;
QString reference = symString(2).toString();
if (entityHash.contains(reference)) {
@@ -1889,7 +1889,7 @@ bool QXmlStreamReaderPrivate::parse()
}
} break;
- case 243: {
+ case 244: {
if (uint s = resolveCharRef(3)) {
if (s >= 0xffff)
putStringLiteral(QString::fromUcs4(&s, 1));
@@ -1903,43 +1903,43 @@ bool QXmlStreamReaderPrivate::parse()
}
} break;
- case 246:
case 247:
+ case 248:
sym(1).len += sym(2).len;
break;
- case 258:
+ case 259:
sym(1).len += fastScanSpace();
if (atEnd) {
- resume(258);
+ resume(259);
return false;
}
break;
- case 261: {
+ case 262: {
sym(1).len += fastScanName(&sym(1).prefix);
if (atEnd) {
- resume(261);
+ resume(262);
return false;
}
} break;
- case 262:
+ case 263:
sym(1).len += fastScanName();
if (atEnd) {
- resume(262);
+ resume(263);
return false;
}
break;
- case 263:
case 264:
case 265:
case 266:
case 267:
+ case 268:
sym(1).len += fastScanNMTOKEN();
if (atEnd) {
- resume(267);
+ resume(268);
return false;
}
@@ -1958,7 +1958,8 @@ bool QXmlStreamReaderPrivate::parse()
}
return false;
}
+#endif //QT_NO_XMLSTREAMREADER.xml
+
-#endif //QT_NO_XMLSTREAMREADER
#endif // QXMLSTREAM_P_H
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index d3aff6d..d7088ff 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -1005,9 +1005,6 @@ void QDBusConnectionPrivate::setBusService(const QDBusConnection &connection)
busService = new QDBusConnectionInterface(connection, this);
ref.deref(); // busService has increased the refcounting to us
// avoid cyclic refcounting
-// if (mode != PeerMode)
- QObject::connect(busService, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- this, SIGNAL(serviceOwnerChanged(QString,QString,QString)));
QObject::connect(this, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)),
busService, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)),
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 830dac3..b65e101 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -199,9 +199,6 @@ public:
QDBusMetaObject *findMetaObject(const QString &service, const QString &path,
const QString &interface, QDBusError &error);
- void registerService(const QString &serviceName);
- void unregisterService(const QString &serviceName);
-
void postEventToThread(int action, QObject *target, QEvent *event);
inline void serverConnection(const QDBusConnection &connection)
@@ -238,6 +235,8 @@ public slots:
void objectDestroyed(QObject *o);
void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args);
void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
+ void registerService(const QString &serviceName);
+ void unregisterService(const QString &serviceName);
signals:
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
diff --git a/src/dbus/qdbusconnectioninterface.cpp b/src/dbus/qdbusconnectioninterface.cpp
index 3b38432..0f9a67f 100644
--- a/src/dbus/qdbusconnectioninterface.cpp
+++ b/src/dbus/qdbusconnectioninterface.cpp
@@ -337,6 +337,11 @@ void QDBusConnectionInterface::connectNotify(const char *signalName)
QDBusAbstractInterface::connectNotify(SIGNAL(NameLost(QString)));
else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) {
+ static bool warningPrinted = false;
+ if (!warningPrinted) {
+ qWarning("Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)");
+ warningPrinted = true;
+ }
QDBusAbstractInterface::connectNotify(SIGNAL(NameOwnerChanged(QString,QString,QString)));
}
}
@@ -389,6 +394,12 @@ void QDBusConnectionInterface::disconnectNotify(const char *signalName)
empty string, it means the name \a name has just been created; if
\a newOwner is empty, the name \a name has no current owner and is
no longer available.
+
+ \note connecting to this signal will make the application listen for and
+ receive every single service ownership change on the bus. Depending on
+ how many services are running, this make the application be activated to
+ receive more signals than it needs. To avoid this problem, use the
+ QDBusServiceWatcher class, which can listen for specific changes.
*/
/*!
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 870ddd0..40febc4 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -948,9 +948,6 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
rootNode.flags = 0;
watchedServiceNames[QLatin1String(DBUS_SERVICE_DBUS)] = 1;
-
- connect(this, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}
QDBusConnectionPrivate::~QDBusConnectionPrivate()
@@ -1180,11 +1177,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
void QDBusConnectionPrivate::_q_serviceOwnerChanged(const QString &name,
const QString &oldOwner, const QString &newOwner)
{
- if (oldOwner == baseService)
- unregisterService(name);
- if (newOwner == baseService)
- registerService(name);
-
+ Q_UNUSED(oldOwner);
QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this);
QMutableHashIterator<QString, SignalHook> it(signalHooks);
it.toFront();
@@ -1655,9 +1648,16 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
baseService = QString::fromUtf8(service);
} else {
- qWarning("QDBusConnectionPrivate::SetConnection: Unable to get base service");
+ qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service");
}
+ QString busService = QLatin1String(DBUS_SERVICE_DBUS);
+ connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(),
+ this, SLOT(registerService(QString)));
+ connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(),
+ this, SLOT(unregisterService(QString)));
+
+
q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0);
//qDebug("base service: %s", service);
diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp
index 1557b47..4328558 100644
--- a/src/dbus/qdbusservicewatcher.cpp
+++ b/src/dbus/qdbusservicewatcher.cpp
@@ -50,7 +50,6 @@
QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QString, busService, (QLatin1String(DBUS_SERVICE_DBUS)))
-Q_GLOBAL_STATIC_WITH_ARGS(QString, busPath, (QLatin1String(DBUS_PATH_DBUS)))
Q_GLOBAL_STATIC_WITH_ARGS(QString, busInterface, (QLatin1String(DBUS_INTERFACE_DBUS)))
Q_GLOBAL_STATIC_WITH_ARGS(QString, signalName, (QLatin1String("NameOwnerChanged")))
@@ -127,7 +126,7 @@ QStringList QDBusServiceWatcherPrivate::matchArgsForService(const QString &servi
void QDBusServiceWatcherPrivate::addService(const QString &service)
{
QStringList matchArgs = matchArgsForService(service);
- connection.connect(*busService(), *busPath(), *busInterface(), *signalName(),
+ connection.connect(*busService(), QString(), *busInterface(), *signalName(),
matchArgs, QString(), q_func(),
SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}
@@ -135,7 +134,7 @@ void QDBusServiceWatcherPrivate::addService(const QString &service)
void QDBusServiceWatcherPrivate::removeService(const QString &service)
{
QStringList matchArgs = matchArgsForService(service);
- connection.disconnect(*busService(), *busPath(), *busInterface(), *signalName(),
+ connection.disconnect(*busService(), QString(), *busInterface(), *signalName(),
matchArgs, QString(), q_func(),
SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index 5f074c0..53d2e1e 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -336,7 +336,6 @@ QT_USE_NAMESPACE
}
}
- QAbstractEventDispatcher::instance()->interrupt();
if (mResultCode == NSCancelButton)
mPriv->colorDialog()->reject();
else
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index c0e4890..cf28dc4 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -236,6 +236,18 @@ bool QEglContext::makeCurrent(EGLSurface surface)
currentSurface = surface;
setCurrentContext(apiType, this);
+ // Force the right API to be bound before making the context current.
+ // The EGL implementation should be able to figure this out from ctx,
+ // but some systems require the API to be explicitly set anyway.
+#ifdef EGL_OPENGL_ES_API
+ if (apiType == QEgl::OpenGL)
+ eglBindAPI(EGL_OPENGL_ES_API);
+#endif
+#ifdef EGL_OPENVG_API
+ if (apiType == QEgl::OpenVG)
+ eglBindAPI(EGL_OPENVG_API);
+#endif
+
bool ok = eglMakeCurrent(dpy, surface, surface, ctx);
if (!ok)
qWarning() << "QEglContext::makeCurrent():" << errorString(eglGetError());
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index fb67278..a6f5992 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -1272,7 +1272,6 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges()
addAnchor_helper(layout, Qt::AnchorLeft, layout,
Qt::AnchorRight, data);
data->maxSize = QWIDGETSIZE_MAX;
- data->skipInPreferred = 1;
// Save a reference to layout vertices
layoutFirstVertex[Horizontal] = internalVertex(layout, Qt::AnchorLeft);
@@ -1284,7 +1283,6 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges()
addAnchor_helper(layout, Qt::AnchorTop, layout,
Qt::AnchorBottom, data);
data->maxSize = QWIDGETSIZE_MAX;
- data->skipInPreferred = 1;
// Save a reference to layout vertices
layoutFirstVertex[Vertical] = internalVertex(layout, Qt::AnchorTop);
@@ -2271,13 +2269,21 @@ QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin
layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]);
} else {
layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutLastVertex[orient]);
+ }
- // If maxSize is less then "infinite", that means there are other anchors
- // grouped together with this one. We can't ignore its maximum value so we
- // set back the variable to NULL to prevent the continue condition from being
- // satisfied in the loop below.
- if (layoutEdge->maxSize < QWIDGETSIZE_MAX)
- layoutEdge = 0;
+ // If maxSize is less then "infinite", that means there are other anchors
+ // grouped together with this one. We can't ignore its maximum value so we
+ // set back the variable to NULL to prevent the continue condition from being
+ // satisfied in the loop below.
+ const qreal expectedMax = layoutCentralVertex[orient] ? QWIDGETSIZE_MAX / 2 : QWIDGETSIZE_MAX;
+ qreal actualMax;
+ if (layoutEdge->from == layoutFirstVertex[orient]) {
+ actualMax = layoutEdge->maxSize;
+ } else {
+ actualMax = -layoutEdge->minSize;
+ }
+ if (actualMax != expectedMax) {
+ layoutEdge = 0;
}
// For each variable, create constraints based on size hints
@@ -2700,7 +2706,9 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint
//
for (int i = 0; i < variables.size(); ++i) {
AnchorData *ad = variables.at(i);
- if (ad->skipInPreferred)
+
+ // The layout original structure anchors are not relevant in preferred size calculation
+ if (ad->isLayoutAnchor)
continue;
QSimplexVariable *grower = new QSimplexVariable;
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index 2b365fb..8529e2e 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -124,8 +124,7 @@ struct AnchorData : public QSimplexVariable {
: QSimplexVariable(), from(0), to(0),
minSize(0), prefSize(0), maxSize(0),
sizeAtMinimum(0), sizeAtPreferred(0),
- sizeAtMaximum(0), item(0),
- graphicsAnchor(0), skipInPreferred(0),
+ sizeAtMaximum(0), item(0), graphicsAnchor(0),
type(Normal), isLayoutAnchor(false),
isCenterAnchor(false), orientation(0),
dependency(Independent) {}
@@ -169,7 +168,6 @@ struct AnchorData : public QSimplexVariable {
QGraphicsLayoutItem *item;
QGraphicsAnchor *graphicsAnchor;
- uint skipInPreferred : 1;
uint type : 2; // either Normal, Sequential or Parallel
uint isLayoutAnchor : 1; // if this anchor is an internal layout anchor
uint isCenterAnchor : 1;
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 3f6dff2..bb45e7e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -52,7 +52,7 @@
painting implementation and item interaction through its event handlers.
QGraphicsItem is part of \l{The Graphics View Framework}
- \img graphicsview-items.png
+ \image graphicsview-items.png
For convenience, Qt provides a set of standard graphics items for the most
common shapes. These are:
@@ -378,14 +378,14 @@
it's parent if it's z-value is negative. This flag enables setZValue() to
toggle ItemStacksBehindParent.
- \value ItemIsPanel. The item is a panel. A panel provides activation and
+ \value ItemIsPanel The item is a panel. A panel provides activation and
contained focus handling. Only one panel can be active at a time (see
QGraphicsItem::isActive()). When no panel is active, QGraphicsScene
activates all non-panel items. Window items (i.e.,
QGraphicsItem::isWindow() returns true) are panels. This flag was
introduced in Qt 4.6.
- \omitvalue ItemIsFocusScope Internal only (for now).
+ \omitvalue ItemIsFocusScope \omit Internal only (for now). \endomit
\value ItemSendsScenePositionChanges The item enables itemChange()
notifications for ItemScenePositionHasChanged. For performance reasons,
@@ -755,7 +755,6 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch
case QGraphicsItem::ItemClipsChildrenToShape:
flag = AncestorClipsChildren;
enabled = flags & QGraphicsItem::ItemClipsChildrenToShape;
- invalidateCachedClipPathRecursively(/*childrenOnly=*/true);
break;
case QGraphicsItem::ItemIgnoresTransformations:
flag = AncestorIgnoresTransformations;
@@ -1104,9 +1103,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
parent->itemChange(QGraphicsItem::ItemChildAddedChange, thisPointerVariant);
if (scene) {
if (!implicitUpdate)
- scene->d_func()->markDirty(q_ptr, QRect(),
- /*invalidateChildren=*/false,
- /*maybeDirtyClipPath=*/true);
+ scene->d_func()->markDirty(q_ptr);
// Re-enable scene pos notifications for new ancestors
if (scenePosDescendants || (flags & QGraphicsItem::ItemSendsScenePositionChanges))
@@ -1147,11 +1144,8 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
setEnabledHelper(true, /* explicit = */ false);
// If the item is being deleted, the whole scene will be updated.
- if (scene) {
- scene->d_func()->markDirty(q_ptr, QRect(),
- /*invalidateChildren=*/false,
- /*maybeDirtyClipPath=*/true);
- }
+ if (scene)
+ scene->d_func()->markDirty(q_ptr);
}
}
@@ -1240,7 +1234,7 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con
const QTransform reverseMap = worldTransform.inverted();
const QVector<QRect> exposedRects(exposedRegion.rects());
for (int i = 0; i < exposedRects.size(); ++i) {
- option->exposedRect |= reverseMap.mapRect(exposedRects.at(i));
+ option->exposedRect |= reverseMap.mapRect(QRectF(exposedRects.at(i)));
if (option->exposedRect.contains(brect))
break;
}
@@ -1732,9 +1726,6 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
d_ptr->updateAncestorFlag(ItemClipsChildrenToShape);
}
- if ((flags & ItemClipsToShape) != (oldFlags & ItemClipsToShape))
- d_ptr->invalidateCachedClipPath();
-
if ((flags & ItemIgnoresTransformations) != (oldFlags & ItemIgnoresTransformations)) {
// Item children clipping changes. Propagate the ancestor flag to
// all children.
@@ -1777,9 +1768,7 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
else
d_ptr->scene->d_func()->unregisterScenePosItem(this);
}
- d_ptr->scene->d_func()->markDirty(this, QRectF(),
- /*invalidateChildren=*/true,
- /*maybeDirtyClipPath*/true);
+ d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true);
}
// Notify change.
@@ -2127,12 +2116,8 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
QGraphicsItemCache *c = (QGraphicsItemCache *)qVariantValue<void *>(extra(ExtraCacheData));
if (c)
c->purge();
- if (scene) {
- scene->d_func()->markDirty(q_ptr, QRectF(),
- /*invalidateChildren=*/false,
- /*maybeDirtyClipPath=*/false,
- /*force=*/true);
- }
+ if (scene)
+ scene->d_func()->markDirty(q_ptr, QRectF(), /*invalidateChildren=*/false, /*force=*/true);
}
// Certain properties are dropped as an item becomes invisible.
@@ -2542,7 +2527,6 @@ void QGraphicsItem::setOpacity(qreal opacity)
#endif //QT_NO_GRAPHICSEFFECT
d_ptr->scene->d_func()->markDirty(this, QRectF(),
/*invalidateChildren=*/true,
- /*maybeDirtyClipPath=*/false,
/*force=*/false,
/*ignoreOpacity=*/true);
}
@@ -2590,8 +2574,11 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
d_ptr->graphicsEffect = 0;
if (oldEffectPrivate) {
oldEffectPrivate->setGraphicsEffectSource(0); // deletes the current source.
- if (d_ptr->scene) // Update the views directly.
- d_ptr->scene->d_func()->markDirty(this, QRectF(), false, false, false, false, true);
+ if (d_ptr->scene) { // Update the views directly.
+ d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/false,
+ /*force=*/false, /*ignoreOpacity=*/false,
+ /*removeItemFromScene=*/true);
+ }
}
} else {
// Set new effect.
@@ -3399,7 +3386,6 @@ void QGraphicsItemPrivate::setPosHelper(const QPointF &pos)
{
Q_Q(QGraphicsItem);
inSetPosHelper = 1;
- updateCachedClipPathFromSetPosHelper(pos);
if (scene)
q->prepareGeometryChange();
QPointF oldPos = this->pos;
@@ -4535,22 +4521,12 @@ bool QGraphicsItem::isClipped() const
QPainterPath QGraphicsItem::clipPath() const
{
Q_D(const QGraphicsItem);
- if (!d->dirtyClipPath)
- return d->emptyClipPath ? QPainterPath() : d->cachedClipPath;
-
- if (!isClipped()) {
- d_ptr->setCachedClipPath(QPainterPath());
- return d->cachedClipPath;
- }
+ if (!isClipped())
+ return QPainterPath();
const QRectF thisBoundingRect(boundingRect());
- if (thisBoundingRect.isEmpty()) {
- if (d_ptr->flags & ItemClipsChildrenToShape)
- d_ptr->setEmptyCachedClipPathRecursively();
- else
- d_ptr->setEmptyCachedClipPath();
+ if (thisBoundingRect.isEmpty())
return QPainterPath();
- }
QPainterPath clip;
// Start with the item's bounding rect.
@@ -4561,40 +4537,18 @@ QPainterPath QGraphicsItem::clipPath() const
const QGraphicsItem *lastParent = this;
// Intersect any in-between clips starting at the top and moving downwards.
- bool foundValidClipPath = false;
while ((parent = parent->d_ptr->parent)) {
if (parent->d_ptr->flags & ItemClipsChildrenToShape) {
// Map clip to the current parent and intersect with its shape/clipPath
clip = lastParent->itemTransform(parent).map(clip);
- if ((foundValidClipPath = !parent->d_ptr->dirtyClipPath && parent->isClipped())) {
- if (parent->d_ptr->emptyClipPath) {
- if (d_ptr->flags & ItemClipsChildrenToShape)
- d_ptr->setEmptyCachedClipPathRecursively();
- else
- d_ptr->setEmptyCachedClipPath();
- return QPainterPath();
- }
- clip = clip.intersected(parent->d_ptr->cachedClipPath);
- if (!(parent->d_ptr->flags & ItemClipsToShape))
- clip = clip.intersected(parent->shape());
- } else {
- clip = clip.intersected(parent->shape());
- }
-
- if (clip.isEmpty()) {
- if (d_ptr->flags & ItemClipsChildrenToShape)
- d_ptr->setEmptyCachedClipPathRecursively();
- else
- d_ptr->setEmptyCachedClipPath();
+ clip = clip.intersected(parent->shape());
+ if (clip.isEmpty())
return clip;
- }
lastParent = parent;
}
- if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
- || foundValidClipPath) {
+ if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren))
break;
- }
}
if (lastParent != this) {
@@ -4607,7 +4561,6 @@ QPainterPath QGraphicsItem::clipPath() const
if (d->flags & ItemClipsToShape)
clip = clip.intersected(shape());
- d_ptr->setCachedClipPath(clip);
return clip;
}
@@ -5026,15 +4979,14 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity)
\internal
Returns true if we can discard an update request; otherwise false.
*/
-bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, bool ignoreVisibleBit,
- bool ignoreDirtyBit, bool ignoreOpacity) const
+bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreVisibleBit, bool ignoreDirtyBit,
+ bool ignoreOpacity) const
{
// No scene, or if the scene is updating everything, means we have nothing
// to do. The only exception is if the scene tracks the growing scene rect.
return !scene
|| (!visible && !ignoreVisibleBit && !this->ignoreVisible)
|| (!ignoreDirtyBit && fullUpdatePending)
- || (!ignoreClipping && (childrenClippedToShape() && isClippedAway()))
|| (!ignoreOpacity && !this->ignoreOpacity && childrenCombineOpacity() && isFullyTransparent());
}
@@ -5169,109 +5121,6 @@ void QGraphicsItemPrivate::removeExtraItemCache()
unsetExtra(ExtraCacheData);
}
-void QGraphicsItemPrivate::setEmptyCachedClipPathRecursively(const QRectF &emptyIfOutsideThisRect)
-{
- setEmptyCachedClipPath();
-
- const bool checkRect = !emptyIfOutsideThisRect.isNull()
- && !(flags & QGraphicsItem::ItemClipsChildrenToShape);
- for (int i = 0; i < children.size(); ++i) {
- if (!checkRect) {
- children.at(i)->d_ptr->setEmptyCachedClipPathRecursively();
- continue;
- }
-
- QGraphicsItem *child = children.at(i);
- const QRectF rect = child->mapRectFromParent(emptyIfOutsideThisRect);
- if (rect.intersects(child->boundingRect()))
- child->d_ptr->invalidateCachedClipPathRecursively(false, rect);
- else
- child->d_ptr->setEmptyCachedClipPathRecursively(rect);
- }
-}
-
-void QGraphicsItemPrivate::invalidateCachedClipPathRecursively(bool childrenOnly, const QRectF &emptyIfOutsideThisRect)
-{
- if (!childrenOnly)
- invalidateCachedClipPath();
-
- const bool checkRect = !emptyIfOutsideThisRect.isNull();
- for (int i = 0; i < children.size(); ++i) {
- if (!checkRect) {
- children.at(i)->d_ptr->invalidateCachedClipPathRecursively(false);
- continue;
- }
-
- QGraphicsItem *child = children.at(i);
- const QRectF rect = child->mapRectFromParent(emptyIfOutsideThisRect);
- if (rect.intersects(child->boundingRect()))
- child->d_ptr->invalidateCachedClipPathRecursively(false, rect);
- else
- child->d_ptr->setEmptyCachedClipPathRecursively(rect);
- }
-}
-
-void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(const QPointF &newPos)
-{
- Q_ASSERT(inSetPosHelper);
-
- if (inDestructor || !(ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren))
- return; // Not clipped by any ancestor.
-
- // Find closest clip ancestor and transform.
- Q_Q(QGraphicsItem);
- // COMBINE
- QTransform thisToParentTransform = QTransform::fromTranslate(newPos.x(), newPos.y());
- if (transformData)
- thisToParentTransform = transformData->computedFullTransform(&thisToParentTransform);
- QGraphicsItem *clipParent = parent;
- while (clipParent && !clipParent->d_ptr->inDestructor && !(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)) {
- thisToParentTransform *= clipParent->d_ptr->transformToParent();
- clipParent = clipParent->d_ptr->parent;
- }
-
- // Ensure no parents are currently being deleted. This can only
- // happen if the item is moved by a dying ancestor.
- QGraphicsItem *p = clipParent;
- while (p) {
- if (p->d_ptr->inDestructor)
- return;
- p = p->d_ptr->parent;
- }
-
- // From here everything is calculated in clip parent's coordinates.
- const QRectF parentBoundingRect(clipParent->boundingRect());
- const QRectF thisBoundingRect(thisToParentTransform.mapRect(q->boundingRect()));
-
- if (!parentBoundingRect.intersects(thisBoundingRect)) {
- // Item is moved outside the clip parent's bounding rect,
- // i.e. it is fully clipped and the clip path is empty.
- if (flags & QGraphicsItem::ItemClipsChildrenToShape)
- setEmptyCachedClipPathRecursively();
- else
- setEmptyCachedClipPathRecursively(thisToParentTransform.inverted().mapRect(parentBoundingRect));
- return;
- }
-
- const QPainterPath parentClip(clipParent->isClipped() ? clipParent->clipPath() : clipParent->shape());
- if (parentClip.contains(thisBoundingRect))
- return; // Item is inside the clip parent's shape. No update required.
-
- const QRectF parentClipRect(parentClip.controlPointRect());
- if (!parentClipRect.intersects(thisBoundingRect)) {
- // Item is moved outside the clip parent's shape,
- // i.e. it is fully clipped and the clip path is empty.
- if (flags & QGraphicsItem::ItemClipsChildrenToShape)
- setEmptyCachedClipPathRecursively();
- else
- setEmptyCachedClipPathRecursively(thisToParentTransform.inverted().mapRect(parentClipRect));
- } else {
- // Item is partially inside the clip parent's shape,
- // i.e. the cached clip path must be invalidated.
- invalidateCachedClipPathRecursively(false, thisToParentTransform.inverted().mapRect(parentClipRect));
- }
-}
-
// Traverses all the ancestors up to the top-level and updates the pointer to
// always point to the top-most item that has a dirty scene transform.
// It then backtracks to the top-most dirty item and start calculating the
@@ -7288,9 +7137,7 @@ void QGraphicsItem::prepareGeometryChange()
QGraphicsScenePrivate *scenePrivate = d_ptr->scene->d_func();
scenePrivate->index->prepareBoundingRectChange(this);
- scenePrivate->markDirty(this, QRectF(),
- /*invalidateChildren=*/true,
- /*maybeDirtyClipPath=*/!d_ptr->inSetPosHelper);
+ scenePrivate->markDirty(this, QRectF(), /*invalidateChildren=*/true);
// For compatibility reasons, we have to update the item's old geometry
// if someone is connected to the changed signal or the scene has no views.
@@ -7313,16 +7160,6 @@ void QGraphicsItem::prepareGeometryChange()
// ### Only do this if the parent's effect applies to the entire subtree.
parent->d_ptr->notifyBoundingRectChanged = 1;
}
-
- if (d_ptr->inSetPosHelper)
- return;
-
- if (d_ptr->flags & ItemClipsChildrenToShape
- || d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) {
- d_ptr->invalidateCachedClipPathRecursively();
- } else {
- d_ptr->invalidateCachedClipPath();
- }
}
/*!
@@ -9604,9 +9441,11 @@ void QGraphicsTextItem::setDefaultTextColor(const QColor &col)
{
QTextControl *c = dd->textControl();
QPalette pal = c->palette();
+ QColor old = pal.color(QPalette::Text);
pal.setColor(QPalette::Text, col);
c->setPalette(pal);
- update();
+ if (old != col)
+ update();
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 75c8246..d6ffb1a 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -152,8 +152,6 @@ public:
dirty(0),
dirtyChildren(0),
localCollisionHack(0),
- dirtyClipPath(1),
- emptyClipPath(0),
inSetPosHelper(0),
needSortChildren(1), // ### can be 0 by default?
allChildrenDirty(0),
@@ -221,7 +219,7 @@ public:
void appendGraphicsTransform(QGraphicsTransform *t);
void setVisibleHelper(bool newVisible, bool explicitly, bool update = true);
void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true);
- bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false,
+ bool discardUpdateRequest(bool ignoreVisibleBit = false,
bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
int depth() const;
#ifndef QT_NO_GRAPHICSEFFECT
@@ -307,26 +305,6 @@ public:
QGraphicsItemCache *extraItemCache() const;
void removeExtraItemCache();
- inline void setCachedClipPath(const QPainterPath &path)
- {
- cachedClipPath = path;
- dirtyClipPath = 0;
- emptyClipPath = 0;
- }
-
- inline void setEmptyCachedClipPath()
- {
- emptyClipPath = 1;
- dirtyClipPath = 0;
- }
-
- void setEmptyCachedClipPathRecursively(const QRectF &emptyIfOutsideThisRect = QRectF());
-
- inline void invalidateCachedClipPath()
- { /*static int count = 0 ;qWarning("%i", ++count);*/ dirtyClipPath = 1; emptyClipPath = 0; }
-
- void invalidateCachedClipPathRecursively(bool childrenOnly = false, const QRectF &emptyIfOutsideThisRect = QRectF());
- void updateCachedClipPathFromSetPosHelper(const QPointF &newPos);
void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem);
inline void ensureSceneTransform()
{
@@ -409,17 +387,12 @@ public:
return true;
}
- inline bool isClippedAway() const
- { return !dirtyClipPath && q_func()->isClipped() && (emptyClipPath || cachedClipPath.isEmpty()); }
-
inline bool childrenClippedToShape() const
{ return (flags & QGraphicsItem::ItemClipsChildrenToShape) || children.isEmpty(); }
inline bool isInvisible() const
{
- return !visible
- || (childrenClippedToShape() && isClippedAway())
- || (childrenCombineOpacity() && isFullyTransparent());
+ return !visible || (childrenCombineOpacity() && isFullyTransparent());
}
void setFocusHelper(Qt::FocusReason focusReason, bool climb);
@@ -435,7 +408,6 @@ public:
inline void sendScenePosChange();
virtual void siblingOrderChange();
- QPainterPath cachedClipPath;
QRectF childrenBoundingRect;
QRectF needsRepaint;
QMap<QWidget *, QRect> paintedViewBoundingRects;
@@ -480,8 +452,6 @@ public:
quint32 dirty : 1;
quint32 dirtyChildren : 1;
quint32 localCollisionHack : 1;
- quint32 dirtyClipPath : 1;
- quint32 emptyClipPath : 1;
quint32 inSetPosHelper : 1;
quint32 needSortChildren : 1;
quint32 allChildrenDirty : 1;
diff --git a/src/gui/graphicsview/qgraphicsitemanimation.cpp b/src/gui/graphicsview/qgraphicsitemanimation.cpp
index be2f300..b67ee2e 100644
--- a/src/gui/graphicsview/qgraphicsitemanimation.cpp
+++ b/src/gui/graphicsview/qgraphicsitemanimation.cpp
@@ -45,6 +45,7 @@
support for QGraphicsItem.
\since 4.2
\ingroup graphicsview-api
+ \deprecated
The QGraphicsItemAnimation class animates a QGraphicsItem. You can
schedule changes to the item's transformation matrix at
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 10d251d..8777cdc 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -555,7 +555,8 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
// Clear focus on the item to remove any reference in the focusWidget chain.
item->clearFocus();
- markDirty(item, QRectF(), false, false, false, false, /*removingItemFromScene=*/true);
+ markDirty(item, QRectF(), /*invalidateChildren=*/false, /*force=*/false,
+ /*ignoreOpacity=*/false, /*removingItemFromScene=*/true);
if (item->d_ptr->inDestructor) {
// The item is actually in its destructor, we call the special method in the index.
@@ -4759,15 +4760,13 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q
}
void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, bool invalidateChildren,
- bool maybeDirtyClipPath, bool force, bool ignoreOpacity,
- bool removingItemFromScene)
+ bool force, bool ignoreOpacity, bool removingItemFromScene)
{
Q_ASSERT(item);
if (updateAll)
return;
- if (item->d_ptr->discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath,
- /*ignoreVisibleBit=*/force,
+ if (item->d_ptr->discardUpdateRequest(/*ignoreVisibleBit=*/force,
/*ignoreDirtyBit=*/removingItemFromScene || invalidateChildren,
/*ignoreOpacity=*/ignoreOpacity)) {
if (item->d_ptr->dirty) {
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index fdec466..69e4d5b 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -78,7 +78,7 @@ class QGraphicsSceneIndex;
class QGraphicsView;
class QGraphicsWidget;
-class QGraphicsScenePrivate : public QObjectPrivate
+class Q_AUTOTEST_EXPORT QGraphicsScenePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QGraphicsScene)
public:
@@ -222,8 +222,7 @@ public:
QRegion *, QWidget *, qreal, const QTransform *const, bool, bool);
void markDirty(QGraphicsItem *item, const QRectF &rect = QRectF(), bool invalidateChildren = false,
- bool maybeDirtyClipPath = false, bool force = false, bool ignoreOpacity = false,
- bool removingItemFromScene = false);
+ bool force = false, bool ignoreOpacity = false, bool removingItemFromScene = false);
void processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren = false,
qreal parentOpacity = qreal(1.0));
@@ -266,6 +265,7 @@ public:
{
if (needSortTopLevelItems) {
qSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf);
+ topLevelSequentialOrdering = false;
needSortTopLevelItems = false;
}
}
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h
index 762cad1..cd161ad 100644
--- a/src/gui/graphicsview/qgraphicsview_p.h
+++ b/src/gui/graphicsview/qgraphicsview_p.h
@@ -172,10 +172,17 @@ public:
inline void dispatchPendingUpdateRequests()
{
+#ifndef Q_WS_MAC
+ // QWidget::update() works slightly different on the Mac; it's not part of
+ // our backing store so it needs special threatment.
if (qt_widget_private(viewport)->paintOnScreen())
QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest);
else
QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest);
+#else
+ QCoreApplication::processEvents(QEventLoop::AllEvents | QEventLoop::ExcludeSocketNotifiers
+ | QEventLoop::ExcludeUserInputEvents);
+#endif
}
bool updateRect(const QRect &rect);
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index d9c65bb..f6c06d5 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -385,8 +385,6 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
QSizeF oldSize = size();
QGraphicsLayoutItem::setGeometry(newGeom);
- wd->invalidateCachedClipPathRecursively();
-
// Send resize event
bool resized = newGeom.size() != oldSize;
if (resized) {
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 7c24002..4215f97 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -54,4 +54,4 @@ DEFINES += Q_INTERNAL_QAPP_SRC
symbian:TARGET.UID3=0x2001B2DD
# ro-section in gui can exceed default allocated space, so more rw-section little further
-symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000"
+symbian-sbsv2: QMAKE_LFLAGS.ARMCC += --rw-base 0x800000"
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 15af7a2..ad9bdd0 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -249,21 +249,19 @@ QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName,
const QIconDirInfo &dirInfo = subDirs.at(i);
QString subdir = dirInfo.path;
QDir currentDir(contentDir + subdir);
-
- if (dirInfo.type == QIconDirInfo::Scalable && m_supportsSvg &&
- currentDir.exists(iconName + svgext)) {
- ScalableEntry *iconEntry = new ScalableEntry;
- iconEntry->dir = dirInfo;
- iconEntry->filename = currentDir.filePath(iconName + svgext);
- entries.append(iconEntry);
-
- } else if (currentDir.exists(iconName + pngext)) {
+ if (currentDir.exists(iconName + pngext)) {
PixmapEntry *iconEntry = new PixmapEntry;
iconEntry->dir = dirInfo;
iconEntry->filename = currentDir.filePath(iconName + pngext);
// Notice we ensure that pixmap entries allways come before
// scalable to preserve search order afterwards
entries.prepend(iconEntry);
+ } else if (m_supportsSvg &&
+ currentDir.exists(iconName + svgext)) {
+ ScalableEntry *iconEntry = new ScalableEntry;
+ iconEntry->dir = dirInfo;
+ iconEntry->filename = currentDir.filePath(iconName + svgext);
+ entries.append(iconEntry);
}
}
@@ -444,10 +442,8 @@ QIconLoaderEngineEntry *QIconLoaderEngine::entryForSize(const QSize &size)
/*
* Returns the actual icon size. For scalable svg's this is equivalent
- * to the requested size. Otherwise the closest match is returned.
- *
- * todo: the spec is a bit fuzzy in this area, but we should probably
- * allow scaling down pixmap icons as well.
+ * to the requested size. Otherwise the closest match is returned but
+ * we can never return a bigger size than the requested size.
*
*/
QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
@@ -460,8 +456,10 @@ QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
const QIconDirInfo &dir = entry->dir;
if (dir.type == QIconDirInfo::Scalable)
return size;
- else
- return QSize(dir.size, dir.size);
+ else {
+ int result = qMin<int>(dir.size, qMin(size.width(), size.height()));
+ return QSize(result, result);
+ }
}
return QIconEngineV2::actualSize(size, mode, state);
}
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index 35322e9..650075b 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -55,20 +55,11 @@ Q_GUI_EXPORT _qt_pixmap_cleanup_hook_64 qt_pixmap_cleanup_hook_64 = 0;
Q_GUI_EXPORT _qt_image_cleanup_hook qt_image_cleanup_hook = 0;
Q_GUI_EXPORT _qt_image_cleanup_hook_64 qt_image_cleanup_hook_64 = 0;
-
-QImagePixmapCleanupHooks* qt_image_and_pixmap_cleanup_hooks = 0;
-
-
-QImagePixmapCleanupHooks::QImagePixmapCleanupHooks()
-{
- qt_image_and_pixmap_cleanup_hooks = this;
-}
+Q_GLOBAL_STATIC(QImagePixmapCleanupHooks, qt_image_and_pixmap_cleanup_hooks)
QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance()
{
- if (!qt_image_and_pixmap_cleanup_hooks)
- qt_image_and_pixmap_cleanup_hooks = new QImagePixmapCleanupHooks;
- return qt_image_and_pixmap_cleanup_hooks;
+ return qt_image_and_pixmap_cleanup_hooks();
}
void QImagePixmapCleanupHooks::addPixmapModificationHook(_qt_pixmap_cleanup_hook_pm hook)
@@ -105,9 +96,8 @@ void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook)
void QImagePixmapCleanupHooks::executePixmapModificationHooks(QPixmap* pm)
{
- Q_ASSERT(qt_image_and_pixmap_cleanup_hooks);
- for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks->pixmapModificationHooks.count(); ++i)
- qt_image_and_pixmap_cleanup_hooks->pixmapModificationHooks[i](pm);
+ for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->pixmapModificationHooks.count(); ++i)
+ qt_image_and_pixmap_cleanup_hooks()->pixmapModificationHooks[i](pm);
if (qt_pixmap_cleanup_hook_64)
qt_pixmap_cleanup_hook_64(pm->cacheKey());
@@ -115,9 +105,8 @@ void QImagePixmapCleanupHooks::executePixmapModificationHooks(QPixmap* pm)
void QImagePixmapCleanupHooks::executePixmapDestructionHooks(QPixmap* pm)
{
- Q_ASSERT(qt_image_and_pixmap_cleanup_hooks);
- for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks->pixmapDestructionHooks.count(); ++i)
- qt_image_and_pixmap_cleanup_hooks->pixmapDestructionHooks[i](pm);
+ for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->pixmapDestructionHooks.count(); ++i)
+ qt_image_and_pixmap_cleanup_hooks()->pixmapDestructionHooks[i](pm);
if (qt_pixmap_cleanup_hook_64)
qt_pixmap_cleanup_hook_64(pm->cacheKey());
@@ -125,9 +114,8 @@ void QImagePixmapCleanupHooks::executePixmapDestructionHooks(QPixmap* pm)
void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)
{
- Q_ASSERT(qt_image_and_pixmap_cleanup_hooks);
- for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks->imageHooks.count(); ++i)
- qt_image_and_pixmap_cleanup_hooks->imageHooks[i](key);
+ for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->imageHooks.count(); ++i)
+ qt_image_and_pixmap_cleanup_hooks()->imageHooks[i](key);
if (qt_image_cleanup_hook_64)
qt_image_cleanup_hook_64(key);
diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h
index 9e490d7..dfc5f28 100644
--- a/src/gui/image/qimagepixmapcleanuphooks_p.h
+++ b/src/gui/image/qimagepixmapcleanuphooks_p.h
@@ -61,13 +61,10 @@ typedef void (*_qt_image_cleanup_hook_64)(qint64);
typedef void (*_qt_pixmap_cleanup_hook_pm)(QPixmap*);
class QImagePixmapCleanupHooks;
-extern QImagePixmapCleanupHooks* qt_image_and_pixmap_cleanup_hooks;
class Q_GUI_EXPORT QImagePixmapCleanupHooks
{
public:
- QImagePixmapCleanupHooks();
-
static QImagePixmapCleanupHooks *instance();
static void enableCleanupHooks(const QImage &image);
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 17baa50..dc33ade 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -977,4 +977,9 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
}
}
+QPixmapData *QS60PixmapData::createCompatiblePixmapData() const
+{
+ return new QS60PixmapData(pixelType());
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index b1b5824..8631ebd 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -87,6 +87,8 @@ public:
QS60PixmapData(PixelType type);
~QS60PixmapData();
+ QPixmapData *createCompatiblePixmapData() const;
+
void resize(int width, int height);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
void copy(const QPixmapData *data, const QRect &rect);
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 23bef12..ad15655 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -96,6 +96,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
autoScrollMargin(16),
autoScrollCount(0),
shouldScrollToCurrentOnShow(false),
+ shouldClearStatusTip(false),
alternatingColors(false),
textElideMode(Qt::ElideRight),
verticalScrollMode(QAbstractItemView::ScrollPerItem),
@@ -138,10 +139,22 @@ void QAbstractItemViewPrivate::init()
#endif
}
+void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index)
+{
+ Q_Q(QAbstractItemView);
+ if (hover == index)
+ return;
+
+ q->update(hover); //update the old one
+ hover = index;
+ q->update(hover); //update the new one
+}
+
void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index)
{
//we take a persistent model index because the model might change by emitting signals
Q_Q(QAbstractItemView);
+ setHoverIndex(index);
if (viewportEnteredNeeded || enteredIndex != index) {
viewportEnteredNeeded = false;
@@ -149,14 +162,15 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index
emit q->entered(index);
#ifndef QT_NO_STATUSTIP
QString statustip = model->data(index, Qt::StatusTipRole).toString();
- if (parent && !statustip.isEmpty()) {
+ if (parent && (shouldClearStatusTip || !statustip.isEmpty())) {
QStatusTipEvent tip(statustip);
QApplication::sendEvent(parent, &tip);
+ shouldClearStatusTip = !statustip.isEmpty();
}
#endif
} else {
#ifndef QT_NO_STATUSTIP
- if (parent) {
+ if (parent && shouldClearStatusTip) {
QString emptyString;
QStatusTipEvent tip( emptyString );
QApplication::sendEvent(parent, &tip);
@@ -1536,26 +1550,25 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
{
Q_D(QAbstractItemView);
switch (event->type()) {
- case QEvent::HoverEnter: {
- QHoverEvent *he = static_cast<QHoverEvent*>(event);
- d->hover = indexAt(he->pos());
- update(d->hover);
- break; }
- case QEvent::HoverLeave: {
- update(d->hover); // update old
- d->hover = QModelIndex();
- break; }
- case QEvent::HoverMove: {
- QHoverEvent *he = static_cast<QHoverEvent*>(event);
- QModelIndex old = d->hover;
- d->hover = indexAt(he->pos());
- if (d->hover != old)
- d->viewport->update(visualRect(old)|visualRect(d->hover));
- break; }
+ case QEvent::HoverMove:
+ case QEvent::HoverEnter:
+ d->setHoverIndex(indexAt(static_cast<QHoverEvent*>(event)->pos()));
+ break;
+ case QEvent::HoverLeave:
+ d->setHoverIndex(QModelIndex());
+ break;
case QEvent::Enter:
d->viewportEnteredNeeded = true;
break;
case QEvent::Leave:
+ #ifndef QT_NO_STATUSTIP
+ if (d->shouldClearStatusTip && d->parent) {
+ QString empty;
+ QStatusTipEvent tip(empty);
+ QApplication::sendEvent(d->parent, &tip);
+ d->shouldClearStatusTip = false;
+ }
+ #endif
d->enteredIndex = QModelIndex();
break;
case QEvent::ToolTip:
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index c691f61..0b5cfbe 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -152,6 +152,8 @@ public:
const QEvent *event) const;
virtual void selectAll(QItemSelectionModel::SelectionFlags command);
+ void setHoverIndex(const QPersistentModelIndex &index);
+
void checkMouseMove(const QPersistentModelIndex &index);
inline void checkMouseMove(const QPoint &pos) { checkMouseMove(q_func()->indexAt(pos)); }
@@ -394,6 +396,7 @@ public:
int autoScrollMargin;
int autoScrollCount;
bool shouldScrollToCurrentOnShow; //used to know if we should scroll to current on show event
+ bool shouldClearStatusTip; //if there is a statustip currently shown that need to be cleared when leaving.
bool alternatingColors;
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 5df8481..6f0fba6 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -1913,7 +1913,6 @@ void QHeaderView::initializeSections(int start, int end)
Q_ASSERT(start >= 0);
Q_ASSERT(end >= 0);
- d->executePostedLayout();
d->invalidateCachedSizeHint();
if (end + 1 < d->sectionCount) {
@@ -1939,11 +1938,25 @@ void QHeaderView::initializeSections(int start, int end)
d->sectionCount = end + 1;
if (!d->logicalIndices.isEmpty()) {
- d->logicalIndices.resize(d->sectionCount);
- d->visualIndices.resize(d->sectionCount);
- for (int i = start; i < d->sectionCount; ++i){
- d->logicalIndices[i] = i;
- d->visualIndices[i] = i;
+ if (oldCount <= d->sectionCount) {
+ d->logicalIndices.resize(d->sectionCount);
+ d->visualIndices.resize(d->sectionCount);
+ for (int i = oldCount; i < d->sectionCount; ++i) {
+ d->logicalIndices[i] = i;
+ d->visualIndices[i] = i;
+ }
+ } else {
+ int j = 0;
+ for (int i = 0; i < oldCount; ++i) {
+ int v = d->logicalIndices.at(i);
+ if (v < d->sectionCount) {
+ d->logicalIndices[j] = v;
+ d->visualIndices[v] = j;
+ j++;
+ }
+ }
+ d->logicalIndices.resize(d->sectionCount);
+ d->visualIndices.resize(d->sectionCount);
}
}
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 052308c..d03cdd3 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -966,15 +966,19 @@ void QListView::paintEvent(QPaintEvent *e)
bool alternateBase = false;
int previousRow = -2; // trigger the alternateBase adjustment on first pass
+ int maxSize = (flow() == TopToBottom)
+ ? qMax(viewport()->size().width(), d->contentsSize().width()) - 2 * d->spacing()
+ : qMax(viewport()->size().height(), d->contentsSize().height()) - 2 * d->spacing();
+
QVector<QModelIndex>::const_iterator end = toBeRendered.constEnd();
for (QVector<QModelIndex>::const_iterator it = toBeRendered.constBegin(); it != end; ++it) {
Q_ASSERT((*it).isValid());
option.rect = visualRect(*it);
if (flow() == TopToBottom)
- option.rect.setWidth(qMin(d->contentsSize().width() - 2 * d->spacing(), option.rect.width()));
+ option.rect.setWidth(qMin(maxSize, option.rect.width()));
else
- option.rect.setHeight(qMin(d->contentsSize().height() - 2 * d->spacing(), option.rect.height()));
+ option.rect.setHeight(qMin(maxSize, option.rect.height()));
option.state = state;
if (selections && selections->isSelected(*it))
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index f1ae3d2..fc82f30 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -1153,6 +1153,8 @@ void QSortFilterProxyModelPrivate::_q_sourceAboutToBeReset()
{
Q_Q(QSortFilterProxyModel);
q->beginResetModel();
+ invalidatePersistentIndexes();
+ clear_mapping();
}
void QSortFilterProxyModelPrivate::_q_sourceReset()
@@ -1470,6 +1472,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
{
Q_D(QSortFilterProxyModel);
+ beginResetModel();
+
disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex)));
@@ -1551,7 +1555,7 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
connect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
d->clear_mapping();
- reset();
+ endResetModel();
if (d->update_source_sort_column() && d->dynamic_sortfilter)
d->sort();
}
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index 02e5fff..d27e693 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -114,7 +114,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height)
}
} else if (old_height > span->height()) {
//remove the span from all the subspans lists that intersect the columns not covered anymore
- Index::iterator it_y = index.lowerBound(-span->bottom());
+ Index::iterator it_y = index.lowerBound(qMin(-span->bottom(), 0));
Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list
while (-it_y.key() <= span->top() + old_height -1) {
if (-it_y.key() > span->bottom()) {
@@ -1064,14 +1064,29 @@ QTableView::~QTableView()
void QTableView::setModel(QAbstractItemModel *model)
{
Q_D(QTableView);
- connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int)));
- connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),
- this, SLOT(_q_updateSpanInsertedColumns(QModelIndex,int,int)));
- connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
- this, SLOT(_q_updateSpanRemovedRows(QModelIndex,int,int)));
- connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
- this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int)));
+ if (model == d->model)
+ return;
+ //let's disconnect from the old model
+ if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
+ disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
+ this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int)));
+ disconnect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)),
+ this, SLOT(_q_updateSpanInsertedColumns(QModelIndex,int,int)));
+ disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
+ this, SLOT(_q_updateSpanRemovedRows(QModelIndex,int,int)));
+ disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
+ this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int)));
+ }
+ if (model) { //and connect to the new one
+ connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
+ this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int)));
+ connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),
+ this, SLOT(_q_updateSpanInsertedColumns(QModelIndex,int,int)));
+ connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
+ this, SLOT(_q_updateSpanRemovedRows(QModelIndex,int,int)));
+ connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
+ this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int)));
+ }
d->verticalHeader->setModel(model);
d->horizontalHeader->setModel(model);
QAbstractItemView::setModel(model);
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 8d50870b..3ad9fbb 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -215,6 +215,13 @@ void QTreeView::setModel(QAbstractItemModel *model)
Q_D(QTreeView);
if (model == d->model)
return;
+ if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
+ disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
+ this, SLOT(rowsRemoved(QModelIndex,int,int)));
+
+ disconnect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_modelAboutToBeReset()));
+ }
+
if (d->selectionModel) { // support row editing
disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
d->model, SLOT(submit()));
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index c133ae4..948ca79 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -1580,7 +1580,7 @@ void QTreeWidgetItem::setChildIndicatorPolicy(QTreeWidgetItem::ChildIndicatorPol
if (!view)
return;
- view->viewport()->update( view->d_func()->itemDecorationRect(view->d_func()->index(this)));
+ view->scheduleDelayedItemsLayout();
}
/*!
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 4764a2d..9f4cd0c 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -933,7 +933,8 @@ void QApplicationPrivate::initialize()
QApplicationPrivate::wheel_scroll_lines = 3;
#endif
- initializeMultitouch();
+ if (qt_is_gui_used)
+ initializeMultitouch();
}
/*!
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index 84da56e..22a0959 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -2449,7 +2449,7 @@ OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, Ap
switch(aeID) {
case kAEQuitApplication: {
extern bool qt_mac_quit_menu_item_enabled; // qmenu_mac.cpp
- if(!QApplicationPrivate::modalState() && qt_mac_quit_menu_item_enabled) {
+ if (qt_mac_quit_menu_item_enabled) {
QCloseEvent ev;
QApplication::sendSpontaneousEvent(app, &ev);
if(ev.isAccepted()) {
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index c7f0c00..89d961c 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -133,36 +133,46 @@ private:
TTimeIntervalMicroSeconds iDuration;
};
+static QS60Beep* qt_S60Beep = 0;
+
QS60Beep::~QS60Beep()
{
+ if (iToneUtil) {
+ switch (iState) {
+ case EBeepPlaying:
+ iToneUtil->CancelPlay();
+ break;
+ case EBeepNotPrepared:
+ iToneUtil->CancelPrepare();
+ break;
+ }
+ }
delete iToneUtil;
}
QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
{
- QS60Beep* self=new (ELeave) QS60Beep();
+ QS60Beep* self = new (ELeave) QS60Beep();
CleanupStack::PushL(self);
self->ConstructL(aFrequency, aDuration);
CleanupStack::Pop();
return self;
-};
+}
void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
{
- iToneUtil=CMdaAudioToneUtility::NewL(*this);
- iState=EBeepNotPrepared;
- iFrequency=aFrequency;
- iDuration=aDuration;
- iToneUtil->PrepareToPlayTone(iFrequency,iDuration);
+ iToneUtil = CMdaAudioToneUtility::NewL(*this);
+ iState = EBeepNotPrepared;
+ iFrequency = aFrequency;
+ iDuration = aDuration;
+ iToneUtil->PrepareToPlayTone(iFrequency, iDuration);
}
void QS60Beep::Play()
{
- if (iState != EBeepNotPrepared) {
- if (iState == EBeepPlaying) {
- iToneUtil->CancelPlay();
- iState = EBeepPrepared;
- }
+ if (iState == EBeepPlaying) {
+ iToneUtil->CancelPlay();
+ iState = EBeepPrepared;
}
iToneUtil->Play();
@@ -173,13 +183,14 @@ void QS60Beep::MatoPrepareComplete(TInt aError)
{
if (aError == KErrNone) {
iState = EBeepPrepared;
+ Play();
}
}
void QS60Beep::MatoPlayComplete(TInt aError)
{
Q_UNUSED(aError);
- iState=EBeepPrepared;
+ iState = EBeepPrepared;
}
@@ -712,7 +723,7 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod
Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers);
QKeyEventEx qKeyEvent(type == EEventKeyUp ? QEvent::KeyRelease : QEvent::KeyPress, keyCode,
mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods),
- false, 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers);
+ (keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers);
// WId wid = reinterpret_cast<RWindowGroup *>(keyEvent.Handle())->Child();
// if (!wid)
// Could happen if window isn't shown yet.
@@ -908,6 +919,8 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
}
QApplication::setActiveWindow(qwidget->window());
+ qwidget->d_func()->setWindowIcon_sys(true);
+ qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
#ifdef Q_WS_S60
// If widget is fullscreen, hide status pane and button container
// otherwise show them.
@@ -945,7 +958,10 @@ void QSymbianControl::HandleResourceChange(int resourceType)
TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
SetExtent(r.iTl, r.Size());
}
- qwidget->d_func()->setWindowIcon_sys(true);
+ if (IsFocused() && IsVisible()) {
+ qwidget->d_func()->setWindowIcon_sys(true);
+ qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
+ }
break;
case KUidValueCoeFontChangeEvent:
// font change event
@@ -1221,6 +1237,10 @@ void qt_init(QApplicationPrivate * /* priv */, int)
*****************************************************************************/
void qt_cleanup()
{
+ if(qt_S60Beep) {
+ delete qt_S60Beep;
+ qt_S60Beep = 0;
+ }
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
// S60 structure and window server session are freed in eventdispatcher destructor as they are needed there
@@ -1462,14 +1482,13 @@ void QApplication::setCursorFlashTime(int msecs)
void QApplication::beep()
{
- TInt frequency=440;
- TTimeIntervalMicroSeconds duration(500000);
- QS60Beep* beep=NULL;
- TRAPD(err, beep=QS60Beep::NewL(frequency, duration));
- if (!err)
- beep->Play();
- delete beep;
- beep=NULL;
+ if (!qt_S60Beep) {
+ TInt frequency = 880;
+ TTimeIntervalMicroSeconds duration(500000);
+ TRAP_IGNORE(qt_S60Beep=QS60Beep::NewL(frequency, duration));
+ }
+ if (qt_S60Beep)
+ qt_S60Beep->Play();
}
/*!
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 05e75a2..b677228 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -243,8 +243,12 @@ static PtrWTGet ptrWTGet = 0;
static PACKET localPacketBuf[QT_TABLET_NPACKETQSIZE]; // our own tablet packet queue.
HCTX qt_tablet_context; // the hardware context for the tablet (like a window handle)
bool qt_tablet_tilt_support;
-static void tabletInit(UINT wActiveCsr, HCTX hTab);
+
+#ifndef QT_NO_TABLETEVENT
+static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab);
+static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor);
static void initWinTabFunctions(); // resolve the WINTAB api functions
+#endif // QT_NO_TABLETEVENT
#ifndef QT_NO_ACCESSIBILITY
@@ -256,7 +260,7 @@ extern QWidget* qt_get_tablet_widget();
extern bool qt_sendSpontaneousEvent(QObject*, QEvent*);
extern QRegion qt_dirtyRegion(QWidget *);
-typedef QHash<UINT, QTabletDeviceData> QTabletCursorInfo;
+typedef QHash<quint64, QTabletDeviceData> QTabletCursorInfo;
Q_GLOBAL_STATIC(QTabletCursorInfo, tCursorInfo)
QTabletDeviceData currentTabletPointer;
@@ -791,7 +795,9 @@ void qt_init(QApplicationPrivate *priv, int)
if (QApplication::desktopSettingsAware())
qt_set_windows_resources();
+#ifndef QT_NO_TABLETEVENT
initWinTabFunctions();
+#endif // QT_NO_TABLETEVENT
QApplicationPrivate::inputContext = new QWinInputContext(0);
// Read the initial cleartype settings...
@@ -2325,25 +2331,43 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
break;
case WT_PROXIMITY:
- if (ptrWTPacketsGet) {
- bool enteredProximity = LOWORD(lParam) != 0;
- PACKET proximityBuffer[QT_TABLET_NPACKETQSIZE];
- int totalPacks = ptrWTPacketsGet(qt_tablet_context, QT_TABLET_NPACKETQSIZE, proximityBuffer);
- if (totalPacks > 0 && enteredProximity) {
- uint currentCursor = proximityBuffer[0].pkCursor;
- if (!tCursorInfo()->contains(currentCursor))
- tabletInit(currentCursor, qt_tablet_context);
- currentTabletPointer = tCursorInfo()->value(currentCursor);
+
+ #ifndef QT_NO_TABLETEVENT
+ if (ptrWTPacketsGet && ptrWTInfo) {
+ const bool enteredProximity = LOWORD(lParam) != 0;
+ PACKET proximityBuffer[1]; // we are only interested in the first packet in this case
+ const int totalPacks = ptrWTPacketsGet(qt_tablet_context, 1, proximityBuffer);
+ if (totalPacks > 0) {
+ const UINT currentCursor = proximityBuffer[0].pkCursor;
+
+ UINT csr_physid;
+ ptrWTInfo(WTI_CURSORS + currentCursor, CSR_PHYSID, &csr_physid);
+ UINT csr_type;
+ ptrWTInfo(WTI_CURSORS + currentCursor, CSR_TYPE, &csr_type);
+ const UINT deviceIdMask = 0xFF6; // device type mask && device color mask
+ quint64 uniqueId = (csr_type & deviceIdMask);
+ uniqueId = (uniqueId << 32) | csr_physid;
+
+ // initialising and updating the cursor should be done in response to
+ // WT_CSRCHANGE. We do it in WT_PROXIMITY because some wintab never send
+ // the event WT_CSRCHANGE even if asked with CXO_CSRMESSAGES
+ const QTabletCursorInfo *const globalCursorInfo = tCursorInfo();
+ if (!globalCursorInfo->contains(uniqueId))
+ tabletInit(uniqueId, csr_type, qt_tablet_context);
+
+ currentTabletPointer = globalCursorInfo->value(uniqueId);
+ tabletUpdateCursor(currentTabletPointer, currentCursor);
}
qt_tabletChokeMouse = false;
-#ifndef QT_NO_TABLETEVENT
+
QTabletEvent tabletProximity(enteredProximity ? QEvent::TabletEnterProximity
: QEvent::TabletLeaveProximity,
QPoint(), QPoint(), QPointF(), currentTabletPointer.currentDevice, currentTabletPointer.currentPointerType, 0, 0,
0, 0, 0, 0, 0, currentTabletPointer.llId);
QApplication::sendEvent(qApp, &tabletProximity);
-#endif // QT_NO_TABLETEVENT
}
+ #endif // QT_NO_TABLETEVENT
+
break;
#ifdef Q_WS_WINCE_WM
case WM_SETFOCUS: {
@@ -3317,63 +3341,57 @@ bool QETWidget::translateWheelEvent(const MSG &msg)
// the following is adapted from the wintab syspress example (public domain)
/* -------------------------------------------------------------------------- */
-static void tabletInit(UINT wActiveCsr, HCTX hTab)
+// Initialize the "static" information of a cursor device (pen, airbrush, etc).
+// The QTabletDeviceData is initialized with the data that do not change in time
+// (number of button, type of device, etc) but do not initialize the variable data
+// (e.g.: pen or eraser)
+#ifndef QT_NO_TABLETEVENT
+
+static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab)
{
+ Q_ASSERT(ptrWTInfo);
+ Q_ASSERT(ptrWTGet);
+
+ Q_ASSERT(!tCursorInfo()->contains(uniqueId));
+
/* browse WinTab's many info items to discover pressure handling. */
- if (ptrWTInfo && ptrWTGet) {
- AXIS np;
- LOGCONTEXT lc;
- BYTE wPrsBtn;
- BYTE logBtns[32];
- UINT size;
-
- /* discover the LOGICAL button generated by the pressure channel. */
- /* get the PHYSICAL button from the cursor category and run it */
- /* through that cursor's button map (usually the identity map). */
- wPrsBtn = (BYTE)-1;
- ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_NPBUTTON, &wPrsBtn);
- size = ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_BUTTONMAP, &logBtns);
- if ((UINT)wPrsBtn < size)
- wPrsBtn = logBtns[wPrsBtn];
-
- /* get the current context for its device variable. */
- ptrWTGet(hTab, &lc);
-
- /* get the size of the pressure axis. */
- QTabletDeviceData tdd;
- ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &np);
- tdd.minPressure = int(np.axMin);
- tdd.maxPressure = int(np.axMax);
-
- ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &np);
- tdd.minTanPressure = int(np.axMin);
- tdd.maxTanPressure = int(np.axMax);
-
- LOGCONTEXT lcMine;
-
- /* get default region */
- ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine);
-
- tdd.minX = 0;
- tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX);
-
- tdd.minY = 0;
- tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY);
-
- tdd.minZ = 0;
- tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ);
-
- int csr_type,
- csr_physid;
- ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_TYPE, &csr_type);
- ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_PHYSID, &csr_physid);
- tdd.llId = csr_type & 0x0F06;
- tdd.llId = (tdd.llId << 24) | csr_physid;
-#ifndef QT_NO_TABLETEVENT
- if (((csr_type & 0x0006) == 0x0002) && ((csr_type & 0x0F06) != 0x0902)) {
- tdd.currentDevice = QTabletEvent::Stylus;
- } else {
- switch (csr_type & 0x0F06) {
+ AXIS np;
+ LOGCONTEXT lc;
+
+ /* get the current context for its device variable. */
+ ptrWTGet(hTab, &lc);
+
+ /* get the size of the pressure axis. */
+ QTabletDeviceData tdd;
+ tdd.llId = uniqueId;
+
+ ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &np);
+ tdd.minPressure = int(np.axMin);
+ tdd.maxPressure = int(np.axMax);
+
+ ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &np);
+ tdd.minTanPressure = int(np.axMin);
+ tdd.maxTanPressure = int(np.axMax);
+
+ LOGCONTEXT lcMine;
+
+ /* get default region */
+ ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine);
+
+ tdd.minX = 0;
+ tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX);
+
+ tdd.minY = 0;
+ tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY);
+
+ tdd.minZ = 0;
+ tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ);
+
+ const uint cursorTypeBitMask = 0x0F06; // bitmask to find the specific cursor type (see Wacom FAQ)
+ if (((csr_type & 0x0006) == 0x0002) && ((csr_type & cursorTypeBitMask) != 0x0902)) {
+ tdd.currentDevice = QTabletEvent::Stylus;
+ } else {
+ switch (csr_type & cursorTypeBitMask) {
case 0x0802:
tdd.currentDevice = QTabletEvent::Stylus;
break;
@@ -3391,26 +3409,34 @@ static void tabletInit(UINT wActiveCsr, HCTX hTab)
break;
default:
tdd.currentDevice = QTabletEvent::NoDevice;
- }
- }
-
- switch (wActiveCsr % 3) {
- case 2:
- tdd.currentPointerType = QTabletEvent::Eraser;
- break;
- case 1:
- tdd.currentPointerType = QTabletEvent::Pen;
- break;
- case 0:
- tdd.currentPointerType = QTabletEvent::Cursor;
- break;
- default:
- tdd.currentPointerType = QTabletEvent::UnknownPointer;
}
+ }
+ tCursorInfo()->insert(uniqueId, tdd);
+}
#endif // QT_NO_TABLETEVENT
- tCursorInfo()->insert(wActiveCsr, tdd);
+
+// Update the "dynamic" informations of a cursor device (pen, airbrush, etc).
+// The dynamic information is the information of QTabletDeviceData that can change
+// in time (eraser or pen if a device is turned around).
+#ifndef QT_NO_TABLETEVENT
+
+static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor)
+{
+ switch (currentCursor % 3) { // %3 for dual track
+ case 0:
+ tdd.currentPointerType = QTabletEvent::Cursor;
+ break;
+ case 1:
+ tdd.currentPointerType = QTabletEvent::Pen;
+ break;
+ case 2:
+ tdd.currentPointerType = QTabletEvent::Eraser;
+ break;
+ default:
+ tdd.currentPointerType = QTabletEvent::UnknownPointer;
}
}
+#endif // QT_NO_TABLETEVENT
bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf,
int numPackets)
@@ -3546,6 +3572,10 @@ bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf,
}
extern bool qt_is_gui_used;
+
+
+#ifndef QT_NO_TABLETEVENT
+
static void initWinTabFunctions()
{
#if defined(Q_OS_WINCE)
@@ -3564,6 +3594,7 @@ static void initWinTabFunctions()
}
#endif // Q_OS_WINCE
}
+#endif // QT_NO_TABLETEVENT
//
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
index 37dcc67..304e5d3 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
@@ -178,6 +178,9 @@ static void cleanupCocoaApplicationDelegate()
return [[qtMenuLoader retain] autorelease];
}
+// This function will only be called when NSApp is actually running. Before
+// that, the kAEQuitApplication apple event will be sendt to
+// QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
Q_UNUSED(sender);
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index 9ab077f..990571d 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -76,9 +76,14 @@ QT_USE_NAMESPACE
- (void)ensureAppMenuInMenu:(NSMenu *)menu
{
+ // The application menu is the menu in the menu bar that contains the
+ // 'Quit' item. When changing menu bar (e.g when swithing between
+ // windows with different menu bars), we never recreate this menu, but
+ // instead pull it out the current menu bar and place into the new one:
NSMenu *mainMenu = [NSApp mainMenu];
if ([NSApp mainMenu] == menu)
- return; // nothing to do!
+ return; // nothing to do (menu is the current menu bar)!
+
#ifndef QT_NAMESPACE
Q_ASSERT(mainMenu);
#endif
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 72eedad..3da783f 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -64,12 +64,16 @@
#include <qdebug.h>
-@interface NSEvent (DeviceDelta)
+@interface NSEvent (Qt_Compile_Leopard_DeviceDelta)
- (CGFloat)deviceDeltaX;
- (CGFloat)deviceDeltaY;
- (CGFloat)deviceDeltaZ;
@end
+@interface NSEvent (Qt_Compile_Leopard_Gestures)
+ - (CGFloat)magnification;
+@end
+
QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(DnDParams, qMacDnDParams);
@@ -79,6 +83,7 @@ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); // qapplication.cpp
extern OSViewRef qt_mac_nativeview_for(const QWidget *w); // qwidget_mac.mm
extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp
extern QPointer<QWidget> qt_mouseover; //qapplication_mac.mm
+extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
{
@@ -691,6 +696,9 @@ extern "C" {
- (void)mouseDown:(NSEvent *)theEvent
{
+ if (!qt_button_down)
+ qt_button_down = qwidget;
+
qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::LeftButton);
// Don't call super here. This prevents us from getting the mouseUp event,
// which we need to send even if the mouseDown event was not accepted.
@@ -700,75 +708,62 @@ extern "C" {
- (void)mouseUp:(NSEvent *)theEvent
{
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton);
+ qt_button_down = 0;
- if (!mouseOK)
- [super mouseUp:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton);
}
- (void)rightMouseDown:(NSEvent *)theEvent
{
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton);
+ if (!qt_button_down)
+ qt_button_down = qwidget;
- if (!mouseOK)
- [super rightMouseDown:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton);
}
- (void)rightMouseUp:(NSEvent *)theEvent
{
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton);
+ qt_button_down = 0;
- if (!mouseOK)
- [super rightMouseUp:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton);
}
- (void)otherMouseDown:(NSEvent *)theEvent
{
- Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton);
+ if (!qt_button_down)
+ qt_button_down = qwidget;
- if (!mouseOK)
- [super otherMouseDown:theEvent];
+ Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton);
}
- (void)otherMouseUp:(NSEvent *)theEvent
{
- Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton);
-
- if (!mouseOK)
- [super otherMouseUp:theEvent];
+ qt_button_down = 0;
+ Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton);
}
- (void)mouseDragged:(NSEvent *)theEvent
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
-
- if (!mouseOK)
- [super mouseDragged:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
}
- (void)rightMouseDragged:(NSEvent *)theEvent
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
-
- if (!mouseOK)
- [super rightMouseDragged:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
}
- (void)otherMouseDragged:(NSEvent *)theEvent
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
-
- if (!mouseOK)
- [super otherMouseDragged:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
}
- (void)scrollWheel:(NSEvent *)theEvent
@@ -893,6 +888,7 @@ extern "C" {
bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all));
}
+#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- (void)magnifyWithEvent:(NSEvent *)event;
{
@@ -963,7 +959,6 @@ extern "C" {
qNGEvent.position = flipPoint(p).toPoint();
qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- (void)frameDidChange:(NSNotification *)note
{
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm
index 9fb674e..8a22a65 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac.mm
+++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm
@@ -324,8 +324,13 @@ static void cleanupCocoaWindowDelegate()
NSRect frameToReturn = defaultFrame;
QWidget *qwidget = m_windowHash->value(window);
QSizeF size = qwidget->maximumSize();
- frameToReturn.size.width = qMin<CGFloat>(frameToReturn.size.width, size.width());
- frameToReturn.size.height = qMin<CGFloat>(frameToReturn.size.height, size.height());
+ NSRect windowFrameRect = [window frame];
+ NSRect viewFrameRect = [[window contentView] frame];
+ // consider additional size required for titlebar & frame
+ frameToReturn.size.width = qMin<CGFloat>(frameToReturn.size.width,
+ size.width()+(windowFrameRect.size.width - viewFrameRect.size.width));
+ frameToReturn.size.height = qMin<CGFloat>(frameToReturn.size.height,
+ size.height()+(windowFrameRect.size.height - viewFrameRect.size.height));
return frameToReturn;
}
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 427f0b0..e0eebfd 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -572,7 +572,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
while (!d->interrupt && [NSApp runModalSession:session] == NSRunContinuesResponse)
qt_mac_waitForMoreModalSessionEvents();
if (!d->interrupt && session == d->currentModalSessionCached) {
- // Someone called e.g. [NSApp stopModal:] from outside the event
+ // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event
// dispatcher (e.g to stop a native dialog). But that call wrongly stopped
// 'session' as well. As a result, we need to restart all internal sessions:
d->temporarilyStopAllModalSessions();
@@ -596,7 +596,13 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
if (NSModalSession session = d->currentModalSession()) {
if (flags & QEventLoop::WaitForMoreEvents)
qt_mac_waitForMoreModalSessionEvents();
- [NSApp runModalSession:session];
+ NSInteger status = [NSApp runModalSession:session];
+ if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) {
+ // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event
+ // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
+ // 'session' as well. As a result, we need to restart all internal sessions:
+ d->temporarilyStopAllModalSessions();
+ }
retVal = true;
break;
} else {
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index e3af683..2361dd0 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -282,8 +282,8 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp
\row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home \i Shift+Home
\row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End \i Shift+End
- \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up \i (none) \i (none) \i (none)
- \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down \i (none) \i (none) \i (none)
+ \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none) \i (none)
+ \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none) \i (none)
\row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home \i Ctrl+Shift+Home
\row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End
\row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace \i (none)
@@ -732,6 +732,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QApplicationPrivate::KB_Mac},
+ {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QApplicationPrivate::KB_Mac},
+ {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QApplicationPrivate::KB_Mac},
{QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac},
{QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac}
};
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index c0fb8aa..2bf1465 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -899,6 +899,14 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
widgetToGetMouse =
[static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(tmpView) qt_qwidget];
}
+ } else {
+ extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
+ if (!mac_mouse_grabber && qt_button_down) {
+ // if there is no explicit grabber, and the mouse was grabbed
+ // implicitely (i.e. a mousebutton was pressed)
+ widgetToGetMouse = qt_button_down;
+ tmpView = qt_mac_nativeview_for(widgetToGetMouse);
+ }
}
NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil];
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 709f6f3..b389054 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -4605,7 +4605,7 @@ void QWidgetPrivate::updateFont(const QFont &font)
if (!q->parentWidget() && extra && extra->proxyWidget) {
QGraphicsProxyWidget *p = extra->proxyWidget;
inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve();
- } else
+ } else
#endif //QT_NO_GRAPHICSVIEW
if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
inheritedFontResolveMask = 0;
@@ -8248,7 +8248,8 @@ bool QWidget::event(QEvent *event)
QList<QObject*> childList = d->children;
for (int i = 0; i < childList.size(); ++i) {
QObject *o = childList.at(i);
- QApplication::sendEvent(o, event);
+ if (o)
+ QApplication::sendEvent(o, event);
}
}
update();
@@ -8277,7 +8278,7 @@ bool QWidget::event(QEvent *event)
QList<QObject*> childList = d->children;
for (int i = 0; i < childList.size(); ++i) {
QObject *o = childList.at(i);
- if (o != QApplication::activeModalWidget()) {
+ if (o && o != QApplication::activeModalWidget()) {
if (qobject_cast<QWidget *>(o) && static_cast<QWidget *>(o)->isWindow()) {
// do not forward the event to child windows,
// QApplication does this for us
@@ -9896,13 +9897,13 @@ void QWidget::scroll(int dx, int dy)
Q_D(QWidget);
#ifndef QT_NO_GRAPHICSVIEW
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
- // Graphics View maintains its own dirty region as a list of rects;
- // until we can connect item updates directly to the view, we must
- // separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
- proxy->update(rect);
- }
+ // Graphics View maintains its own dirty region as a list of rects;
+ // until we can connect item updates directly to the view, we must
+ // separately add a translated dirty region.
+ if (!d->dirty.isEmpty()) {
+ foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
+ proxy->update(rect);
+ }
proxy->scroll(dx, dy, proxy->subWidgetRect(this));
return;
}
@@ -9931,13 +9932,13 @@ void QWidget::scroll(int dx, int dy, const QRect &r)
Q_D(QWidget);
#ifndef QT_NO_GRAPHICSVIEW
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
- // Graphics View maintains its own dirty region as a list of rects;
- // until we can connect item updates directly to the view, we must
- // separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
- proxy->update(rect);
- }
+ // Graphics View maintains its own dirty region as a list of rects;
+ // until we can connect item updates directly to the view, we must
+ // separately add a translated dirty region.
+ if (!d->dirty.isEmpty()) {
+ foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
+ proxy->update(rect);
+ }
proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint()));
return;
}
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 71f0077..0d9f9ee 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -725,6 +725,23 @@ static OSWindowRef qt_mac_create_window(QWidget *, WindowClass wclass, WindowAtt
return window;
}
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
+/* We build the release package against the 10.4 SDK.
+ So, to enable gestures for applications running on
+ 10.6+, we define the missing constants here: */
+enum {
+ kEventClassGesture = 'gest',
+ kEventGestureStarted = 1,
+ kEventGestureEnded = 2,
+ kEventGestureMagnify = 4,
+ kEventGestureSwipe = 5,
+ kEventGestureRotate = 6,
+ kEventParamRotationAmount = 'rota',
+ kEventParamSwipeDirection = 'swip',
+ kEventParamMagnificationAmount = 'magn'
+};
+#endif
+
// window events
static EventTypeSpec window_events[] = {
{ kEventClassWindow, kEventWindowClose },
@@ -741,13 +758,11 @@ static EventTypeSpec window_events[] = {
{ kEventClassWindow, kEventWindowGetRegion },
{ kEventClassWindow, kEventWindowGetClickModality },
{ kEventClassWindow, kEventWindowTransitionCompleted },
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
{ kEventClassGesture, kEventGestureStarted },
{ kEventClassGesture, kEventGestureEnded },
{ kEventClassGesture, kEventGestureMagnify },
{ kEventClassGesture, kEventGestureSwipe },
{ kEventClassGesture, kEventGestureRotate },
-#endif
{ kEventClassMouse, kEventMouseDown }
};
static EventHandlerUPP mac_win_eventUPP = 0;
@@ -1036,7 +1051,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
handled_event = false;
break; }
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
case kEventClassGesture: {
// First, find the widget that was under
// the mouse when the gesture happened:
@@ -1064,7 +1078,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
break;
case kEventGestureRotate: {
CGFloat amount;
- if (GetEventParameter(event, kEventParamRotationAmount, typeCGFloat, 0,
+ if (GetEventParameter(event, kEventParamRotationAmount, 'cgfl', 0,
sizeof(amount), 0, &amount) != noErr) {
handled_event = false;
break;
@@ -1091,7 +1105,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
break; }
case kEventGestureMagnify: {
CGFloat amount;
- if (GetEventParameter(event, kEventParamMagnificationAmount, typeCGFloat, 0,
+ if (GetEventParameter(event, kEventParamMagnificationAmount, 'cgfl', 0,
sizeof(amount), 0, &amount) != noErr) {
handled_event = false;
break;
@@ -1103,7 +1117,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
QApplication::sendSpontaneousEvent(widget, &qNGEvent);
break; }
-#endif // gestures
default:
handled_event = false;
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index b1c37d3..359df2a 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -488,12 +488,6 @@ void QWidgetPrivate::show_sys()
if(q->isWindow())
id->setFocusSafely(true);
-
- // Force setting of the icon after window is made visible,
- // this is needed even WA_SetWindowIcon is not set, as in that case we need
- // to reset to the application level window icon
- if(q->isWindow())
- setWindowIcon_sys(true);
}
invalidateBuffer(q->rect());
@@ -1180,18 +1174,6 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
if (id->IsFocused()) // Avoid unnecessry calls to FocusChanged()
id->setFocusSafely(false);
id->ControlEnv()->AppUi()->RemoveFromStack(id);
-
- // Hack to activate window under destroyed one. With this activation
- // the next visible window will get keyboard focus
- WId wid = CEikonEnv::Static()->AppUi()->TopFocusedControl();
- if (wid) {
- QWidget *widget = QWidget::find(wid);
- QApplication::setActiveWindow(widget);
- if (widget) {
- // Reset global window title for focusing window
- widget->d_func()->setWindowTitle_sys(widget->windowTitle());
- }
- }
}
}
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 7461637..0bc9cbc 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -527,8 +527,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
QX11InfoData *xd = &X11->screens[qt_x11_create_desktop_on_screen];
xinfo.setX11Data(xd);
} else if (parentXinfo && (parentXinfo->screen() != xinfo.screen()
- || parentXinfo->visual() != xinfo.visual()))
+ || (parentXinfo->visual() != xinfo.visual()
+ && !q->inherits("QGLWidget"))))
{
+ // QGLWidgets have to be excluded here as they have a
+ // specially crafted QX11Info structure which can't be swapped
+ // out with the parent widgets QX11Info. The parent visual,
+ // for instance, might not even be GL capable.
xinfo = *parentXinfo;
}
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 8226797..1b8f413 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -949,6 +949,8 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy)
return;
QWidgetBackingStore *wbs = x->backingStore;
+ if (!wbs)
+ return;
static int accelEnv = -1;
if (accelEnv == -1) {
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 48629d1..443c9c5 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5886,7 +5886,12 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption
Draws the text item \a ti at position \a p.
*/
-/*! \internal
+/*!
+ \fn void QPainter::drawTextItem(const QPointF &p, const QTextItem &ti)
+
+ \internal
+ \since 4.1
+
Draws the text item \a ti at position \a p.
This method ignores the painters background mode and
@@ -5899,34 +5904,57 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption
ignored aswell. You'll need to pass in the correct flags to get
underlining and strikeout.
*/
-static QPainterPath generateWavyPath(qreal minWidth, qreal maxRadius, QPaintDevice *device)
+
+static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen)
{
- extern int qt_defaultDpi();
+ const qreal radiusBase = qMax(qreal(1), maxRadius);
+
+ QString key = QLatin1String("WaveUnderline-");
+ key += pen.color().name();
+ key += QLatin1Char('-');
+ key += QString::number(radiusBase);
+
+ QPixmap pixmap;
+ if (QPixmapCache::find(key, pixmap))
+ return pixmap;
+
+ const qreal halfPeriod = qMax(qreal(2), qreal(radiusBase * 1.61803399)); // the golden ratio
+ const int width = qCeil(100 / (2 * halfPeriod)) * (2 * halfPeriod);
+ const int radius = qFloor(radiusBase);
+
QPainterPath path;
- bool up = true;
- const qreal radius = qMax(qreal(.5), qMin(qreal(1.25 * device->logicalDpiY() / qt_defaultDpi()), maxRadius));
- qreal xs, ys;
- int i = 0;
- path.moveTo(0, radius);
- do {
- xs = i*(2*radius);
- ys = 0;
+ qreal xs = 0;
+ qreal ys = radius;
- qreal remaining = minWidth - xs;
- qreal angle = 180;
+ while (xs < width) {
+ xs += halfPeriod;
+ ys = -ys;
+ path.quadTo(xs - halfPeriod / 2, ys, xs, 0);
+ }
- // cut-off at the last arc segment
- if (remaining < 2 * radius)
- angle = 180 * remaining / (2 * radius);
+ pixmap = QPixmap(width, radius * 2);
+ pixmap.fill(Qt::transparent);
+ {
+ QPen wavePen = pen;
+ wavePen.setCapStyle(Qt::SquareCap);
+
+ // This is to protect against making the line too fat, as happens on Mac OS X
+ // due to it having a rather thick width for the regular underline.
+ const qreal maxPenWidth = .8 * radius;
+ if (wavePen.widthF() > maxPenWidth)
+ wavePen.setWidth(maxPenWidth);
- path.arcTo(xs, ys, 2*radius, 2*radius, 180, up ? angle : -angle);
+ QPainter imgPainter(&pixmap);
+ imgPainter.setPen(wavePen);
+ imgPainter.setRenderHint(QPainter::Antialiasing);
+ imgPainter.translate(0, radius);
+ imgPainter.drawPath(path);
+ }
- up = !up;
- ++i;
- } while (xs + 2*radius < minWidth);
+ QPixmapCache::insert(key, pixmap);
- return path;
+ return pixmap;
}
static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QTextItemInt &ti)
@@ -5947,9 +5975,11 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
pen.setCapStyle(Qt::FlatCap);
QLineF line(pos.x(), pos.y(), pos.x() + ti.width.toReal(), pos.y());
+
+ const qreal underlineOffset = fe->underlinePosition().toReal();
// deliberately ceil the offset to avoid the underline coming too close to
// the text above it.
- const qreal underlinePos = pos.y() + qCeil(fe->underlinePosition().toReal());
+ const qreal underlinePos = pos.y() + qCeil(underlineOffset);
if (underlineStyle == QTextCharFormat::SpellCheckUnderline) {
underlineStyle = QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle));
@@ -5957,16 +5987,18 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
if (underlineStyle == QTextCharFormat::WaveUnderline) {
painter->save();
- painter->setRenderHint(QPainter::Antialiasing);
- painter->translate(pos.x(), underlinePos);
+ painter->translate(0, pos.y() + 1);
QColor uc = ti.charFormat.underlineColor();
if (uc.isValid())
- painter->setPen(uc);
+ pen.setColor(uc);
- painter->drawPath(generateWavyPath(ti.width.toReal(),
- fe->underlinePosition().toReal(),
- painter->device()));
+ // Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms
+ const QPixmap wave = generateWavyPixmap(qMax(underlineOffset, pen.widthF()), pen);
+ const int descent = (int) ti.descent.toReal();
+
+ painter->setBrushOrigin(painter->brushOrigin().x(), 0);
+ painter->fillRect(pos.x(), 0, qCeil(ti.width.toReal()), qMin(wave.height(), descent), wave);
painter->restore();
} else if (underlineStyle != QTextCharFormat::NoUnderline) {
QLineF underLine(line.x1(), underlinePos, line.x2(), underlinePos);
@@ -6001,10 +6033,6 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
painter->setBrush(oldBrush);
}
-/*!
- \internal
- \since 4.1
-*/
void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
{
#ifdef QT_DEBUG_DRAW
diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp
index 4cccc91..3d82edf 100644
--- a/src/gui/painting/qprintengine_pdf.cpp
+++ b/src/gui/painting/qprintengine_pdf.cpp
@@ -206,7 +206,7 @@ void QPdfEngine::drawImage(const QRectF &rectangle, const QImage &image, const Q
QRect sourceRect = sr.toRect();
QImage im = sourceRect != image.rect() ? image.copy(sourceRect) : image;
bool bitmap = true;
- const int object = d->addImage(image, &bitmap, im.cacheKey());
+ const int object = d->addImage(im, &bitmap, im.cacheKey());
if (object < 0)
return;
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 5566cc6..b32c55b 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -1368,7 +1368,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
else {
gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect,
option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
- GTK_SHADOW_NONE, style, entryPath + QString::number(focus));
+ GTK_SHADOW_NONE, gtkCombo->style, entryPath + QString::number(focus));
}
gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState,
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 38c3feb..4075cf7 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -2155,9 +2155,9 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
wdi.titleWidth = tb->rect.width();
QCFType<HIShapeRef> region;
HIRect hirect = qt_hirectForQRect(tb->rect);
- if (hirect.size.width == -1)
+ if (hirect.size.width <= 0)
hirect.size.width = 100;
- if (hirect.size.height == -1)
+ if (hirect.size.height <= 0)
hirect.size.height = 30;
HIThemeGetWindowShape(&hirect, &wdi, kWindowTitleBarRgn, &region);
@@ -4843,9 +4843,11 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
uint sc = SC_TitleBarMinButton;
ThemeTitleBarWidget tbw = kThemeWidgetCollapseBox;
bool active = titlebar->state & State_Active;
- int border = 2;
- titleBarRect.origin.x += border;
- titleBarRect.origin.y -= border;
+ if (qMacVersion() < QSysInfo::MV_10_6) {
+ int border = 2;
+ titleBarRect.origin.x += border;
+ titleBarRect.origin.y -= border;
+ }
while (sc <= SC_TitleBarCloseButton) {
if (sc & titlebar->subControls) {
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index b5c0d4f..dca78ca 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -144,7 +144,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme
{SE_ToolBarButtonPressed, QS60StyleEnums::SP_QsnFrSctrlButtonCenterPressed},
{SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter},
{SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive},
- {SE_Editor, QS60StyleEnums::SP_QsnFrNotepadCenter},
+ {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter},
};
static const int frameElementsCount =
@@ -459,11 +459,6 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const
storeThemePalette(&widgetPalette);
}
-void QS60StylePrivate::setThemePalette(QStyleOption *option) const
-{
- setThemePalette(&option->palette);
-}
-
QPalette* QS60StylePrivate::themePalette()
{
return m_themePalette;
@@ -475,6 +470,8 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
QPalette applicationPalette = QApplication::palette();
applicationPalette.setBrush(QPalette::Window, backgroundTexture());
setThemePalette(&applicationPalette);
+ QApplication::setPalette(applicationPalette);
+ setThemePaletteHash(&applicationPalette);
}
void QS60StylePrivate::deleteBackground()
@@ -638,16 +635,16 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const
{
if(!widget)
return;
- QPalette widgetPalette = QApplication::palette(widget);
//header view and its viewport need to be set 100% transparent button color, since drawing code will
//draw transparent theme graphics to table column and row headers.
if (qobject_cast<QHeaderView *>(widget)){
+ QPalette widgetPalette = QApplication::palette(widget);
widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
QHeaderView* header = qobject_cast<QHeaderView *>(widget);
widgetPalette.setColor(QPalette::Button, Qt::transparent );
- if ( header->viewport() )
+ if (header->viewport())
header->viewport()->setPalette(widgetPalette);
QApplication::setPalette(widgetPalette, "QHeaderView");
}
@@ -810,7 +807,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
case QS60StyleEnums::SP_QgnGrafTabActiveL:
//Returned QSize for tabs must not be square, but narrow rectangle with width:height
//ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones).
- result.setWidth(10);
+ result.setWidth(result.height()>>1);
break;
case QS60StyleEnums::SP_QgnIndiSliderEdit:
result.scale(pixelMetric(QStyle::PM_SliderLength),
@@ -868,7 +865,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
return result;
}
-bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush)
+bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush)
{
//If brush is not changed from style's default values, draw theme graphics.
return (backgroundBrush.color() == Qt::transparent ||
@@ -1786,7 +1783,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
if (qobject_cast<const QAbstractButton *>(widget)) {
//Make cornerButton slightly smaller so that it is not on top of table border graphic.
QStyleOptionHeader subopt = *header;
- const int borderTweak =
+ const int borderTweak =
QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1;
if (subopt.direction == Qt::LeftToRight)
subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak);
@@ -1879,7 +1876,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest);
} else {
const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- if (option->direction == Qt::LeftToRight)
+ if (option->direction == Qt::LeftToRight)
headerRect.adjust(-2*frameWidth, 0, 0, 0);
else
headerRect.adjust(0, 0, 2*frameWidth, 0);
@@ -2025,7 +2022,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
buttonRect.setHeight((int)(buttonRect.height() * scaler));
// move the rect up for half of the new height-gain
const int newY = (buttonRect.bottomRight().y() - option->rect.bottomRight().y()) >> 1 ;
- buttonRect.adjust(0,-newY,0,-newY);
+ buttonRect.adjust(0, -newY, -1, -newY);
painter->save();
QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option);
@@ -2594,7 +2591,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2*pixelMetric(PM_ButtonMargin);
const int border = pixelMetric(PM_ButtonMargin) + pixelMetric(PM_DefaultFrameWidth);
ret = toolButton->rect;
- const bool popup = (toolButton->features &
+ const bool popup = (toolButton->features &
(QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay))
== QStyleOptionToolButton::MenuButtonPopup;
switch (scontrol) {
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index ea86bb2..5ab2308 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -271,15 +271,6 @@ public:
SP_QsnFrButtonSideLInactive,
SP_QsnFrButtonSideRInactive,
SP_QsnFrButtonCenterInactive,
- SP_QsnFrNotepadCornerTl,
- SP_QsnFrNotepadCornerTr,
- SP_QsnFrNotepadCornerBl,
- SP_QsnFrNotepadCornerBr,
- SP_QsnFrNotepadSideT,
- SP_QsnFrNotepadSideB,
- SP_QsnFrNotepadSideL,
- SP_QsnFrNotepadSideR,
- SP_QsnFrNotepadCenter
};
enum ColorLists {
@@ -418,8 +409,6 @@ public:
//set theme palette for application
void setThemePalette(QApplication *application) const;
- //set theme palette for style option
- void setThemePalette(QStyleOption *option) const;
//access to theme palette
static QPalette* themePalette();
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index a8dbf8d..48b8fad 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -1324,9 +1324,9 @@ QS60Style::QS60Style()
void QS60StylePrivate::handleDynamicLayoutVariantSwitch()
{
clearCaches(QS60StylePrivate::CC_LayoutChange);
+ setBackgroundTexture(qApp);
setActiveLayout();
refreshUI();
- setBackgroundTexture(qApp);
foreach (QWidget *widget, QApplication::allWidgets())
widget->ensurePolished();
}
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index 6c367ab..7ec8e31 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -485,61 +485,80 @@ glyph_metrics_t QFontEngineWin::boundingBox(const QGlyphLayout &glyphs)
return glyph_metrics_t(0, -tm.tmAscent, w, tm.tmHeight, w, 0);
}
+#ifndef Q_WS_WINCE
+bool QFontEngineWin::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const
+{
+ Q_ASSERT(metrics != 0);
+
+ HDC hdc = shared_dc();
+
+ GLYPHMETRICS gm;
+ DWORD res = 0;
+ MAT2 mat;
+ mat.eM11.value = mat.eM22.value = 1;
+ mat.eM11.fract = mat.eM22.fract = 0;
+ mat.eM21.value = mat.eM12.value = 0;
+ mat.eM21.fract = mat.eM12.fract = 0;
+
+ if (t.type() > QTransform::TxTranslate) {
+ // We need to set the transform using the HDC's world
+ // matrix rather than using the MAT2 above, because the
+ // results provided when transforming via MAT2 does not
+ // match the glyphs that are drawn using a WorldTransform
+ XFORM xform;
+ xform.eM11 = t.m11();
+ xform.eM12 = t.m12();
+ xform.eM21 = t.m21();
+ xform.eM22 = t.m22();
+ xform.eDx = 0;
+ xform.eDy = 0;
+ SetGraphicsMode(hdc, GM_ADVANCED);
+ SetWorldTransform(hdc, &xform);
+ }
+
+ uint format = GGO_METRICS;
+ if (ttf)
+ format |= GGO_GLYPH_INDEX;
+ res = GetGlyphOutline(hdc, glyph, format, &gm, 0, 0, &mat);
+
+ if (t.type() > QTransform::TxTranslate) {
+ XFORM xform;
+ xform.eM11 = xform.eM22 = 1;
+ xform.eM12 = xform.eM21 = xform.eDx = xform.eDy = 0;
+ SetWorldTransform(hdc, &xform);
+ SetGraphicsMode(hdc, GM_COMPATIBLE);
+ }
+
+ if (res != GDI_ERROR) {
+ *metrics = glyph_metrics_t(gm.gmptGlyphOrigin.x, -gm.gmptGlyphOrigin.y,
+ (int)gm.gmBlackBoxX, (int)gm.gmBlackBoxY, gm.gmCellIncX, gm.gmCellIncY);
+ return true;
+ } else {
+ return false;
+ }
+}
+#endif
glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t)
{
#ifndef Q_WS_WINCE
- GLYPHMETRICS gm;
-
HDC hdc = shared_dc();
SelectObject(hdc, hfont);
- if (!ttf) {
+
+ glyph_metrics_t glyphMetrics;
+ bool success = getOutlineMetrics(glyph, t, &glyphMetrics);
+
+ if (!ttf && !success) {
+ // Bitmap fonts
wchar_t ch = glyph;
ABCFLOAT abc;
GetCharABCWidthsFloat(hdc, ch, ch, &abc);
int width = qRound(abc.abcfB);
- return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, width, 0).transformed(t);
- } else {
- DWORD res = 0;
- MAT2 mat;
- mat.eM11.value = mat.eM22.value = 1;
- mat.eM11.fract = mat.eM22.fract = 0;
- mat.eM21.value = mat.eM12.value = 0;
- mat.eM21.fract = mat.eM12.fract = 0;
-
- if (t.type() > QTransform::TxTranslate) {
- // We need to set the transform using the HDC's world
- // matrix rather than using the MAT2 above, because the
- // results provided when transforming via MAT2 does not
- // match the glyphs that are drawn using a WorldTransform
- XFORM xform;
- xform.eM11 = t.m11();
- xform.eM12 = t.m12();
- xform.eM21 = t.m21();
- xform.eM22 = t.m22();
- xform.eDx = 0;
- xform.eDy = 0;
- SetGraphicsMode(hdc, GM_ADVANCED);
- SetWorldTransform(hdc, &xform);
- }
-
- res = GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, 0, &mat);
-
- if (t.type() > QTransform::TxTranslate) {
- XFORM xform;
- xform.eM11 = xform.eM22 = 1;
- xform.eM12 = xform.eM21 = xform.eDx = xform.eDy = 0;
- SetWorldTransform(hdc, &xform);
- SetGraphicsMode(hdc, GM_COMPATIBLE);
- }
-
- if (res != GDI_ERROR) {
- return glyph_metrics_t(gm.gmptGlyphOrigin.x, -gm.gmptGlyphOrigin.y,
- (int)gm.gmBlackBoxX, (int)gm.gmBlackBoxY, gm.gmCellIncX, gm.gmCellIncY);
- }
+ return glyph_metrics_t(QFixed::fromReal(abc.abcfA), -tm.tmAscent, width, tm.tmHeight, width, 0).transformed(t);
}
- return glyph_metrics_t();
+
+ return glyphMetrics;
#else
HDC hdc = shared_dc();
HGDIOBJ oldFont = SelectObject(hdc, hfont);
@@ -1135,7 +1154,7 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin
{
ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, (LPCWSTR) &glyph, 1, 0);
}
-
+
SelectObject(hdc, old_font);
return ni;
}
diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h
index 9c4b0a9..bab71c9 100644
--- a/src/gui/text/qfontengine_win_p.h
+++ b/src/gui/text/qfontengine_win_p.h
@@ -109,6 +109,10 @@ public:
int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const;
void getCMap();
+#ifndef Q_WS_WINCE
+ bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const;
+#endif
+
QString _name;
HFONT hfont;
LOGFONT logfont;
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index be79773..f96f66b 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1849,8 +1849,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)
|| e->preeditString() != cursor.block().layout()->preeditAreaText()
|| e->replacementLength() > 0;
+ cursor.beginEditBlock();
if (isGettingInput) {
- cursor.beginEditBlock();
cursor.removeSelectedText();
}
@@ -1876,7 +1876,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)
QTextBlock block = cursor.block();
QTextLayout *layout = block.layout();
- layout->setPreeditArea(cursor.position() - block.position(), e->preeditString());
+ if (isGettingInput)
+ layout->setPreeditArea(cursor.position() - block.position(), e->preeditString());
QList<QTextLayout::FormatRange> overrides;
preeditCursor = e->preeditString().length();
hideCursor = false;
@@ -1897,9 +1898,7 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)
}
}
layout->setAdditionalFormats(overrides);
-
- if (isGettingInput)
- cursor.endEditBlock();
+ cursor.endEditBlock();
}
QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 048325c..523dd18 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1767,6 +1767,12 @@ void QTextDocument::print(QPrinter *printer) const
fromPage = qMax(1, fromPage);
toPage = qMin(doc->pageCount(), toPage);
+ if (toPage < fromPage) {
+ // if the user entered a page range outside the actual number
+ // of printable pages, just return
+ return;
+ }
+
if (printer->pageOrder() == QPrinter::LastPageFirst) {
int tmp = fromPage;
fromPage = toPage;
diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp
index cb46791..8834373 100644
--- a/src/gui/widgets/qabstractbutton.cpp
+++ b/src/gui/widgets/qabstractbutton.cpp
@@ -165,7 +165,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type)
shortcutId(0),
#endif
checkable(false), checked(false), autoRepeat(false), autoExclusive(false),
- down(false), blockRefresh(false),
+ down(false), blockRefresh(false), pressed(false),
#ifndef QT_NO_BUTTONGROUP
group(0),
#endif
@@ -1090,6 +1090,7 @@ void QAbstractButton::mousePressEvent(QMouseEvent *e)
}
if (hitButton(e->pos())) {
setDown(true);
+ d->pressed = true;
repaint(); //flush paint event before invoking potentially expensive operation
QApplication::flush();
d->emitPressed();
@@ -1103,6 +1104,8 @@ void QAbstractButton::mousePressEvent(QMouseEvent *e)
void QAbstractButton::mouseReleaseEvent(QMouseEvent *e)
{
Q_D(QAbstractButton);
+ d->pressed = false;
+
if (e->button() != Qt::LeftButton) {
e->ignore();
return;
@@ -1127,7 +1130,7 @@ void QAbstractButton::mouseReleaseEvent(QMouseEvent *e)
void QAbstractButton::mouseMoveEvent(QMouseEvent *e)
{
Q_D(QAbstractButton);
- if (!(e->buttons() & Qt::LeftButton)) {
+ if (!(e->buttons() & Qt::LeftButton) || !d->pressed) {
e->ignore();
return;
}
diff --git a/src/gui/widgets/qabstractbutton_p.h b/src/gui/widgets/qabstractbutton_p.h
index be7c022..d86163b 100644
--- a/src/gui/widgets/qabstractbutton_p.h
+++ b/src/gui/widgets/qabstractbutton_p.h
@@ -77,6 +77,7 @@ public:
uint autoExclusive :1;
uint down :1;
uint blockRefresh :1;
+ uint pressed : 1;
#ifndef QT_NO_BUTTONGROUP
QButtonGroup* group;
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp
index e0db9c2..988a7e7 100644
--- a/src/gui/widgets/qabstractslider.cpp
+++ b/src/gui/widgets/qabstractslider.cpp
@@ -219,6 +219,10 @@ QAbstractSliderPrivate::QAbstractSliderPrivate()
blocktracking(false), pressed(false),
invertedAppearance(false), invertedControls(false),
orientation(Qt::Horizontal), repeatAction(QAbstractSlider::SliderNoAction)
+#ifdef QT_KEYPAD_NAVIGATION
+ , isAutoRepeating(false)
+ , repeatMultiplier(1)
+#endif
{
}
@@ -371,6 +375,9 @@ int QAbstractSlider::maximum() const
abstract sliders provides and typically corresponds to the user
pressing an arrow key.
+ If the property is modified during an auto repeating key event, behavior
+ is undefined.
+
\sa pageStep
*/
@@ -598,10 +605,10 @@ void QAbstractSlider::triggerAction(SliderAction action)
d->blocktracking = true;
switch (action) {
case SliderSingleStepAdd:
- setSliderPosition(d->overflowSafeAdd(d->singleStep));
+ setSliderPosition(d->overflowSafeAdd(d->effectiveSingleStep()));
break;
case SliderSingleStepSub:
- setSliderPosition(d->overflowSafeAdd(-d->singleStep));
+ setSliderPosition(d->overflowSafeAdd(-d->effectiveSingleStep()));
break;
case SliderPageStepAdd:
setSliderPosition(d->overflowSafeAdd(d->pageStep));
@@ -702,7 +709,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e)
// Calculate how many lines to scroll. Depending on what delta is (and
// offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can
// only scroll whole lines, so we keep the reminder until next event.
- qreal stepsToScrollF = offset * QApplication::wheelScrollLines() * d->singleStep;
+ qreal stepsToScrollF = offset * QApplication::wheelScrollLines() * d->effectiveSingleStep();
// Check if wheel changed direction since last event:
if (d->offset_accumulated != 0 && (offset / d->offset_accumulated) < 0)
d->offset_accumulated = 0;
@@ -773,6 +780,38 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
{
Q_D(QAbstractSlider);
SliderAction action = SliderNoAction;
+#ifdef QT_KEYPAD_NAVIGATION
+ if (ev->isAutoRepeat()) {
+ if (d->firstRepeat.isNull())
+ d->firstRepeat = QTime::currentTime();
+ else if (1 == d->repeatMultiplier) {
+ // This is the interval in milli seconds which one key repetition
+ // takes.
+ const int repeatMSecs = d->firstRepeat.msecsTo(QTime::currentTime());
+
+ /**
+ * The time it takes to currently navigate the whole slider.
+ */
+ const qreal currentTimeElapse = (qreal(maximum()) / singleStep()) * repeatMSecs;
+
+ /**
+ * This is an arbitrarily determined constant in msecs that
+ * specifies how long time it should take to navigate from the
+ * start to the end(excluding starting key auto repeat).
+ */
+ const int SliderRepeatElapse = 2500;
+
+ d->repeatMultiplier = currentTimeElapse / SliderRepeatElapse;
+ }
+
+ }
+ else if (!d->firstRepeat.isNull()) {
+ d->firstRepeat = QTime();
+ d->repeatMultiplier = 1;
+ }
+
+#endif
+
switch (ev->key()) {
#ifdef QT_KEYPAD_NAVIGATION
case Qt::Key_Select:
diff --git a/src/gui/widgets/qabstractslider_p.h b/src/gui/widgets/qabstractslider_p.h
index 9324d44..6591981 100644
--- a/src/gui/widgets/qabstractslider_p.h
+++ b/src/gui/widgets/qabstractslider_p.h
@@ -68,7 +68,13 @@ public:
void setSteps(int single, int page);
- int minimum, maximum, singleStep, pageStep, value, position, pressValue;
+ int minimum, maximum, pageStep, value, position, pressValue;
+
+ /**
+ * Call effectiveSingleStep() when changing the slider value.
+ */
+ int singleStep;
+
float offset_accumulated;
uint tracking : 1;
uint blocktracking :1;
@@ -83,8 +89,33 @@ public:
#ifdef QT_KEYPAD_NAVIGATION
int origValue;
+
+ /**
+ */
+ bool isAutoRepeating;
+
+ /**
+ * When we're auto repeating, we multiply singleStep with this value to
+ * get our effective step.
+ */
+ qreal repeatMultiplier;
+
+ /**
+ * The time of when the first auto repeating key press event occurs.
+ */
+ QTime firstRepeat;
+
#endif
+ inline int effectiveSingleStep() const
+ {
+ return singleStep
+#ifdef QT_KEYPAD_NAVIGATION
+ * repeatMultiplier
+#endif
+ ;
+ }
+
inline int bound(int val) const { return qMax(minimum, qMin(maximum, val)); }
inline int overflowSafeAdd(int add) const
{
diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp
index 9adf280..8f47f25 100644
--- a/src/gui/widgets/qcommandlinkbutton.cpp
+++ b/src/gui/widgets/qcommandlinkbutton.cpp
@@ -326,7 +326,8 @@ int QCommandLinkButton::heightForWidth(int width) const
Q_D(const QCommandLinkButton);
int heightWithoutDescription = d->descriptionOffset() + d->bottomMargin();
// find the width available for the description area
- return heightWithoutDescription + d->descriptionHeight(width);
+ return qMax(heightWithoutDescription + d->descriptionHeight(width),
+ iconSize().height() + d->topMargin() + d->bottomMargin());
}
/*! \reimp */
diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp
index 2ee5751..0e859f1 100644
--- a/src/gui/widgets/qdialogbuttonbox.cpp
+++ b/src/gui/widgets/qdialogbuttonbox.cpp
@@ -1215,6 +1215,30 @@ bool QDialogButtonBox::event(QEvent *event)
}else if (event->type() == QEvent::LanguageChange) {
d->retranslateStrings();
}
+#ifdef QT_SOFTKEYS_ENABLED
+ else if (event->type() == QEvent::ParentChange) {
+ QWidget *dialog = 0;
+ QWidget *p = this;
+ while (p && !p->isWindow()) {
+ p = p->parentWidget();
+ if ((dialog = qobject_cast<QDialog *>(p)))
+ break;
+ }
+
+ // If the parent changes, then move the softkeys
+ for (QHash<QAbstractButton *, QAction *>::const_iterator it = d->softKeyActions.constBegin();
+ it != d->softKeyActions.constEnd(); ++it) {
+ QAction *current = it.value();
+ QList<QWidget *> widgets = current->associatedWidgets();
+ foreach (QWidget *w, widgets)
+ w->removeAction(current);
+ if (dialog)
+ dialog->addAction(current);
+ else
+ addAction(current);
+ }
+ }
+#endif
return QWidget::event(event);
}
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 300a2ea..117c550 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -138,7 +138,12 @@ void QLineControl::copy(QClipboard::Mode mode) const
*/
void QLineControl::paste()
{
- insert(QApplication::clipboard()->text(QClipboard::Clipboard));
+ QString clip = QApplication::clipboard()->text(QClipboard::Clipboard);
+ if (!clip.isEmpty() || hasSelectedText()) {
+ separate(); //make it a separate undo/redo command
+ insert(clip);
+ separate();
+ }
}
#endif // !QT_NO_CLIPBOARD
@@ -1581,16 +1586,16 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
}
}
#endif //QT_NO_CLIPBOARD
- else if (event == QKeySequence::MoveToStartOfLine) {
+ else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) {
home(0);
}
- else if (event == QKeySequence::MoveToEndOfLine) {
+ else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) {
end(0);
}
- else if (event == QKeySequence::SelectStartOfLine) {
+ else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) {
home(1);
}
- else if (event == QKeySequence::SelectEndOfLine) {
+ else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) {
end(1);
}
else if (event == QKeySequence::MoveToNextChar) {
@@ -1666,6 +1671,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
}
#endif // QT_NO_SHORTCUT
else {
+ bool handled = false;
#ifdef Q_WS_MAC
if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) {
Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier);
@@ -1683,6 +1689,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
event->key() == Qt::Key_Up ? home(0) : end(0);
}
}
+ handled = true;
}
#endif
if (event->modifiers() & Qt::ControlModifier) {
@@ -1715,7 +1722,8 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
break;
#endif
default:
- unknown = true;
+ if (!handled)
+ unknown = true;
}
} else { // ### check for *no* modifier
switch (event->key()) {
@@ -1748,7 +1756,8 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
#endif
default:
- unknown = true;
+ if (!handled)
+ unknown = true;
}
}
}
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 3800224..785b2bd 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1411,6 +1411,8 @@ bool QLineEdit::event(QEvent * e)
QTimer::singleShot(0, this, SLOT(_q_handleWindowActivate()));
}else if(e->type() == QEvent::ShortcutOverride){
d->control->processEvent(e);
+ } else if (e->type() == QEvent::KeyRelease) {
+ d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime());
}
#ifdef QT_KEYPAD_NAVIGATION
@@ -1615,6 +1617,8 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
}
#endif
d->control->processKeyEvent(event);
+ if (event->isAccepted())
+ d->control->setCursorBlinkPeriod(0);
}
/*!
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 501e62f..557acfb 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -120,6 +120,7 @@ void QMainWindowPrivate::init()
#ifdef QT_SOFTKEYS_ENABLED
menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q);
menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction"));
+ menuBarAction->setVisible(false);
#endif
}
diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp
index b3288c3..f3dbe34 100644
--- a/src/gui/widgets/qmdiarea.cpp
+++ b/src/gui/widgets/qmdiarea.cpp
@@ -1947,8 +1947,10 @@ QMdiSubWindow *QMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags windowFla
/*!
Removes \a widget from the MDI area. The \a widget must be
either a QMdiSubWindow or a widget that is the internal widget of
- a subwindow. Note that the subwindow is not deleted by QMdiArea
- and that its parent is set to 0.
+ a subwindow. Note \a widget is never actually deleted by QMdiArea.
+ If a QMdiSubWindow is passed in its parent is set to 0 and it is
+ removed, but if an internal widget is passed in the child widget
+ is set to 0 but the QMdiSubWindow is not removed.
\sa addSubWindow()
*/
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 761a060..2e27226 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -229,7 +229,7 @@ void QMenuPrivate::updateActionRects() const
Q_Q(const QMenu);
if (!itemsDirty)
return;
-
+
q->ensurePolished();
//let's reinitialize the buffer
@@ -292,7 +292,7 @@ void QMenuPrivate::updateActionRects() const
if (!action->isVisible() ||
(collapsibleSeparators && previousWasSeparator && action->isSeparator()))
continue; // we continue, this action will get an empty QRect
-
+
previousWasSeparator = action->isSeparator();
//let the style modify the above size..
@@ -1139,7 +1139,7 @@ void QMenuPrivate::_q_actionTriggered()
//we check the parent hierarchy
QList< QPointer<QWidget> > list;
for(QWidget *widget = q->parentWidget(); widget; ) {
- if (qobject_cast<QMenu*>(widget)
+ if (qobject_cast<QMenu*>(widget)
#ifndef QT_NO_MENUBAR
|| qobject_cast<QMenuBar*>(widget)
#endif
@@ -1306,7 +1306,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
the addAction(), addActions() and insertAction() functions. An action
is represented vertically and rendered by QStyle. In addition, actions
can have a text label, an optional icon drawn on the very left side,
- and shortcut key sequence such as "Ctrl+X".
+ and shortcut key sequence such as "Ctrl+X".
The existing actions held by a menu can be found with actions().
@@ -1906,9 +1906,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
pos.setX(qMax(p.x()-size.width(), screen.right()-desktopFrame-size.width()+1));
} else {
if (pos.x()+size.width()-1 > screen.right()-desktopFrame)
- pos.setX(qMin(p.x()+size.width(), screen.right()-desktopFrame-size.width()+1));
+ pos.setX(screen.right()-desktopFrame-size.width()+1);
if (pos.x() < screen.left()+desktopFrame)
- pos.setX(qMax(p.x(), screen.left() + desktopFrame));
+ pos.setX(screen.left() + desktopFrame);
}
if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) {
if(snapToMouse)
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 9510cc6..30bbd31 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -763,7 +763,9 @@ QMacMenuAction::~QMacMenuAction()
{
#ifdef QT_MAC_USE_COCOA
[menu release];
- if (action) {
+ // Update the menu item if this action still owns it. For some items
+ // (like 'Quit') ownership will be transferred between all menu bars...
+ if (action && action.data() == reinterpret_cast<QAction *>([menuItem tag])) {
QAction::MenuRole role = action->menuRole();
// Check if the item is owned by Qt, and should be hidden to keep it from causing
// problems. Do it for everything but the quit menu item since that should always
@@ -774,8 +776,8 @@ QMacMenuAction::~QMacMenuAction()
&& menuItem != [getMenuLoader() quitMenuItem]) {
[menuItem setHidden:YES];
}
+ [menuItem setTag:nil];
}
- [menuItem setTag:nil];
[menuItem release];
#endif
}
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index e50de02..599f15b 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -736,6 +736,9 @@ void QMenuBarPrivate::init()
if(wce_menubar)
q->hide();
}
+ else {
+ QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);
+ }
#endif
#ifdef Q_WS_S60
symbianCreateMenuBar(q->parentWidget());
@@ -1486,7 +1489,8 @@ bool QMenuBar::event(QEvent *e)
break;
case QEvent::ShortcutOverride: {
QKeyEvent *kev = static_cast<QKeyEvent*>(e);
- if (kev->key() == Qt::Key_Escape) {
+ //we only filter out escape if there is a current action
+ if (kev->key() == Qt::Key_Escape && d->currentAction) {
e->accept();
return true;
}
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index c7759e8..eae8b7d 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -1802,6 +1802,9 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e)
QTextBlock block = firstVisibleBlock();
qreal maximumWidth = document()->documentLayout()->documentSize().width();
+ // Set a brush origin so that the WaveUnderline knows where the wave started
+ painter.setBrushOrigin(offset);
+
// keep right margin clean from full-width selection
int maxX = offset.x() + qMax((qreal)viewportRect.width(), maximumWidth)
- document()->documentMargin();
diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp
index cf193dc..6575dbb 100644
--- a/src/gui/widgets/qsizegrip.cpp
+++ b/src/gui/widgets/qsizegrip.cpp
@@ -99,6 +99,7 @@ public:
int dyMax;
Qt::Corner m_corner;
bool gotMousePress;
+ QWidget *tlw;
#ifdef Q_WS_MAC
void updateMacSizer(bool hide) const;
#endif
@@ -113,6 +114,19 @@ public:
return m_corner == Qt::BottomLeftCorner || m_corner == Qt::TopLeftCorner;
}
+ void updateTopLevelWidget()
+ {
+ Q_Q(QSizeGrip);
+ QWidget *w = qt_sizegrip_topLevelWidget(q);
+ if (tlw == w)
+ return;
+ if (tlw)
+ tlw->removeEventFilter(q);
+ tlw = w;
+ if (tlw)
+ tlw->installEventFilter(q);
+ }
+
// This slot is invoked by QLayout when the size grip is added to
// a layout or reparented after the tlw is shown. This re-implementation is basically
// the same as QWidgetPrivate::_q_showIfNotHidden except that it checks
@@ -121,7 +135,7 @@ public:
{
Q_Q(QSizeGrip);
bool showSizeGrip = !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide));
- QWidget *tlw = qt_sizegrip_topLevelWidget(q);
+ updateTopLevelWidget();
if (tlw && showSizeGrip) {
Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen;
#ifndef Q_WS_MAC
@@ -232,6 +246,7 @@ void QSizeGripPrivate::init()
Q_Q(QSizeGrip);
dxMax = 0;
dyMax = 0;
+ tlw = 0;
m_corner = q->isLeftToRight() ? Qt::BottomRightCorner : Qt::BottomLeftCorner;
gotMousePress = false;
@@ -240,8 +255,7 @@ void QSizeGripPrivate::init()
? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor);
#endif
q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
- QWidget *tlw = qt_sizegrip_topLevelWidget(q);
- tlw->installEventFilter(q);
+ updateTopLevelWidget();
}
@@ -524,19 +538,18 @@ void QSizeGrip::setVisible(bool visible)
/*! \reimp */
bool QSizeGrip::eventFilter(QObject *o, QEvent *e)
{
+ Q_D(QSizeGrip);
if ((isHidden() && testAttribute(Qt::WA_WState_ExplicitShowHide))
- || e->type() != QEvent::WindowStateChange) {
+ || e->type() != QEvent::WindowStateChange
+ || o != d->tlw) {
return QWidget::eventFilter(o, e);
}
- QWidget *tlw = qt_sizegrip_topLevelWidget(this);
- if (o != tlw)
- return QWidget::eventFilter(o, e);
Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen;
#ifndef Q_WS_MAC
sizeGripNotVisibleState |= Qt::WindowMaximized;
#endif
// Don't show the size grip if the tlw is maximized or in full screen mode.
- setVisible(!(tlw->windowState() & sizeGripNotVisibleState));
+ setVisible(!(d->tlw->windowState() & sizeGripNotVisibleState));
setAttribute(Qt::WA_WState_ExplicitShowHide, false);
return QWidget::eventFilter(o, e);
}
diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp
index 9eb07ac..50b225c 100644
--- a/src/gui/widgets/qspinbox.cpp
+++ b/src/gui/widgets/qspinbox.cpp
@@ -65,14 +65,13 @@ class QSpinBoxPrivate : public QAbstractSpinBoxPrivate
{
Q_DECLARE_PUBLIC(QSpinBox)
public:
- QSpinBoxPrivate(QWidget *parent = 0);
+ QSpinBoxPrivate();
void emitSignals(EmitPolicy ep, const QVariant &);
virtual QVariant valueFromText(const QString &n) const;
virtual QString textFromValue(const QVariant &n) const;
QVariant validateAndInterpret(QString &input, int &pos,
QValidator::State &state) const;
- QChar thousand;
inline void init() {
Q_Q(QSpinBox);
@@ -85,7 +84,7 @@ class QDoubleSpinBoxPrivate : public QAbstractSpinBoxPrivate
{
Q_DECLARE_PUBLIC(QDoubleSpinBox)
public:
- QDoubleSpinBoxPrivate(QWidget *parent = 0);
+ QDoubleSpinBoxPrivate();
void emitSignals(EmitPolicy ep, const QVariant &);
virtual QVariant valueFromText(const QString &n) const;
@@ -95,7 +94,6 @@ public:
double round(double input) const;
// variables
int decimals;
- QChar delimiter, thousand;
inline void init() {
Q_Q(QDoubleSpinBox);
@@ -201,7 +199,7 @@ public:
*/
QSpinBox::QSpinBox(QWidget *parent)
- : QAbstractSpinBox(*new QSpinBoxPrivate(parent), parent)
+ : QAbstractSpinBox(*new QSpinBoxPrivate, parent)
{
Q_D(QSpinBox);
d->init();
@@ -213,7 +211,7 @@ QSpinBox::QSpinBox(QWidget *parent)
argument and then use setObjectName() instead.
*/
QSpinBox::QSpinBox(QWidget *parent, const char *name)
- : QAbstractSpinBox(*new QSpinBoxPrivate(parent), parent)
+ : QAbstractSpinBox(*new QSpinBoxPrivate, parent)
{
Q_D(QSpinBox);
setObjectName(QString::fromAscii(name));
@@ -225,7 +223,7 @@ QSpinBox::QSpinBox(QWidget *parent, const char *name)
argument and then use setObjectName() instead.
*/
QSpinBox::QSpinBox(int minimum, int maximum, int step, QWidget *parent, const char *name)
- : QAbstractSpinBox(*new QSpinBoxPrivate(parent), parent)
+ : QAbstractSpinBox(*new QSpinBoxPrivate, parent)
{
Q_D(QSpinBox);
d->minimum = QVariant(qMin<int>(minimum, maximum));
@@ -464,10 +462,9 @@ void QSpinBox::setRange(int minimum, int maximum)
QString QSpinBox::textFromValue(int value) const
{
- Q_D(const QSpinBox);
QString str = locale().toString(value);
if (qAbs(value) >= 1000 || value == INT_MIN) {
- str.remove(d->thousand);
+ str.remove(locale().groupSeparator());
}
return str;
@@ -516,9 +513,7 @@ QValidator::State QSpinBox::validate(QString &text, int &pos) const
*/
void QSpinBox::fixup(QString &input) const
{
- Q_D(const QSpinBox);
-
- input.remove(d->thousand);
+ input.remove(locale().groupSeparator());
}
@@ -600,7 +595,7 @@ void QSpinBox::fixup(QString &input) const
\sa setMinimum(), setMaximum(), setSingleStep()
*/
QDoubleSpinBox::QDoubleSpinBox(QWidget *parent)
- : QAbstractSpinBox(*new QDoubleSpinBoxPrivate(parent), parent)
+ : QAbstractSpinBox(*new QDoubleSpinBoxPrivate, parent)
{
Q_D(QDoubleSpinBox);
d->init();
@@ -875,7 +870,7 @@ QString QDoubleSpinBox::textFromValue(double value) const
Q_D(const QDoubleSpinBox);
QString str = locale().toString(value, 'f', d->decimals);
if (qAbs(value) >= 1000.0) {
- str.remove(d->thousand);
+ str.remove(locale().groupSeparator());
}
return str;
}
@@ -920,9 +915,7 @@ QValidator::State QDoubleSpinBox::validate(QString &text, int &pos) const
*/
void QDoubleSpinBox::fixup(QString &input) const
{
- Q_D(const QDoubleSpinBox);
-
- input.remove(d->thousand);
+ input.remove(locale().groupSeparator());
}
// --- QSpinBoxPrivate ---
@@ -932,18 +925,13 @@ void QDoubleSpinBox::fixup(QString &input) const
Constructs a QSpinBoxPrivate object
*/
-QSpinBoxPrivate::QSpinBoxPrivate(QWidget *parent)
+QSpinBoxPrivate::QSpinBoxPrivate()
{
minimum = QVariant((int)0);
maximum = QVariant((int)99);
value = minimum;
singleStep = QVariant((int)1);
type = QVariant::Int;
- const QString str = (parent ? parent->locale() : QLocale()).toString(4567);
- if (str.size() == 5) {
- thousand = QChar(str.at(1));
- }
-
}
/*!
@@ -1019,20 +1007,17 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
state = QValidator::Invalid; // special-case -0 will be interpreted as 0 and thus not be invalid with a range from 0-100
} else {
bool ok = false;
- bool removedThousand = false;
num = locale.toInt(copy, &ok, 10);
- if (!ok && copy.contains(thousand) && (max >= 1000 || min <= -1000)) {
- const int s = copy.size();
- copy.remove(thousand);
- pos = qMax(0, pos - (s - copy.size()));
- removedThousand = true;
- num = locale.toInt(copy, &ok, 10);
+ if (!ok && copy.contains(locale.groupSeparator()) && (max >= 1000 || min <= -1000)) {
+ QString copy2 = copy;
+ copy2.remove(locale.groupSeparator());
+ num = locale.toInt(copy2, &ok, 10);
}
QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num;
if (!ok) {
state = QValidator::Invalid;
} else if (num >= min && num <= max) {
- state = removedThousand ? QValidator::Intermediate : QValidator::Acceptable;
+ state = QValidator::Acceptable;
} else if (max == min) {
state = QValidator::Invalid;
} else {
@@ -1064,7 +1049,7 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
Constructs a QSpinBoxPrivate object
*/
-QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate(QWidget *parent)
+QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate()
{
minimum = QVariant(0.0);
maximum = QVariant(99.99);
@@ -1072,15 +1057,6 @@ QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate(QWidget *parent)
singleStep = QVariant(1.0);
decimals = 2;
type = QVariant::Double;
- const QString str = (parent ? parent->locale() : QLocale()).toString(4567.1);
- if (str.size() == 6) {
- delimiter = str.at(4);
- thousand = QChar((ushort)0);
- } else if (str.size() == 7) {
- thousand = str.at(1);
- delimiter = str.at(5);
- }
- Q_ASSERT(!delimiter.isNull());
}
/*!
@@ -1155,7 +1131,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
state = max != min ? QValidator::Intermediate : QValidator::Invalid;
goto end;
case 1:
- if (copy.at(0) == delimiter
+ if (copy.at(0) == locale.decimalPoint()
|| (plus && copy.at(0) == QLatin1Char('+'))
|| (minus && copy.at(0) == QLatin1Char('-'))) {
state = QValidator::Intermediate;
@@ -1163,7 +1139,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
}
break;
case 2:
- if (copy.at(1) == delimiter
+ if (copy.at(1) == locale.decimalPoint()
&& ((plus && copy.at(0) == QLatin1Char('+')) || (minus && copy.at(0) == QLatin1Char('-')))) {
state = QValidator::Intermediate;
goto end;
@@ -1172,14 +1148,14 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
default: break;
}
- if (copy.at(0) == thousand) {
+ if (copy.at(0) == locale.groupSeparator()) {
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
state = QValidator::Invalid;
goto end;
} else if (len > 1) {
- const int dec = copy.indexOf(delimiter);
+ const int dec = copy.indexOf(locale.decimalPoint());
if (dec != -1) {
- if (dec + 1 < copy.size() && copy.at(dec + 1) == delimiter && pos == dec + 1) {
+ if (dec + 1 < copy.size() && copy.at(dec + 1) == locale.decimalPoint() && pos == dec + 1) {
copy.remove(dec + 1, 1); // typing a delimiter when you are on the delimiter
} // should be treated as typing right arrow
@@ -1189,7 +1165,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
goto end;
}
for (int i=dec + 1; i<copy.size(); ++i) {
- if (copy.at(i).isSpace() || copy.at(i) == thousand) {
+ if (copy.at(i).isSpace() || copy.at(i) == locale.groupSeparator()) {
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
state = QValidator::Invalid;
goto end;
@@ -1198,12 +1174,12 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
} else {
const QChar &last = copy.at(len - 1);
const QChar &secondLast = copy.at(len - 2);
- if ((last == thousand || last.isSpace())
- && (secondLast == thousand || secondLast.isSpace())) {
+ if ((last == locale.groupSeparator() || last.isSpace())
+ && (secondLast == locale.groupSeparator() || secondLast.isSpace())) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
- } else if (last.isSpace() && (!thousand.isSpace() || secondLast.isSpace())) {
+ } else if (last.isSpace() && (!locale.groupSeparator().isSpace() || secondLast.isSpace())) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
@@ -1215,11 +1191,10 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
bool ok = false;
num = locale.toDouble(copy, &ok);
QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok;
- bool notAcceptable = false;
if (!ok) {
- if (thousand.isPrint()) {
- if (max < 1000 && min > -1000 && copy.contains(thousand)) {
+ if (locale.groupSeparator().isPrint()) {
+ if (max < 1000 && min > -1000 && copy.contains(locale.groupSeparator())) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
@@ -1227,27 +1202,23 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
const int len = copy.size();
for (int i=0; i<len- 1; ++i) {
- if (copy.at(i) == thousand && copy.at(i + 1) == thousand) {
+ if (copy.at(i) == locale.groupSeparator() && copy.at(i + 1) == locale.groupSeparator()) {
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
state = QValidator::Invalid;
goto end;
}
}
- const int s = copy.size();
- copy.remove(thousand);
- pos = qMax(0, pos - (s - copy.size()));
-
-
- num = locale.toDouble(copy, &ok);
- QSBDEBUG() << thousand << num << copy << ok;
+ QString copy2 = copy;
+ copy2.remove(locale.groupSeparator());
+ num = locale.toDouble(copy2, &ok);
+ QSBDEBUG() << locale.groupSeparator() << num << copy2 << ok;
if (!ok) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
}
- notAcceptable = true;
}
}
@@ -1255,9 +1226,8 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
} else if (num >= min && num <= max) {
- state = notAcceptable ? QValidator::Intermediate : QValidator::Acceptable;
- QSBDEBUG() << __FILE__ << __LINE__<< "state is set to "
- << (state == QValidator::Intermediate ? "Intermediate" : "Acceptable");
+ state = QValidator::Acceptable;
+ QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Acceptable";
} else if (max == min) { // when max and min is the same the only non-Invalid input is max (or min)
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 3935c55..8ef6017 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -1948,7 +1948,8 @@ void QTabBar::changeEvent(QEvent *event)
Q_D(QTabBar);
if (event->type() == QEvent::StyleChange) {
d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this));
- d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this);
+ if (!d->useScrollButtonsSetByUser)
+ d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this);
d->refresh();
} else if (event->type() == QEvent::FontChange) {
d->refresh();
@@ -2003,6 +2004,7 @@ bool QTabBar::usesScrollButtons() const
void QTabBar::setUsesScrollButtons(bool useButtons)
{
Q_D(QTabBar);
+ d->useScrollButtonsSetByUser = true;
if (d->useScrollButtons == useButtons)
return;
d->useScrollButtons = useButtons;
diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h
index 9f3285b..2e8fb6d 100644
--- a/src/gui/widgets/qtabbar_p.h
+++ b/src/gui/widgets/qtabbar_p.h
@@ -75,7 +75,7 @@ class QTabBarPrivate : public QWidgetPrivate
public:
QTabBarPrivate()
:currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false),
- drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false),
+ drawBase(true), scrollOffset(0), useScrollButtonsSetByUser(false) , expanding(true), closeButtonOnTabs(false),
selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false),
dragInProgress(false), documentMode(false), movingTab(0)
#ifdef Q_WS_MAC
@@ -187,6 +187,7 @@ public:
QSize iconSize;
Qt::TextElideMode elideMode;
bool useScrollButtons;
+ bool useScrollButtonsSetByUser;
bool expanding;
bool closeButtonOnTabs;
diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h
index f0ab80c..134e95a 100644
--- a/src/gui/widgets/qtoolbararealayout_p.h
+++ b/src/gui/widgets/qtoolbararealayout_p.h
@@ -118,7 +118,7 @@ public:
void extendSize(Qt::Orientation o, int extent)
{
- int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : size) + extent);
+ int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : pick(o, sizeHint())) + extent);
int sizeh = pick(o, sizeHint());
if (newSize == sizeh) {
preferredSize = -1;
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp
index 19f7217..f826115 100644
--- a/src/network/access/qnetworkcookiejar.cpp
+++ b/src/network/access/qnetworkcookiejar.cpp
@@ -192,9 +192,10 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis
// validate the cookie & set the defaults if unset
if (cookie.path().isEmpty())
cookie.setPath(defaultPath);
- else if (!isParentPath(pathAndFileName, cookie.path()))
- continue; // not accepted
-
+ // don't do path checking. See http://bugreports.qt.nokia.com/browse/QTBUG-5815
+// else if (!isParentPath(pathAndFileName, cookie.path())) {
+// continue; // not accepted
+// }
if (cookie.domain().isEmpty()) {
cookie.setDomain(defaultDomain);
} else {
diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp
index 6f92424..0e2dd2b 100644
--- a/src/network/kernel/qnetworkproxy_win.cpp
+++ b/src/network/kernel/qnetworkproxy_win.cpp
@@ -291,7 +291,10 @@ void QWindowsSystemProxy::init()
GlobalFree(ieProxyConfig.lpszAutoConfigUrl);
}
if (ieProxyConfig.lpszProxy) {
- proxyServerList << QString::fromWCharArray(ieProxyConfig.lpszProxy);
+ // http://msdn.microsoft.com/en-us/library/aa384250%28VS.85%29.aspx speaks only about a "proxy URL",
+ // not multiple URLs. However we tested this and it can return multiple URLs. So we use splitSpaceSemicolon
+ // on it.
+ proxyServerList = splitSpaceSemicolon(QString::fromWCharArray(ieProxyConfig.lpszProxy));
GlobalFree(ieProxyConfig.lpszProxy);
}
if (ieProxyConfig.lpszProxyBypass) {
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 823f919..07432c6 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1773,13 +1773,10 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
#if !defined(QT_OPENGL_ES_2)
- if (!d->device->format().alpha()
#if defined(Q_WS_WIN)
- && qt_cleartype_enabled
+ if (qt_cleartype_enabled)
#endif
- ) {
d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
- }
#endif
#if defined(QT_OPENGL_ES_2)
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
index 1478b09..c78f73f 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
@@ -209,6 +209,65 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen)
}
}
+void QTriangulatingStroker::moveTo(const qreal *pts)
+{
+ m_cx = pts[0];
+ m_cy = pts[1];
+
+ float x2 = pts[2];
+ float y2 = pts[3];
+ normalVector(m_cx, m_cy, x2, y2, &m_nvx, &m_nvy);
+
+
+ // To acheive jumps we insert zero-area tringles. This is done by
+ // adding two identical points in both the end of previous strip
+ // and beginning of next strip
+ bool invisibleJump = m_vertices.size();
+
+ switch (m_cap_style) {
+ case Qt::FlatCap:
+ if (invisibleJump) {
+ m_vertices.add(m_cx + m_nvx);
+ m_vertices.add(m_cy + m_nvy);
+ }
+ break;
+ case Qt::SquareCap: {
+ float sx = m_cx - m_nvy;
+ float sy = m_cy + m_nvx;
+ if (invisibleJump) {
+ m_vertices.add(sx + m_nvx);
+ m_vertices.add(sy + m_nvy);
+ }
+ emitLineSegment(sx, sy, m_nvx, m_nvy);
+ break; }
+ case Qt::RoundCap: {
+ QVarLengthArray<float> points;
+ arcPoints(m_cx, m_cy, m_cx + m_nvx, m_cy + m_nvy, m_cx - m_nvx, m_cy - m_nvy, points);
+ m_vertices.resize(m_vertices.size() + points.size() + 2 * int(invisibleJump));
+ int count = m_vertices.size();
+ int front = 0;
+ int end = points.size() / 2;
+ while (front != end) {
+ m_vertices.at(--count) = points[2 * end - 1];
+ m_vertices.at(--count) = points[2 * end - 2];
+ --end;
+ if (front == end)
+ break;
+ m_vertices.at(--count) = points[2 * front + 1];
+ m_vertices.at(--count) = points[2 * front + 0];
+ ++front;
+ }
+
+ if (invisibleJump) {
+ m_vertices.at(count - 1) = m_vertices.at(count + 1);
+ m_vertices.at(count - 2) = m_vertices.at(count + 0);
+ }
+ break; }
+ default: break; // ssssh gcc...
+ }
+ emitLineSegment(m_cx, m_cy, m_nvx, m_nvy);
+}
+
void QTriangulatingStroker::cubicTo(const qreal *pts)
{
const QPointF *p = (const QPointF *) pts;
@@ -246,6 +305,151 @@ void QTriangulatingStroker::cubicTo(const qreal *pts)
m_nvy = vy;
}
+void QTriangulatingStroker::join(const qreal *pts)
+{
+ // Creates a join to the next segment (m_cx, m_cy) -> (pts[0], pts[1])
+ normalVector(m_cx, m_cy, pts[0], pts[1], &m_nvx, &m_nvy);
+
+ switch (m_join_style) {
+ case Qt::BevelJoin:
+ break;
+ case Qt::MiterJoin: {
+ // Find out on which side the join should be.
+ int count = m_vertices.size();
+ float prevNvx = m_vertices.at(count - 2) - m_cx;
+ float prevNvy = m_vertices.at(count - 1) - m_cy;
+ float xprod = prevNvx * m_nvy - prevNvy * m_nvx;
+ float px, py, qx, qy;
+
+ // If the segments are parallel, use bevel join.
+ if (qFuzzyIsNull(xprod))
+ break;
+
+ // Find the corners of the previous and next segment to join.
+ if (xprod < 0) {
+ px = m_vertices.at(count - 2);
+ py = m_vertices.at(count - 1);
+ qx = m_cx - m_nvx;
+ qy = m_cy - m_nvy;
+ } else {
+ px = m_vertices.at(count - 4);
+ py = m_vertices.at(count - 3);
+ qx = m_cx + m_nvx;
+ qy = m_cy + m_nvy;
+ }
+
+ // Find intersection point.
+ float pu = px * prevNvx + py * prevNvy;
+ float qv = qx * m_nvx + qy * m_nvy;
+ float ix = (m_nvy * pu - prevNvy * qv) / xprod;
+ float iy = (prevNvx * qv - m_nvx * pu) / xprod;
+
+ // Check that the distance to the intersection point is less than the miter limit.
+ if ((ix - px) * (ix - px) + (iy - py) * (iy - py) <= m_miter_limit * m_miter_limit) {
+ m_vertices.add(ix);
+ m_vertices.add(iy);
+ m_vertices.add(ix);
+ m_vertices.add(iy);
+ }
+ // else
+ // Do a plain bevel join if the miter limit is exceeded or if
+ // the lines are parallel. This is not what the raster
+ // engine's stroker does, but it is both faster and similar to
+ // what some other graphics API's do.
+
+ break; }
+ case Qt::RoundJoin: {
+ QVarLengthArray<float> points;
+ int count = m_vertices.size();
+ float prevNvx = m_vertices.at(count - 2) - m_cx;
+ float prevNvy = m_vertices.at(count - 1) - m_cy;
+ if (m_nvx * prevNvy - m_nvy * prevNvx < 0) {
+ arcPoints(0, 0, m_nvx, m_nvy, -prevNvx, -prevNvy, points);
+ for (int i = points.size() / 2; i > 0; --i)
+ emitLineSegment(m_cx, m_cy, points[2 * i - 2], points[2 * i - 1]);
+ } else {
+ arcPoints(0, 0, -prevNvx, -prevNvy, m_nvx, m_nvy, points);
+ for (int i = 0; i < points.size() / 2; ++i)
+ emitLineSegment(m_cx, m_cy, points[2 * i + 0], points[2 * i + 1]);
+ }
+ break; }
+ default: break; // gcc warn--
+ }
+
+ emitLineSegment(m_cx, m_cy, m_nvx, m_nvy);
+}
+
+void QTriangulatingStroker::endCap(const qreal *)
+{
+ switch (m_cap_style) {
+ case Qt::FlatCap:
+ break;
+ case Qt::SquareCap:
+ emitLineSegment(m_cx + m_nvy, m_cy - m_nvx, m_nvx, m_nvy);
+ break;
+ case Qt::RoundCap: {
+ QVarLengthArray<float> points;
+ int count = m_vertices.size();
+ arcPoints(m_cx, m_cy, m_vertices.at(count - 2), m_vertices.at(count - 1), m_vertices.at(count - 4), m_vertices.at(count - 3), points);
+ int front = 0;
+ int end = points.size() / 2;
+ while (front != end) {
+ m_vertices.add(points[2 * end - 2]);
+ m_vertices.add(points[2 * end - 1]);
+ --end;
+ if (front == end)
+ break;
+ m_vertices.add(points[2 * front + 0]);
+ m_vertices.add(points[2 * front + 1]);
+ ++front;
+ }
+ break; }
+ default: break; // to shut gcc up...
+ }
+}
+
+void QTriangulatingStroker::arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray<float> &points)
+{
+ float dx1 = fromX - cx;
+ float dy1 = fromY - cy;
+ float dx2 = toX - cx;
+ float dy2 = toY - cy;
+
+ // while more than 180 degrees left:
+ while (dx1 * dy2 - dx2 * dy1 < 0) {
+ float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta;
+ float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta;
+ dx1 = tmpx;
+ dy1 = tmpy;
+ points.append(cx + dx1);
+ points.append(cy + dy1);
+ }
+
+ // while more than 90 degrees left:
+ while (dx1 * dx2 + dy1 * dy2 < 0) {
+ float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta;
+ float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta;
+ dx1 = tmpx;
+ dy1 = tmpy;
+ points.append(cx + dx1);
+ points.append(cy + dy1);
+ }
+
+ // while more than 0 degrees left:
+ while (dx1 * dy2 - dx2 * dy1 > 0) {
+ float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta;
+ float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta;
+ dx1 = tmpx;
+ dy1 = tmpy;
+ points.append(cx + dx1);
+ points.append(cy + dy1);
+ }
+
+ // remove last point which was rotated beyond [toX, toY].
+ if (!points.isEmpty())
+ points.resize(points.size() - 2);
+}
+
static void qdashprocessor_moveTo(qreal x, qreal y, void *data)
{
((QDashedStrokeProcessor *) data)->addElement(QPainterPath::MoveToElement, x, y);
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
index a0117d5..2dba0ce 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
@@ -43,6 +43,7 @@
#define QTRIANGULATINGSTROKER_P_H
#include <private/qdatabuffer_p.h>
+#include <qvarlengtharray.h>
#include <private/qvectorpath_p.h>
#include <private/qbezier_p.h>
#include <private/qnumeric_p.h>
@@ -62,13 +63,13 @@ public:
private:
inline void emitLineSegment(float x, float y, float nx, float ny);
- inline void moveTo(const qreal *pts);
+ void moveTo(const qreal *pts);
inline void lineTo(const qreal *pts);
void cubicTo(const qreal *pts);
- inline void join(const qreal *pts);
+ void join(const qreal *pts);
inline void normalVector(float x1, float y1, float x2, float y2, float *nx, float *ny);
- inline void endCap(const qreal *pts);
- inline void arc(float x, float y);
+ void endCap(const qreal *pts);
+ void arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray<float> &points);
void endCapOrJoinClosed(const qreal *start, const qreal *cur, bool implicitClose, bool endsAtStart);
@@ -116,10 +117,6 @@ private:
qreal m_inv_scale;
};
-
-
-
-
inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, float y2,
float *nx, float *ny)
{
@@ -139,8 +136,6 @@ inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, fl
*ny = dx * pw;
}
-
-
inline void QTriangulatingStroker::emitLineSegment(float x, float y, float vx, float vy)
{
m_vertices.add(x + vx);
@@ -149,103 +144,6 @@ inline void QTriangulatingStroker::emitLineSegment(float x, float y, float vx, f
m_vertices.add(y - vy);
}
-
-
-// We draw a full circle for any round join or round cap which is a
-// bit of overkill...
-inline void QTriangulatingStroker::arc(float x, float y)
-{
- float dx = m_width;
- float dy = 0;
- for (int i=0; i<=m_roundness; ++i) {
- float tmpx = dx * m_cos_theta - dy * m_sin_theta;
- float tmpy = dx * m_sin_theta + dy * m_cos_theta;
- dx = tmpx;
- dy = tmpy;
- emitLineSegment(x, y, dx, dy);
- }
-}
-
-
-
-inline void QTriangulatingStroker::endCap(const qreal *pts)
-{
- switch (m_cap_style) {
- case Qt::FlatCap:
- break;
- case Qt::SquareCap: {
- float dx = m_cx - *(pts - 2);
- float dy = m_cy - *(pts - 1);
-
- float len = m_width / sqrt(dx * dx + dy * dy);
- dx = dx * len;
- dy = dy * len;
-
- emitLineSegment(m_cx + dx, m_cy + dy, m_nvx, m_nvy);
- break; }
- case Qt::RoundCap:
- arc(m_cx, m_cy);
- break;
- default: break; // to shut gcc up...
- }
-}
-
-
-void QTriangulatingStroker::moveTo(const qreal *pts)
-{
- m_cx = pts[0];
- m_cy = pts[1];
-
- float x2 = pts[2];
- float y2 = pts[3];
- normalVector(m_cx, m_cy, x2, y2, &m_nvx, &m_nvy);
-
-
- // To acheive jumps we insert zero-area tringles. This is done by
- // adding two identical points in both the end of previous strip
- // and beginning of next strip
- bool invisibleJump = m_vertices.size();
-
- switch (m_cap_style) {
- case Qt::FlatCap:
- if (invisibleJump) {
- m_vertices.add(m_cx + m_nvx);
- m_vertices.add(m_cy + m_nvy);
- }
- break;
- case Qt::SquareCap: {
- float dx = x2 - m_cx;
- float dy = y2 - m_cy;
- float len = m_width / sqrt(dx * dx + dy * dy);
- dx = dx * len;
- dy = dy * len;
- float sx = m_cx - dx;
- float sy = m_cy - dy;
- if (invisibleJump) {
- m_vertices.add(sx + m_nvx);
- m_vertices.add(sy + m_nvy);
- }
- emitLineSegment(sx, sy, m_nvx, m_nvy);
- break; }
- case Qt::RoundCap:
- if (invisibleJump) {
- m_vertices.add(m_cx + m_nvx);
- m_vertices.add(m_cy + m_nvy);
- }
-
- // This emitLineSegment is not needed for the arc, but we need
- // to start where we put the invisibleJump vertex, otherwise
- // we'll have visible triangles between subpaths.
- emitLineSegment(m_cx, m_cy, m_nvx, m_nvy);
- arc(m_cx, m_cy);
- break;
- default: break; // ssssh gcc...
- }
- emitLineSegment(m_cx, m_cy, m_nvx, m_nvy);
-}
-
-
-
void QTriangulatingStroker::lineTo(const qreal *pts)
{
emitLineSegment(pts[0], pts[1], m_nvx, m_nvy);
@@ -253,52 +151,6 @@ void QTriangulatingStroker::lineTo(const qreal *pts)
m_cy = pts[1];
}
-
-
-void QTriangulatingStroker::join(const qreal *pts)
-{
- // Creates a join to the next segment (m_cx, m_cy) -> (pts[0], pts[1])
- normalVector(m_cx, m_cy, pts[0], pts[1], &m_nvx, &m_nvy);
-
- switch (m_join_style) {
- case Qt::BevelJoin:
- break;
- case Qt::MiterJoin: {
- int p1 = m_vertices.size() - 6;
- int p2 = m_vertices.size() - 2;
- QLineF line(m_vertices.at(p1), m_vertices.at(p1+1),
- m_vertices.at(p2), m_vertices.at(p2+1));
- QLineF nextLine(m_cx - m_nvx, m_cy - m_nvy,
- pts[0] - m_nvx, pts[1] - m_nvy);
-
- QPointF isect;
- if (line.intersect(nextLine, &isect) != QLineF::NoIntersection
- && QLineF(line.p2(), isect).length() <= m_miter_limit) {
- // The intersection point mirrored over the m_cx, m_cy point
- m_vertices.add(m_cx - (isect.x() - m_cx));
- m_vertices.add(m_cy - (isect.y() - m_cy));
-
- // The intersection point
- m_vertices.add(isect.x());
- m_vertices.add(isect.y());
- }
- // else
- // Do a plain bevel join if the miter limit is exceeded or if
- // the lines are parallel. This is not what the raster
- // engine's stroker does, but it is both faster and similar to
- // what some other graphics API's do.
-
- break; }
- case Qt::RoundJoin:
- arc(m_cx, m_cy);
- break;
-
- default: break; // gcc warn--
- }
-
- emitLineSegment(m_cx, m_cy, m_nvx, m_nvy);
-}
-
QT_END_NAMESPACE
#endif
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 75b7fa5..6b829dd 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -1570,12 +1570,6 @@ void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
d->dirty |= QPaintEngine::DirtyClipRegion;
- // If we have a non-simple transform, then use path-based clipping.
- if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) {
- QPaintEngineEx::clip(rect, op);
- return;
- }
-
switch (op) {
case Qt::NoClip:
{
@@ -1612,12 +1606,6 @@ void QVGPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
d->dirty |= QPaintEngine::DirtyClipRegion;
- // If we have a non-simple transform, then use path-based clipping.
- if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) {
- QPaintEngineEx::clip(region, op);
- return;
- }
-
switch (op) {
case Qt::NoClip:
{
@@ -3407,6 +3395,34 @@ void QVGPaintEngine::restoreState(QPaintEngine::DirtyFlags dirty)
#endif
}
+void QVGPaintEngine::fillRegion
+ (const QRegion& region, const QColor& color, const QSize& surfaceSize)
+{
+ Q_D(QVGPaintEngine);
+ if (d->clearColor != color || d->clearOpacity != 1.0f) {
+ VGfloat values[4];
+ values[0] = color.redF();
+ values[1] = color.greenF();
+ values[2] = color.blueF();
+ values[3] = color.alphaF();
+ vgSetfv(VG_CLEAR_COLOR, 4, values);
+ d->clearColor = color;
+ d->clearOpacity = 1.0f;
+ }
+ if (region.rectCount() == 1) {
+ QRect r = region.boundingRect();
+ vgClear(r.x(), surfaceSize.height() - r.y() - r.height(),
+ r.width(), r.height());
+ } else {
+ const QVector<QRect> rects = region.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ QRect r = rects.at(i);
+ vgClear(r.x(), surfaceSize.height() - r.y() - r.height(),
+ r.width(), r.height());
+ }
+ }
+}
+
#if !defined(QVG_NO_SINGLE_CONTEXT) && !defined(QT_NO_EGL)
QVGCompositionHelper::QVGCompositionHelper()
@@ -3431,14 +3447,11 @@ void QVGCompositionHelper::endCompositing()
}
void QVGCompositionHelper::blitWindow
- (QVGEGLWindowSurfacePrivate *surface, const QRect& rect,
- const QPoint& topLeft, int opacity)
+ (VGImage image, const QSize& imageSize,
+ const QRect& rect, const QPoint& topLeft, int opacity)
{
- // Get the VGImage that is acting as a back buffer for the window.
- VGImage image = surface->surfaceImage();
if (image == VG_INVALID_HANDLE)
return;
- QSize imageSize = surface->surfaceSize();
// Determine which sub rectangle of the window to draw.
QRect sr = rect.translated(-topLeft);
diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h
index 1202b55..86a522a 100644
--- a/src/openvg/qpaintengine_vg_p.h
+++ b/src/openvg/qpaintengine_vg_p.h
@@ -151,6 +151,8 @@ public:
QVGPaintEnginePrivate *vgPrivate() { Q_D(QVGPaintEngine); return d; }
+ void fillRegion(const QRegion& region, const QColor& color, const QSize& surfaceSize);
+
protected:
QVGPaintEngine(QVGPaintEnginePrivate &data);
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 3254aa3..19c90ed 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -92,7 +92,6 @@ QVGPixmapData::~QVGPixmapData()
vgDestroyImage(vgImage);
if (vgImageOpacity != VG_INVALID_HANDLE)
vgDestroyImage(vgImageOpacity);
- } else {
#endif
}
#if !defined(QT_NO_EGL)
@@ -202,6 +201,14 @@ QPaintEngine* QVGPixmapData::paintEngine() const
return source.paintEngine();
}
+// This function works around QImage::bits() making a deep copy if the
+// QImage is not const. We force it to be const and then get the bits.
+// XXX: Should add a QImage::constBits() in the future to replace this.
+static inline const uchar *qt_vg_imageBits(const QImage& image)
+{
+ return image.bits();
+}
+
VGImage QVGPixmapData::toVGImage()
{
if (!isValid())
@@ -213,7 +220,7 @@ VGImage QVGPixmapData::toVGImage()
context = qt_vg_create_context(0);
#endif
- if (recreate) {
+ if (recreate && prevSize != QSize(w, h)) {
if (vgImage != VG_INVALID_HANDLE) {
vgDestroyImage(vgImage);
vgImage = VG_INVALID_HANDLE;
@@ -222,6 +229,8 @@ VGImage QVGPixmapData::toVGImage()
vgDestroyImage(vgImageOpacity);
vgImageOpacity = VG_INVALID_HANDLE;
}
+ } else if (recreate) {
+ cachedOpacity = -1.0f; // Force opacity image to be refreshed later.
}
if (vgImage == VG_INVALID_HANDLE) {
@@ -232,11 +241,12 @@ VGImage QVGPixmapData::toVGImage()
if (!source.isNull() && recreate) {
vgImageSubData
(vgImage,
- source.bits(), source.bytesPerLine(),
+ qt_vg_imageBits(source), source.bytesPerLine(),
VG_sARGB_8888_PRE, 0, 0, w, h);
}
recreate = false;
+ prevSize = QSize(w, h);
return vgImage;
}
@@ -244,43 +254,14 @@ VGImage QVGPixmapData::toVGImage()
VGImage QVGPixmapData::toVGImage(qreal opacity)
{
#if !defined(QT_SHIVAVG)
- if (!isValid())
+ // Force the primary VG image to be recreated if necessary.
+ if (toVGImage() == VG_INVALID_HANDLE)
return VG_INVALID_HANDLE;
-#if !defined(QT_NO_EGL)
- // Increase the reference count on the shared context.
- if (!context)
- context = qt_vg_create_context(0);
-#endif
-
- if (recreate) {
- if (vgImage != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImage);
- vgImage = VG_INVALID_HANDLE;
- }
- if (vgImageOpacity != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImageOpacity);
- vgImageOpacity = VG_INVALID_HANDLE;
- }
- }
-
- if (vgImage == VG_INVALID_HANDLE) {
- vgImage = vgCreateImage
- (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER);
- }
-
- if (!source.isNull() && recreate) {
- vgImageSubData
- (vgImage,
- source.bits(), source.bytesPerLine(),
- VG_sARGB_8888_PRE, 0, 0, w, h);
- }
-
- recreate = false;
-
if (opacity == 1.0f)
return vgImage;
+ // Create an alternative image for the selected opacity.
if (vgImageOpacity == VG_INVALID_HANDLE || cachedOpacity != opacity) {
if (vgImageOpacity == VG_INVALID_HANDLE) {
vgImageOpacity = vgCreateImage
@@ -405,6 +386,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
vgDestroyImage(vgImageOpacity);
vgImageOpacity = VG_INVALID_HANDLE;
}
+ prevSize = QSize();
TInt err = 0;
@@ -465,6 +447,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
is_null = (w <= 0 || h <= 0);
source = QImage();
recreate = false;
+ prevSize = QSize(w, h);
setSerialNumber(++qt_vg_pixmap_serial);
// release stuff
eglDestroyImageKHR(context->display(), eglImage);
diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h
index f6fac88..fe19f35 100644
--- a/src/openvg/qpixmapdata_vg_p.h
+++ b/src/openvg/qpixmapdata_vg_p.h
@@ -109,6 +109,7 @@ protected:
#endif
protected:
+ QSize prevSize;
VGImage vgImage;
VGImage vgImageOpacity;
qreal cachedOpacity;
diff --git a/src/openvg/qvgcompositionhelper_p.h b/src/openvg/qvgcompositionhelper_p.h
index 3afe31e..ed24e73 100644
--- a/src/openvg/qvgcompositionhelper_p.h
+++ b/src/openvg/qvgcompositionhelper_p.h
@@ -71,8 +71,8 @@ public:
void startCompositing(const QSize& screenSize);
void endCompositing();
- void blitWindow(QVGEGLWindowSurfacePrivate *surface, const QRect& rect,
- const QPoint& topLeft, int opacity);
+ void blitWindow(VGImage image, const QSize& imageSize,
+ const QRect& rect, const QPoint& topLeft, int opacity);
void fillBackground(const QRegion& region, const QBrush& brush);
void drawCursorPixmap(const QPixmap& pixmap, const QPoint& offset);
void setScissor(const QRegion& region);
diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp
index f8486a6..a1301e3 100644
--- a/src/openvg/qwindowsurface_vg.cpp
+++ b/src/openvg/qwindowsurface_vg.cpp
@@ -48,6 +48,7 @@
#if !defined(QT_NO_EGL)
#include <QtGui/private/qegl_p.h>
+#include <QtGui/private/qwidget_p.h>
QT_BEGIN_NAMESPACE
@@ -71,7 +72,6 @@ QVGWindowSurface::~QVGWindowSurface()
QPaintDevice *QVGWindowSurface::paintDevice()
{
- d_ptr->beginPaint(window());
return this;
}
@@ -94,8 +94,16 @@ bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy)
void QVGWindowSurface::beginPaint(const QRegion &region)
{
- // Nothing to do here.
- Q_UNUSED(region);
+ d_ptr->beginPaint(window());
+
+ // If the window is not opaque, then fill the region we are about
+ // to paint with the transparent color.
+ if (!qt_widget_private(window())->isOpaque &&
+ window()->testAttribute(Qt::WA_TranslucentBackground)) {
+ QVGPaintEngine *engine = static_cast<QVGPaintEngine *>
+ (d_ptr->paintEngine());
+ engine->fillRegion(region, Qt::transparent, d_ptr->surfaceSize());
+ }
}
void QVGWindowSurface::endPaint(const QRegion &region)
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index 29d82c8..62871cf 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -200,6 +200,42 @@ static QEglContext *createContext(QPaintDevice *device)
else
eglSwapInterval(context->display(), 1);
+#ifdef EGL_RENDERABLE_TYPE
+ // Has the user specified an explicit EGL configuration to use?
+ QByteArray configId = qgetenv("QT_VG_EGL_CONFIG");
+ if (!configId.isEmpty()) {
+ EGLint cfgId = configId.toInt();
+ EGLint properties[] = {
+ EGL_CONFIG_ID, cfgId,
+ EGL_NONE
+ };
+ EGLint matching = 0;
+ EGLConfig cfg;
+ if (eglChooseConfig
+ (context->display(), properties, &cfg, 1, &matching) &&
+ matching > 0) {
+ // Check that the selected configuration actually supports OpenVG
+ // and then create the context with it.
+ EGLint id = 0;
+ EGLint type = 0;
+ eglGetConfigAttrib
+ (context->display(), cfg, EGL_CONFIG_ID, &id);
+ eglGetConfigAttrib
+ (context->display(), cfg, EGL_RENDERABLE_TYPE, &type);
+ if (cfgId == id && (type & EGL_OPENVG_BIT) != 0) {
+ context->setConfig(cfg);
+ if (!context->createContext()) {
+ delete context;
+ return 0;
+ }
+ return context;
+ } else {
+ qWarning("QT_VG_EGL_CONFIG: %d is not a valid OpenVG configuration", int(cfgId));
+ }
+ }
+ }
+#endif
+
// Choose an appropriate configuration for rendering into the device.
QEglProperties configProps;
configProps.setPaintDeviceFormat(device);
@@ -211,19 +247,19 @@ static QEglContext *createContext(QPaintDevice *device)
configProps.setValue(EGL_ALPHA_MASK_SIZE, 1);
#endif
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
- configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT |
+ configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT |
EGL_VG_ALPHA_FORMAT_PRE_BIT);
configProps.setRenderableType(QEgl::OpenVG);
if (!context->chooseConfig(configProps)) {
// Try again without the "pre" bit.
- configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT);
+ configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
if (!context->chooseConfig(configProps)) {
delete context;
return 0;
}
}
#else
- configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT);
+ configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
configProps.setRenderableType(QEgl::OpenVG);
if (!context->chooseConfig(configProps)) {
delete context;
diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro
index 158633d..9687908 100644
--- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro
+++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro
@@ -2,6 +2,8 @@
TEMPLATE = subdirs
# We just want to export the sqlite3 binaries for Symbian for platforms that do not have them.
-!exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) {
- BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip"
+symbian {
+ !exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) {
+ BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip"
+ }
}
diff --git a/src/qt3support/other/q3process_unix.cpp b/src/qt3support/other/q3process_unix.cpp
index 955b65f..32a68e0 100644
--- a/src/qt3support/other/q3process_unix.cpp
+++ b/src/qt3support/other/q3process_unix.cpp
@@ -249,7 +249,7 @@ int qnx6SocketPairReplacement (int socketFD[2]) {
if (errno != EINPROGRESS) { BAILOUT };
// Accept connection
- socketFD[0] = accept(tmpSocket, (struct sockaddr *)NULL, (size_t *)NULL);
+ socketFD[0] = accept(tmpSocket, (struct sockaddr *)NULL, (QT_SOCKLEN_T *)NULL);
if(socketFD[0] == -1) { BAILOUT };
// We're done
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index dc0e0d0..b6aa872 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -1101,16 +1101,6 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack)
}
}
-#ifndef QT_NO_QOBJECT
- {
- QHash<QObject*, QScript::QObjectData*>::const_iterator it;
- for (it = m_qobjectData.constBegin(); it != m_qobjectData.constEnd(); ++it) {
- QScript::QObjectData *qdata = it.value();
- qdata->mark(markStack);
- }
- }
-#endif
-
{
QHash<int, QScriptTypeInfo*>::const_iterator it;
for (it = m_typeInfos.constBegin(); it != m_typeInfos.constEnd(); ++it) {
@@ -1134,6 +1124,17 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack)
context = context->parentContext();
}
}
+
+#ifndef QT_NO_QOBJECT
+ markStack.drain(); // make sure everything is marked before marking qobject data
+ {
+ QHash<QObject*, QScript::QObjectData*>::const_iterator it;
+ for (it = m_qobjectData.constBegin(); it != m_qobjectData.constEnd(); ++it) {
+ QScript::QObjectData *qdata = it.value();
+ qdata->mark(markStack);
+ }
+ }
+#endif
}
bool QScriptEnginePrivate::isCollecting() const
diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp
index e7998b7..a2af514 100644
--- a/src/script/api/qscriptengineagent.cpp
+++ b/src/script/api/qscriptengineagent.cpp
@@ -154,7 +154,10 @@ void QScriptEngineAgentPrivate::exceptionCatch(const JSC::DebuggerCallFrame& fra
void QScriptEngineAgentPrivate::atStatement(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, int column)
{
QScript::UStringSourceProviderWithFeedback *source = engine->loadedScripts.value(sourceID);
- Q_ASSERT(source != 0);
+ if (!source) {
+ // QTBUG-6108: We don't have the source for this script, so ignore.
+ return;
+ }
column = source->columnNumberFromOffset(column);
JSC::CallFrame *oldFrame = engine->currentFrame;
int oldAgentLineNumber = engine->agentLineNumber;
@@ -183,7 +186,10 @@ void QScriptEngineAgentPrivate::didReachBreakpoint(const JSC::DebuggerCallFrame&
{
if (q_ptr->supportsExtension(QScriptEngineAgent::DebuggerInvocationRequest)) {
QScript::UStringSourceProviderWithFeedback *source = engine->loadedScripts.value(sourceID);
- Q_ASSERT(source != 0);
+ if (!source) {
+ // QTBUG-6108: We don't have the source for this script, so ignore.
+ return;
+ }
column = source->columnNumberFromOffset(column);
JSC::CallFrame *oldFrame = engine->currentFrame;
int oldAgentLineNumber = engine->agentLineNumber;
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 559fcd3..63ba9ec 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -83,22 +83,23 @@ struct QObjectConnection
void mark(JSC::MarkStack& markStack)
{
- // ### need to find out if senderWrapper is marked
if (senderWrapper) {
- // see if the sender should be marked or not
+ // see if the sender should be marked or not;
+ // if the C++ object is owned by script, we don't want
+ // it to stay alive due to a script connection.
Q_ASSERT(senderWrapper.inherits(&QScriptObject::info));
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(senderWrapper));
- QScriptObjectDelegate *delegate = scriptObject->delegate();
- Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject));
- QObjectDelegate *inst = static_cast<QObjectDelegate*>(delegate);
- if ((inst->ownership() == QScriptEngine::ScriptOwnership)
- || ((inst->ownership() == QScriptEngine::AutoOwnership)
- && inst->value() && !inst->value()->parent())) {
- // #### don't mark if not marked otherwise
- //senderWrapper = JSC::JSValue();
- markStack.append(senderWrapper);
- } else {
- markStack.append(senderWrapper);
+ if (!JSC::Heap::isCellMarked(scriptObject)) {
+ QScriptObjectDelegate *delegate = scriptObject->delegate();
+ Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject));
+ QObjectDelegate *inst = static_cast<QObjectDelegate*>(delegate);
+ if ((inst->ownership() == QScriptEngine::ScriptOwnership)
+ || ((inst->ownership() == QScriptEngine::AutoOwnership)
+ && inst->value() && !inst->value()->parent())) {
+ senderWrapper = JSC::JSValue();
+ } else {
+ markStack.append(senderWrapper);
+ }
}
}
if (receiver)
diff --git a/src/script/script.pro b/src/script/script.pro
index 008c556..771047a 100644
--- a/src/script/script.pro
+++ b/src/script/script.pro
@@ -1,7 +1,7 @@
TARGET = QtScript
QPRO_PWD = $$PWD
QT = core
-DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror
+DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror WTF=QTWTF
DEFINES += QT_BUILD_SCRIPT_LIB
DEFINES += QT_NO_USING_NAMESPACE
DEFINES += QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index f368d1d..b74babc 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -509,15 +509,24 @@ bool QMYSQLResult::fetchNext()
return false;
if (d->preparedQuery) {
#if MYSQL_VERSION_ID >= 40108
- if (mysql_stmt_fetch(d->stmt))
+ int nRC = mysql_stmt_fetch(d->stmt);
+ if (nRC) {
+#ifdef MYSQL_DATA_TRUNCATED
+ if (nRC == 1 || nRC == MYSQL_DATA_TRUNCATED)
+#else
+ if (nRC == 1)
+#endif // MYSQL_DATA_TRUNCATED
+ setLastError(qMakeStmtError(QCoreApplication::translate("QMYSQLResult",
+ "Unable to fetch data"), QSqlError::StatementError, d->stmt));
return false;
+ }
#else
return false;
#endif
} else {
- d->row = mysql_fetch_row(d->result);
- if (!d->row)
- return false;
+ d->row = mysql_fetch_row(d->result);
+ if (!d->row)
+ return false;
}
setAt(at() + 1);
return true;
@@ -1365,7 +1374,6 @@ QStringList QMYSQLDriver::tables(QSql::TableType type) const
QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const
{
QSqlIndex idx;
- bool prepQ;
if (!isOpen())
return idx;
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 722981c..0dbb90f 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -30,8 +30,7 @@ win32:DEFINES += QT_NODLL
INCLUDEPATH += $$QT_BUILD_TREE/include \
$$QT_BUILD_TREE/include/QtCore \
- $$QT_BUILD_TREE/include/QtXml \
- $$QT_BUILD_TREE/src/corelib/global # qlibraryinfo.cpp includes qconfig.cpp
+ $$QT_BUILD_TREE/include/QtXml
DEPENDPATH += $$INCLUDEPATH \
../../corelib/global \
@@ -49,7 +48,6 @@ SOURCES += \
../../corelib/codecs/qtsciicodec.cpp \
../../corelib/codecs/qutfcodec.cpp \
../../corelib/global/qglobal.cpp \
- ../../corelib/global/qlibraryinfo.cpp \
../../corelib/global/qmalloc.cpp \
../../corelib/global/qnumeric.cpp \
../../corelib/io/qabstractfileengine.cpp \
@@ -65,7 +63,6 @@ SOURCES += \
../../corelib/io/qtemporaryfile.cpp \
../../corelib/io/qtextstream.cpp \
../../corelib/io/qurl.cpp \
- ../../corelib/io/qsettings.cpp \
../../corelib/kernel/qmetatype.cpp \
../../corelib/kernel/qvariant.cpp \
../../corelib/tools/qbitarray.cpp \
@@ -90,12 +87,11 @@ unix:SOURCES += ../../corelib/io/qfsfileengine_unix.cpp \
../../corelib/io/qfsfileengine_iterator_unix.cpp
win32:SOURCES += ../../corelib/io/qfsfileengine_win.cpp \
- ../../corelib/io/qfsfileengine_iterator_win.cpp \
- ../../corelib/io/qsettings_win.cpp
+ ../../corelib/io/qfsfileengine_iterator_win.cpp
macx: {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
- SOURCES += ../../corelib/kernel/qcore_mac.cpp ../../corelib/io/qsettings_mac.cpp
+ SOURCES += ../../corelib/kernel/qcore_mac.cpp
LIBS += -framework CoreServices
}
diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp
index 287cf11..ee92195 100644
--- a/src/xmlpatterns/api/qxmlschema.cpp
+++ b/src/xmlpatterns/api/qxmlschema.cpp
@@ -65,6 +65,11 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/qxmlschema/main.cpp 0
+ \section1 XML Schema Version
+
+ This class is used to represent schemas that conform to the \l{XML Schema} 1.0
+ specification.
+
\sa QXmlSchemaValidator, {xmlpatterns/schema}{XML Schema Validation Example}
*/
diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp
index 11e0417..682d34f 100644
--- a/src/xmlpatterns/api/qxmlschemavalidator.cpp
+++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp
@@ -71,6 +71,11 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/qxmlschemavalidator/main.cpp 3
+ \section1 XML Schema Version
+
+ This class implements schema validation according to the \l{XML Schema} 1.0
+ specification.
+
\sa QXmlSchema, {xmlpatterns/schema}{XML Schema Validation Example}
*/