summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/clucene/src/CLucene/StdHeader.cpp2
-rw-r--r--src/3rdparty/clucene/src/CLucene/StdHeader.h10
-rw-r--r--src/3rdparty/clucene/src/CLucene/config/define_std.h3
-rw-r--r--src/3rdparty/clucene/src/CLucene/config/repl_tchar.h20
-rw-r--r--src/3rdparty/clucene/src/CLucene/util/Misc.cpp10
-rw-r--r--src/3rdparty/clucene/src/CLucene/util/fileinputstream.cpp5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp378
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp7
-rw-r--r--src/corelib/animation/qvariantanimation.cpp85
-rw-r--r--src/corelib/animation/qvariantanimation_p.h5
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp198
-rw-r--r--src/corelib/kernel/qfunctions_wince.cpp7
-rw-r--r--src/corelib/kernel/qvariant.cpp1
-rw-r--r--src/corelib/tools/qsharedpointer.cpp266
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h57
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp29
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp6
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h1
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp1
-rw-r--r--src/gui/itemviews/qlistview.cpp3
-rw-r--r--src/gui/itemviews/qtreeview.cpp9
-rw-r--r--src/gui/itemviews/qtreeview_p.h2
-rw-r--r--src/gui/kernel/qkde.cpp2
-rw-r--r--src/gui/painting/qcssutil.cpp8
-rw-r--r--src/gui/painting/qtransform.cpp2
-rw-r--r--src/gui/styles/qcommonstyle.cpp3
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp13
-rw-r--r--src/gui/widgets/qdatetimeedit.cpp5
-rw-r--r--src/gui/widgets/qlineedit_p.cpp1
-rw-r--r--src/gui/widgets/qmainwindow.cpp4
-rw-r--r--src/gui/widgets/qscrollbar.cpp6
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp16
-rw-r--r--src/tools/rcc/rcc.cpp4
35 files changed, 762 insertions, 411 deletions
diff --git a/src/3rdparty/clucene/src/CLucene/StdHeader.cpp b/src/3rdparty/clucene/src/CLucene/StdHeader.cpp
index 9813a58..d64c51f 100644
--- a/src/3rdparty/clucene/src/CLucene/StdHeader.cpp
+++ b/src/3rdparty/clucene/src/CLucene/StdHeader.cpp
@@ -17,8 +17,10 @@
#if defined(_CLCOMPILER_MSVC) && defined(_DEBUG)
# define CRTDBG_MAP_ALLOC
# include <stdlib.h>
+#ifndef UNDER_CE
# include <crtdbg.h>
#endif
+#endif
CL_NS_USE(util)
diff --git a/src/3rdparty/clucene/src/CLucene/StdHeader.h b/src/3rdparty/clucene/src/CLucene/StdHeader.h
index d267d03..fbb3fd9 100644
--- a/src/3rdparty/clucene/src/CLucene/StdHeader.h
+++ b/src/3rdparty/clucene/src/CLucene/StdHeader.h
@@ -58,8 +58,10 @@ extern int _lucene_counter_break; //can set a watch on this
#if defined(_CL_HAVE_UNISTD_H)
#include <unistd.h>
#elif defined(_CL_HAVE_IO_H) && defined(_CL_HAVE_DIRECT_H)
+#ifndef UNDER_CE
#include <io.h>
#include <direct.h>
+#endif
#else
#error "Neither unistd.h or (io.h & direct.h) were available"
#endif
@@ -75,7 +77,11 @@ extern int _lucene_counter_break; //can set a watch on this
#if defined(_CL_STAT_MACROS_BROKEN)
#error "Haven't implemented STAT_MACROS_BROKEN fix yet"
#elif defined(_CL_HAVE_SYS_STAT_H)
+#ifdef UNDER_CE
+ #include <types.h>
+#else
#include <sys/stat.h>
+#endif
#else
#error "Haven't implemented platforms with no sys/stat.h"
#endif
@@ -179,13 +185,17 @@ extern int _lucene_counter_break; //can set a watch on this
#include "CLucene/config/repl_tchar.h"
#if defined(_CL_HAVE_ERRNO_H)
+#ifndef UNDER_CE
#include <errno.h>
+#endif
#else
#error "Haven't implemented platforms with no errno.h"
#endif
#if defined(_CL_HAVE_FCNTL_H)
+#ifndef UNDER_CE
#include <fcntl.h>
+#endif
#else
#error "Haven't implemented platforms with no fcntl.h"
#endif
diff --git a/src/3rdparty/clucene/src/CLucene/config/define_std.h b/src/3rdparty/clucene/src/CLucene/config/define_std.h
index 3f92117..22a0790 100644
--- a/src/3rdparty/clucene/src/CLucene/config/define_std.h
+++ b/src/3rdparty/clucene/src/CLucene/config/define_std.h
@@ -72,6 +72,9 @@
#else
#define _CL_HAVE_UNISTD_H
#endif
+#ifdef UNDER_CE
+#undef _CL_HAVE_SYS_TIMEB_H
+#endif
////////////////////////////////////////////////
//now for individual functions. some compilers
diff --git a/src/3rdparty/clucene/src/CLucene/config/repl_tchar.h b/src/3rdparty/clucene/src/CLucene/config/repl_tchar.h
index d562cc8..ba8aef5 100644
--- a/src/3rdparty/clucene/src/CLucene/config/repl_tchar.h
+++ b/src/3rdparty/clucene/src/CLucene/config/repl_tchar.h
@@ -93,6 +93,26 @@
#endif
#else //HAVE_TCHAR_H
#include <tchar.h>
+
+#ifdef UNDER_CE
+#include <QString>
+#define _i64tot i64tot
+inline TCHAR* i64tot(__int64 value, TCHAR* str, int radix)
+{
+ QT_USE_NAMESPACE
+ _tcscpy(str, (TCHAR *) QString::number(value, radix).utf16());
+ return str;
+}
+
+#define _tcstoi64 tcstoi64
+inline __int64 tcstoi64(const TCHAR *nptr, TCHAR **endptr, int base)
+{
+ QT_USE_NAMESPACE
+ bool ok;
+ return QString::fromUtf16((ushort*) nptr).toInt(&ok, base);
+}
+
+#endif
//some tchar headers miss these...
#ifndef _tcstoi64
diff --git a/src/3rdparty/clucene/src/CLucene/util/Misc.cpp b/src/3rdparty/clucene/src/CLucene/util/Misc.cpp
index cb2efe2..42e3fd0 100644
--- a/src/3rdparty/clucene/src/CLucene/util/Misc.cpp
+++ b/src/3rdparty/clucene/src/CLucene/util/Misc.cpp
@@ -24,10 +24,15 @@
# include <sys/timeb.h>
#endif
+#ifdef UNDER_CE
+#include <QTime>
+#endif
+
CL_NS_DEF(util)
uint64_t Misc::currentTimeMillis()
{
+#ifndef UNDER_CE
#if defined(_CLCOMPILER_MSVC) || defined(__MINGW32__) || defined(__BORLANDC__)
struct _timeb tstruct;
_ftime(&tstruct);
@@ -41,6 +46,11 @@ uint64_t Misc::currentTimeMillis()
return (((uint64_t) tstruct.tv_sec) * 1000) + tstruct.tv_usec / 1000;
#endif
+#else //UNDER_CE
+ QT_USE_NAMESPACE
+ QTime t = QTime::currentTime();
+ return t.second() * 1000 + t.msec();
+#endif //UNDER_CE
}
// #pragma mark -- char related utils
diff --git a/src/3rdparty/clucene/src/CLucene/util/fileinputstream.cpp b/src/3rdparty/clucene/src/CLucene/util/fileinputstream.cpp
index 3803dfd..9125d84 100644
--- a/src/3rdparty/clucene/src/CLucene/util/fileinputstream.cpp
+++ b/src/3rdparty/clucene/src/CLucene/util/fileinputstream.cpp
@@ -25,7 +25,10 @@
*/
#include "jstreamsconfig.h"
#include "fileinputstream.h"
+
+#ifndef UNDER_CE
#include <cerrno>
+#endif
#include <cstring>
namespace jstreams {
@@ -39,7 +42,9 @@ FileInputStream::FileInputStream(const char *filepath, int32_t buffersize) {
error = "Could not read file '";
error += filepath;
error += "': ";
+#ifndef UNDER_CE
error += strerror(errno);
+#endif
status = Error;
return;
}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
index 1dfb409..dd90f39 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
@@ -53,45 +53,57 @@ public:
/*!
\class QWebElement
\since 4.6
- \brief The QWebElement class provides convenient access to DOM elements in a QWebFrame.
+ \brief The QWebElement class provides convenient access to DOM elements in
+ a QWebFrame.
- QWebElement is the main class to easily access to the document model.
- The document model is represented by a tree-like structure of DOM elements.
- The root of the tree is called the document element and can be accessed using QWebFrame::documentElement().
- You can reach specific elements using findAll() and findFirst(); the elements
- are identified through CSS selectors.
+ A QWebElement object allows easy access to the document model, represented
+ by a tree-like structure of DOM elements. The root of the tree is called
+ the document element and can be accessed using
+ QWebFrame::documentElement().
+
+ Specific elements can be accessed using findAll() and findFirst(). These
+ elements are identified using CSS selectors. The code snippet below
+ demonstrates the use of findAll().
\snippet webkitsnippets/webelement/main.cpp FindAll
- The first list contains all \c span elements in the document. The second list contains
- \c span elements that are children of \c p, classified with \c intro.
+ The first list contains all \c span elements in the document. The second
+ list contains \c span elements that are children of \c p, classified with
+ \c intro.
- Using findFirst() is more efficient than calling findAll() and extracting the first element
- only in the returned list.
+ Using findFirst() is more efficient than calling findAll(), and extracting
+ the first element only in the list returned.
- Alternatively you can manually traverse the document using firstChild() and nextSibling():
+ Alternatively you can traverse the document manually using firstChild() and
+ nextSibling():
\snippet webkitsnippets/webelement/main.cpp Traversing with QWebElement
- The underlying content of QWebElement is explicitly shared. Creating a copy of a QWebElement
- does not create a copy of the content. Instead, both instances point to the same element.
+ The underlying content of QWebElement is explicitly shared. Creating a copy
+ of a QWebElement does not create a copy of the content. Instead, both
+ instances point to the same element.
- The element's attributes can be read using attribute() and modified with setAttribute().
+ The element's attributes can be read using attribute() and modified with
+ setAttribute().
- The contents of child elements can be converted to plain text with toPlainText() and to
- XHTML using toInnerXml(). To also include the element's tag in the output, use toOuterXml().
+ The contents of child elements can be converted to plain text with
+ toPlainText(); to XHTML using toInnerXml(). To include the element's tag in
+ the output, use toOuterXml().
- It is possible to replace the contents using setPlainText() and setInnerXml(). To replace
- the element itself and its contents, use setOuterXml().
+ It is possible to replace the contents of child elements using
+ setPlainText() and setInnerXml(). To replace the element itself and its
+ contents, use setOuterXml().
- In the JavaScript DOM interfaces, elements can have additional functions depending on their
- type. For example an HTML form element can be triggered to submit the entire form to the
- web server using the submit() function. A list of these special functions can be obtained
- in QWebElement using functions(); they can be invoked using callFunction().
+ In the JavaScript DOM interfaces, elements can have additional functions
+ depending on their type. For example, an HTML form element can be triggered
+ to submit the entire form to the web server using the submit() function. A
+ list of these special functions can be obtained in QWebElement using
+ functions(); they can be invoked using callFunction().
- Similarly element specific properties can be obtained using scriptableProperties() and
- read/written using scriptableProperty()/setScriptableProperty().
+ Similarly, element specific properties can be obtained using
+ scriptableProperties() and read or written using scriptableProperty() or
+ setScriptableProperty().
*/
/*!
@@ -156,7 +168,7 @@ QWebElement &QWebElement::operator=(const QWebElement &other)
}
/*!
- Destroys the element. The underlying DOM element is not destroyed.
+ Destroys the element. However, the underlying DOM element is not destroyed.
*/
QWebElement::~QWebElement()
{
@@ -176,7 +188,7 @@ bool QWebElement::operator!=(const QWebElement& o) const
}
/*!
- Returns true if the element is a null element; false otherwise.
+ Returns true if the element is a null element; otherwise returns false.
*/
bool QWebElement::isNull() const
{
@@ -184,13 +196,16 @@ bool QWebElement::isNull() const
}
/*!
- Returns a new list of child elements matching the given CSS selector \a selectorQuery.
- If there are no matching elements, an empty list is returned.
+ Returns a new list of child elements matching the given CSS selector
+ \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{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector}
+ syntax is used for the query.
\note This search is performed recursively.
+
+ \sa findFirst()
*/
QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const
{
@@ -212,12 +227,15 @@ QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const
}
/*!
- Returns the first child element that matches the given CSS selector \a selectorQuery.
+ 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{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector}
+ syntax is used for the query.
\note This search is performed recursively.
+
+ \sa findAll()
*/
QWebElement QWebElement::findFirst(const QString &selectorQuery) const
{
@@ -231,6 +249,8 @@ QWebElement QWebElement::findFirst(const QString &selectorQuery) const
Replaces the existing content of this element with \a text.
This is equivalent to setting the HTML innerText property.
+
+ \sa toPlainText()
*/
void QWebElement::setPlainText(const QString &text)
{
@@ -245,6 +265,8 @@ void QWebElement::setPlainText(const QString &text)
element.
This is equivalent to reading the HTML innerText property.
+
+ \sa setPlainText()
*/
QString QWebElement::toPlainText() const
{
@@ -254,11 +276,13 @@ QString QWebElement::toPlainText() const
}
/*!
- Replaces the contents of this element as well as its own tag with \a markup.
- The string may contain HTML or XML tags, which is parsed and formatted
- before insertion into the document.
+ Replaces the contents of this element as well as its own tag with
+ \a markup. The string may contain HTML or XML tags, which is parsed and
+ formatted before insertion into the document.
\note This is currently only implemented for (X)HTML elements.
+
+ \sa toOuterXml(), toInnerXml(), setInnerXml()
*/
void QWebElement::setOuterXml(const QString &markup)
{
@@ -272,9 +296,11 @@ void QWebElement::setOuterXml(const QString &markup)
/*!
Returns this element converted to XML, including the start and the end
- tag of this element and its attributes.
+ tags as well as its attributes.
- \note This is currently only implemented for (X)HTML elements.
+ \note This is currently implemented for (X)HTML elements only.
+
+ \sa setOuterXml(), setInnerXml(), toInnerXml()
*/
QString QWebElement::toOuterXml() const
{
@@ -285,11 +311,13 @@ QString QWebElement::toOuterXml() const
}
/*!
- Replaces the content of this element with \a markup.
- The string may contain HTML or XML tags, which is parsed and formatted
- before insertion into the document.
+ Replaces the contents of this element with \a markup. The string may
+ contain HTML or XML tags, which is parsed and formatted before insertion
+ into the document.
- \note This is currently only implemented for (X)HTML elements.
+ \note This is currently implemented for (X)HTML elements only.
+
+ \sa toInnerXml(), toOuterXml(), setOuterXml()
*/
void QWebElement::setInnerXml(const QString &markup)
{
@@ -302,10 +330,11 @@ void QWebElement::setInnerXml(const QString &markup)
}
/*!
- Returns the XML between the start and the end tag of this
- element.
+ Returns the XML content between the element's start and end tags.
- \note This is currently only implemented for (X)HTML elements.
+ \note This is currently implemented for (X)HTML elements only.
+
+ \sa setInnerXml(), setOuterXml(), toOuterXml()
*/
QString QWebElement::toInnerXml() const
{
@@ -316,8 +345,10 @@ QString QWebElement::toInnerXml() const
}
/*!
- Adds an attribute called \a name with the value \a value. If an attribute
- with the same name exists, its value is replaced by \a value.
+ Adds an attribute with the given \a name and \a value. If an attribute with
+ the same name exists, its value is replaced by \a value.
+
+ \sa attribute(), attributeNS(), setAttributeNS()
*/
void QWebElement::setAttribute(const QString &name, const QString &value)
{
@@ -328,9 +359,11 @@ void QWebElement::setAttribute(const QString &name, const QString &value)
}
/*!
- Adds an attribute called \a name in the namespace described with \a namespaceUri
- with the value \a value. If an attribute with the same name exists, its value is
- replaced by \a value.
+ Adds an attribute with the given \a name in \a namespaceUri with \a value.
+ If an attribute with the same name exists, its value is replaced by
+ \a value.
+
+ \sa attributeNS(), attribute(), setAttribute()
*/
void QWebElement::setAttributeNS(const QString &namespaceUri, const QString &name, const QString &value)
{
@@ -341,8 +374,10 @@ void QWebElement::setAttributeNS(const QString &namespaceUri, const QString &nam
}
/*!
- Returns the attributed called \a name. If the attribute does not exist \a defaultValue is
- returned.
+ Returns the attribute with the given \a name. If the attribute does not
+ exist, \a defaultValue is returned.
+
+ \sa setAttribute(), setAttributeNS(), attributeNS()
*/
QString QWebElement::attribute(const QString &name, const QString &defaultValue) const
{
@@ -355,8 +390,10 @@ QString QWebElement::attribute(const QString &name, const QString &defaultValue)
}
/*!
- Returns the attributed called \a name in the namespace described with \a namespaceUri.
- If the attribute does not exist \a defaultValue is returned.
+ Returns the attribute with the given \a name in \a namespaceUri. If the
+ attribute does not exist, \a defaultValue is returned.
+
+ \sa setAtributeNS(), setAttribute(), attribute()
*/
QString QWebElement::attributeNS(const QString &namespaceUri, const QString &name, const QString &defaultValue) const
{
@@ -369,7 +406,10 @@ QString QWebElement::attributeNS(const QString &namespaceUri, const QString &nam
}
/*!
- Returns true if this element has an attribute called \a name; otherwise returns false.
+ Returns true if this element has an attribute with the given \a name;
+ otherwise returns false.
+
+ \sa attribute(), setAttribute()
*/
bool QWebElement::hasAttribute(const QString &name) const
{
@@ -379,8 +419,10 @@ bool QWebElement::hasAttribute(const QString &name) const
}
/*!
- Returns true if this element has an attribute called \a name in the namespace described
- with \a namespaceUri; otherwise returns false.
+ Returns true if this element has an attribute with the given \a name, in
+ \a namespaceUri; otherwise returns false.
+
+ \sa attributeNS(), setAttributeNS()
*/
bool QWebElement::hasAttributeNS(const QString &namespaceUri, const QString &name) const
{
@@ -390,7 +432,9 @@ bool QWebElement::hasAttributeNS(const QString &namespaceUri, const QString &nam
}
/*!
- Removes the attribute called \a name from this element.
+ Removes the attribute with the given \a name from this element.
+
+ \sa attribute(), setAttribute(), hasAttribute()
*/
void QWebElement::removeAttribute(const QString &name)
{
@@ -401,8 +445,10 @@ void QWebElement::removeAttribute(const QString &name)
}
/*!
- Removes the attribute called \a name in the namespace described with \a namespaceUri
- from this element.
+ Removes the attribute with the given \a name, in \a namespaceUri, from this
+ element.
+
+ \sa attributeNS(), setAttributeNS(), hasAttributeNS()
*/
void QWebElement::removeAttributeNS(const QString &namespaceUri, const QString &name)
{
@@ -413,7 +459,10 @@ void QWebElement::removeAttributeNS(const QString &namespaceUri, const QString &
}
/*!
- Returns true if the element has any attributes defined; otherwise returns false;
+ Returns true if the element has any attributes defined; otherwise returns
+ false;
+
+ \sa attribute(), setAttribute()
*/
bool QWebElement::hasAttributes() const
{
@@ -424,6 +473,8 @@ bool QWebElement::hasAttributes() const
/*!
Returns the geometry of this element, relative to its containing frame.
+
+ \sa tagName()
*/
QRect QWebElement::geometry() const
{
@@ -434,6 +485,8 @@ QRect QWebElement::geometry() const
/*!
Returns the tag name of this element.
+
+ \sa geometry()
*/
QString QWebElement::tagName() const
{
@@ -443,7 +496,8 @@ QString QWebElement::tagName() const
}
/*!
- Returns the namespace prefix of the element or an empty string if the element has no namespace prefix.
+ Returns the namespace prefix of the element. If the element has no\
+ namespace prefix, empty string is returned.
*/
QString QWebElement::prefix() const
{
@@ -453,8 +507,8 @@ QString QWebElement::prefix() const
}
/*!
- If the element uses namespaces, this function returns the local name of the element;
- otherwise it returns an empty string.
+ Returns the local name of the element. If the element does not use
+ namespaces, an empty string is returned.
*/
QString QWebElement::localName() const
{
@@ -464,7 +518,8 @@ QString QWebElement::localName() const
}
/*!
- Returns the namespace URI of this element or an empty string if the element has no namespace URI.
+ Returns the namespace URI of this element. If the element has no namespace
+ URI, an empty string is returned.
*/
QString QWebElement::namespaceUri() const
{
@@ -474,8 +529,8 @@ QString QWebElement::namespaceUri() const
}
/*!
- Returns the parent element of this element or a null element if this element
- is the root document element.
+ Returns the parent element of this elemen. If this element is the root
+ document element, a null element is returned.
*/
QWebElement QWebElement::parent() const
{
@@ -485,9 +540,9 @@ QWebElement QWebElement::parent() const
}
/*!
- Returns the first child element of this element.
+ Returns the element's first child.
- \sa lastChild() previousSibling() nextSibling()
+ \sa lastChild(), previousSibling(), nextSibling()
*/
QWebElement QWebElement::firstChild() const
{
@@ -503,9 +558,9 @@ QWebElement QWebElement::firstChild() const
}
/*!
- Returns the last child element of this element.
+ Returns the element's last child.
- \sa firstChild() previousSibling() nextSibling()
+ \sa firstChild(), previousSibling(), nextSibling()
*/
QWebElement QWebElement::lastChild() const
{
@@ -521,9 +576,9 @@ QWebElement QWebElement::lastChild() const
}
/*!
- Returns the next sibling element of this element.
+ Returns the element's next sibling.
- \sa firstChild() previousSibling() lastChild()
+ \sa firstChild(), previousSibling(), lastChild()
*/
QWebElement QWebElement::nextSibling() const
{
@@ -539,9 +594,9 @@ QWebElement QWebElement::nextSibling() const
}
/*!
- Returns the previous sibling element of this element.
+ Returns the element's previous sibling.
- \sa firstChild() nextSibling() lastChild()
+ \sa firstChild(), nextSibling(), lastChild()
*/
QWebElement QWebElement::previousSibling() const
{
@@ -557,7 +612,7 @@ QWebElement QWebElement::previousSibling() const
}
/*!
- Returns the document this element belongs to.
+ Returns the document which this element belongs to.
*/
QWebElement QWebElement::document() const
{
@@ -570,8 +625,8 @@ QWebElement QWebElement::document() const
}
/*!
- Returns the web frame this elements is a part of. If the element is
- a null element null is returned.
+ Returns the web frame which this element is a part of. If the element is a
+ null element, null is returned.
*/
QWebFrame *QWebElement::webFrame() const
{
@@ -647,7 +702,7 @@ static bool setupScriptObject(WebCore::Element* element, ScriptObject& object, S
}
/*!
- Executes the \a scriptSource with this element as the `this' object.
+ Executes \a scriptSource with this element as \c this object.
\sa callFunction()
*/
@@ -680,9 +735,10 @@ QVariant QWebElement::evaluateScript(const QString& scriptSource)
/*!
Calls the function with the given \a name and \a arguments.
- The underlying DOM element that QWebElement wraps may have dedicated functions depending
- on its type. For example a form element can have the "submit" function, that would submit
- the form to the destination specified in the HTML.
+ The underlying DOM element that QWebElement wraps may have dedicated
+ functions, depending on its type. For example, a form element can have the
+ \c submit function, that would submit the form to the destination specified
+ in the HTML.
\sa functions()
*/
@@ -713,7 +769,7 @@ QVariant QWebElement::callFunction(const QString &name, const QVariantList &argu
/*!
Returns a list of function names this element supports.
- The function names returned are the same functions that are callable from the DOM
+ The function names returned are the same functions callable from the DOM
element's JavaScript binding.
\sa callFunction()
@@ -763,14 +819,14 @@ QStringList QWebElement::functions() const
}
/*!
- Returns the value of the element's \a name property.
+ Returns the value of the element's \a name property. If no such property
+ exists, an invalid QVariant is returned.
- If no such property exists, the returned variant is invalid.
+ The return value's property has the same value as the corresponding
+ property in the element's JavaScript binding with the same name.
- The return property has the same value as the corresponding property
- in the element's JavaScript binding with the same name.
-
- Information about all available properties is provided through scriptProperties().
+ Information about all available properties is provided through
+ scriptProperties().
\sa setScriptableProperty(), scriptableProperties()
*/
@@ -797,10 +853,11 @@ QVariant QWebElement::scriptableProperty(const QString &name) const
/*!
Sets the value of the element's \a name property to \a value.
- Information about all available properties is provided through scriptProperties().
+ Information about all available properties is provided through
+ scriptProperties().
- Setting the property will affect the corresponding property
- in the element's JavaScript binding with the same name.
+ Setting the property will affect the corresponding property in the
+ element's JavaScript binding with the same name.
\sa scriptableProperty(), scriptableProperties()
*/
@@ -827,8 +884,8 @@ void QWebElement::setScriptableProperty(const QString &name, const QVariant &val
/*!
Returns a list of property names this element supports.
- The function names returned are the same properties that are accessible from the DOM
- element's JavaScript binding.
+ The function names returned are the same properties that are accessible
+ from the DOM element's JavaScript binding.
\sa setScriptableProperty(), scriptableProperty()
*/
@@ -894,10 +951,12 @@ QStringList QWebElement::scriptableProperties() const
This enum describes how QWebElement's styleProperty resolves the given
property name.
- \value IgnoreCascadingStyles Return the property value as it is defined
- in the element, without respecting style inheritance and other CSS rules.
- \value RespectCascadingStyles The property's value is determined using
- the inheritance and importance rules defined in the document's stylesheet.
+ \value IgnoreCascadingStyles Return the property value as it is defined in
+ the element, without respecting style inheritance and other CSS
+ rules.
+ \value RespectCascadingStyles The property's value is determined using the
+ inheritance and importance rules defined in the document's
+ stylesheet.
*/
/*!
@@ -907,17 +966,17 @@ QStringList QWebElement::scriptableProperties() const
This enum describes the priority newly set CSS properties should have when
set using QWebElement::setStyleProperty().
- \value NormalStylePriority Define the property without important
- priority even if "!important" is explicitly set in \a value.
- \value DeclaredStylePriority Define the property respecting the
- priority specified in \a value.
- \value ImportantStylePriority Define the property to have
- an important priority, this is equal to appending "!important" to the value.
+ \value NormalStylePriority Define the property without important priority
+ even if "!important" is explicitly set in \a value.
+ \value DeclaredStylePriority Define the property respecting the priority
+ specified in \a value.
+ \value ImportantStylePriority Define the property to have an important
+ priority. This is equal to appending "!important" to the value.
*/
/*!
- Returns the value of the style named \a name or an empty string if such one
- does not exist.
+ Returns the value of the style with the given \a name. If a style with
+ \name does not exist, an empty string is returned.
If \a rule is IgnoreCascadingStyles, the value defined inside the element
(inline in CSS terminology) is returned.
@@ -925,14 +984,17 @@ QStringList QWebElement::scriptableProperties() const
if \a rule is RespectCascadingStyles, the actual style applied to the
element is returned.
- In CSS, the cascading part has to do with which CSS rule has priority and
- is thus applied. Generally speaking, the last defined rule has priority,
- thus an inline style rule has priority over an embedded block style rule,
- which in return has priority over an external style rule.
+ In CSS, the cascading part depends on which CSS rule has priority and is
+ thus applied. Generally, the last defined rule has priority. Thus, an
+ inline style rule has priority over an embedded block style rule, which
+ in return has priority over an external style rule.
+
+ If the "!important" declaration is set on one of those, the declaration
+ receives highest priority, unless other declarations also use the
+ "!important" declaration. Then, the last "!important" declaration takes
+ predecence.
- If the !important declaration is set on one of those, the declaration gets
- highest priority, unless other declarations also use the !important
- declaration, in which the last !important declaration takes predecence.
+ \sa setStyleProperty()
*/
QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const
{
@@ -981,9 +1043,9 @@ QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const
}
/*!
- Sets the value of the style named \a name to \a value.
+ Sets the value of the style with the given \a name to \a value.
- Setting a value, doesn't necessarily mean that it will become the applied
+ Setting a value, does not necessarily mean that it will become the applied
value, due to the fact that the style property's value might have been set
earlier with priority in external or embedded style declarations.
@@ -998,7 +1060,8 @@ QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const
Using NormalStylePriority as \a priority, the property will have normal
priority, and any "!important" declaration will be ignored. On the other
hand, using ImportantStylePriority sets the important priority even when
- not explicit passed in \a value.
+ it is not explicitly passed in \a value.
+
By using DeclaredStylePriority as \a priority the property will respect the
priority specified in \a value.
*/
@@ -1035,7 +1098,8 @@ void QWebElement::setStyleProperty(const QString &name, const QString &value, St
}
/*!
- Returns the computed value for style named \a name or an empty string if the style has no such name.
+ Returns the computed value for style with the given \a name. If a style
+ with \name does not exist, an empty string is returned.
*/
QString QWebElement::computedStyleProperty(const QString &name) const
{
@@ -1083,7 +1147,8 @@ QStringList QWebElement::classes() const
}
/*!
- Returns true if this element has a class called \a name; otherwise returns false.
+ Returns true if this element has a class with the given \a name; otherwise
+ returns false.
*/
bool QWebElement::hasClass(const QString &name) const
{
@@ -1092,7 +1157,7 @@ bool QWebElement::hasClass(const QString &name) const
}
/*!
- Adds the specified class \a name to the element.
+ Adds the specified class with the given \a name to the element.
*/
void QWebElement::addClass(const QString &name)
{
@@ -1105,7 +1170,7 @@ void QWebElement::addClass(const QString &name)
}
/*!
- Removes the specified class \a name from the element.
+ Removes the specified class with the given \a name from the element.
*/
void QWebElement::removeClass(const QString &name)
{
@@ -1118,8 +1183,8 @@ void QWebElement::removeClass(const QString &name)
}
/*!
- Adds the specified class \a name if it is not present,
- removes it if it is already present.
+ Adds the specified class with the given \a name if it is not present. If
+ the class is already present, it will be removed.
*/
void QWebElement::toggleClass(const QString &name)
{
@@ -1134,11 +1199,11 @@ void QWebElement::toggleClass(const QString &name)
}
/*!
- Appends \a element as the element's last child.
+ Appends the given \a element as the element's last child.
- If \a element is the child of another element, it is re-parented
- to this element. If \a element is a child of this element, then
- its position in the list of children is changed.
+ If \a element is the child of another element, it is re-parented to this
+ element. If \a element is a child of this element, then its position in
+ the list of children is changed.
Calling this function on a null element does nothing.
@@ -1178,9 +1243,9 @@ void QWebElement::appendInside(const QString &markup)
/*!
Prepends \a element as the element's first child.
- If \a element is the child of another element, it is re-parented
- to this element. If \a element is a child of this element, then
- its position in the list of children is changed.
+ If \a element is the child of another element, it is re-parented to this
+ element. If \a element is a child of this element, then its position in
+ the list of children is changed.
Calling this function on a null element does nothing.
@@ -1227,10 +1292,10 @@ void QWebElement::prependInside(const QString &markup)
/*!
- Inserts \a element before this element.
+ Inserts the given \a element before this element.
- If \a element is the child of another element, it is re-parented
- to the parent of this element.
+ If \a element is the child of another element, it is re-parented to the
+ parent of this element.
Calling this function on a null element does nothing.
@@ -1274,10 +1339,10 @@ void QWebElement::prependOutside(const QString &markup)
}
/*!
- Inserts \a element after this element.
+ Inserts the given \a element after this element.
- If \a element is the child of another element, it is re-parented
- to the parent of this element.
+ If \a element is the child of another element, it is re-parented to the
+ parent of this element.
Calling this function on a null element does nothing.
@@ -1342,11 +1407,10 @@ QWebElement QWebElement::clone() const
}
/*!
- Removes this element from the document and returns a reference
- to this.
+ Removes this element from the document and returns a reference to it.
- The element is still valid after removal, and can be inserted into
- other parts of the document.
+ The element is still valid after removal, and can be inserted into other
+ parts of the document.
\sa removeChildren(), removeFromDocument()
*/
@@ -1362,8 +1426,7 @@ QWebElement &QWebElement::takeFromDocument()
}
/*!
- Removes this element from the document and makes this
- a null element.
+ Removes this element from the document and makes it a null element.
\sa removeChildren(), takeFromDocument()
*/
@@ -1414,9 +1477,10 @@ static RefPtr<Node> findInsertionPoint(PassRefPtr<Node> root)
}
/*!
- Enclose the contents of this element in \a element as the child
- of the deepest descendant element within the structure of the
- first element provided.
+ Encloses the contents of this element with \a element. This element becomes
+ the child of the deepest descendant within \a element.
+
+ ### illustration
\sa encloseWith()
*/
@@ -1446,9 +1510,8 @@ void QWebElement::encloseContentsWith(const QWebElement &element)
}
/*!
- Enclose the contents of this element in the result of parsing
- \a markup as the child of the deepest descendant element within
- the structure of the first element provided.
+ Encloses the contents of this element with the result of parsing \a markup.
+ This element becomes the child of the deepest descendant within \a markup.
\sa encloseWith()
*/
@@ -1490,9 +1553,8 @@ void QWebElement::encloseContentsWith(const QString &markup)
}
/*!
- Enclose this element in \a element as the child of the deepest
- descendant element within the structure of the first element
- provided.
+ Encloses this element with \a element. This element becomes the child of
+ the deepest descendant within \a element.
\sa replace()
*/
@@ -1523,8 +1585,8 @@ void QWebElement::encloseWith(const QWebElement &element)
}
/*!
- Enclose this element in the result of parsing \a markup,
- as the last child.
+ Encloses this element with the result of parsing \a markup. This element
+ becomes the child of the deepest descendant within \a markup.
\sa replace()
*/
@@ -1569,8 +1631,7 @@ void QWebElement::encloseWith(const QString &markup)
/*!
Replaces this element with \a element.
- It is not possible to replace the <html>, <head>, or <body>
- elements using this method.
+ This method will not replace the <html>, <head> or <body> elements.
\sa encloseWith()
*/
@@ -1586,8 +1647,7 @@ void QWebElement::replace(const QWebElement &element)
/*!
Replaces this element with the result of parsing \a markup.
- It is not possible to replace the <html>, <head>, or <body>
- elements using this method.
+ This method will not replace the <html>, <head> or <body> elements.
\sa encloseWith()
*/
@@ -1603,11 +1663,13 @@ void QWebElement::replace(const QString &markup)
/*!
\fn inline bool QWebElement::operator==(const QWebElement& o) const;
- Returns true if this element points to the same underlying DOM object than \a o; otherwise returns false.
+ Returns true if this element points to the same underlying DOM object as
+ \a o; otherwise returns false.
*/
/*!
\fn inline bool QWebElement::operator!=(const QWebElement& o) const;
- Returns true if this element points to a different underlying DOM object than \a o; otherwise returns false.
+ Returns true if this element points to a different underlying DOM object
+ than \a o; otherwise returns false.
*/
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 598e994..0c1feee 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -293,7 +293,12 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState,
hash.insert(key, this);
// update the default start value
if (oldState == Stopped) {
- d->setDefaultStartValue(d->target->property(d->propertyName.constData()));
+ d->setDefaultStartEndValue(d->target->property(d->propertyName.constData()));
+ //let's check if we have a start value and an end value
+ if (d->direction == Forward && !startValue().isValid() && !d->defaultStartEndValue.isValid())
+ qWarning("QPropertyAnimation::updateState: starting an animation without start value");
+ if (d->direction == Backward && !endValue().isValid() && !d->defaultStartEndValue.isValid())
+ qWarning("QPropertyAnimation::updateState: starting an animation without end value");
}
} else if (hash.value(key) == this) {
hash.remove(key);
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index 61321c8..fc11815 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -178,8 +178,7 @@ template<> Q_INLINE_TEMPLATE QLineF _q_interpolate(const QLineF &f, const QLineF
return QLineF( _q_interpolate(f.p1(), t.p1(), progress), _q_interpolate(f.p2(), t.p2(), progress));
}
-QVariantAnimationPrivate::QVariantAnimationPrivate() : duration(250), hasStartValue(false),
- interpolator(&defaultInterpolator),
+QVariantAnimationPrivate::QVariantAnimationPrivate() : duration(250), interpolator(&defaultInterpolator),
changedSignalMask(1 << QVariantAnimation::staticMetaObject.indexOfSignal("valueChanged(QVariant)"))
{
//we keep the mask so that we emit valueChanged only when needed (for performance reasons)
@@ -221,35 +220,47 @@ void QVariantAnimationPrivate::updateInterpolator()
*/
void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/)
{
- // can't interpolate if we have only 1 key value
- if (keyValues.count() <= 1)
+ // can't interpolate if we don't have at least 2 values
+ if ((keyValues.count() + (defaultStartEndValue.isValid() ? 1 : 0)) < 2)
return;
const qreal progress = easing.valueForProgress(((duration == 0) ? qreal(1) : qreal(currentTime) / qreal(duration)));
- if (force || progress < currentInterval.start.first || progress > currentInterval.end.first) {
+ //0 and 1 are still the boundaries
+ if (force || (currentInterval.start.first > 0 && progress < currentInterval.start.first)
+ || (currentInterval.end.first < 1 && progress > currentInterval.end.first)) {
//let's update currentInterval
- QVariantAnimation::KeyValues::const_iterator itStart = qLowerBound(keyValues.constBegin(),
- keyValues.constEnd(),
- qMakePair(progress, QVariant()),
- animationValueLessThan);
- QVariantAnimation::KeyValues::const_iterator itEnd = itStart;
-
- // If we are at the end we should continue to use the last keyValues in case of extrapolation (progress > 1.0).
- // This is because the easing function can return a value slightly outside the range [0, 1]
- if (itStart != keyValues.constEnd()) {
- // this can't happen because we always prepend the default start value there
- if (itStart == keyValues.constBegin()) {
- ++itEnd;
+ QVariantAnimation::KeyValues::const_iterator it = qLowerBound(keyValues.constBegin(),
+ keyValues.constEnd(),
+ qMakePair(progress, QVariant()),
+ animationValueLessThan);
+ if (it == keyValues.constBegin()) {
+ //the item pointed to by it is the start element in the range
+ if (it->first == 0 && keyValues.count() > 1) {
+ currentInterval.start = *it;
+ currentInterval.end = *(it+1);
} else {
- --itStart;
+ currentInterval.start = qMakePair(qreal(0), defaultStartEndValue);
+ currentInterval.end = *it;
}
-
- // update all the values of the currentInterval
- currentInterval.start = *itStart;
- currentInterval.end = *itEnd;
- updateInterpolator();
+ } else if (it == keyValues.constEnd()) {
+ --it; //position the iterator on the last item
+ if (it->first == 1 && keyValues.count() > 1) {
+ //we have an end value (item with progress = 1)
+ currentInterval.start = *(it-1);
+ currentInterval.end = *it;
+ } else {
+ //we use the default end value here
+ currentInterval.start = *it;
+ currentInterval.end = qMakePair(qreal(1), defaultStartEndValue);
+ }
+ } else {
+ currentInterval.start = *(it-1);
+ currentInterval.end = *it;
}
+
+ // update all the values of the currentInterval
+ updateInterpolator();
}
setCurrentValueForProgress(progress);
}
@@ -298,8 +309,6 @@ void QVariantAnimationPrivate::setValueAt(qreal step, const QVariant &value)
} else {
if (value.isValid())
result->second = value; // replaces the previous value
- else if (step == 0 && !hasStartValue && defaultStartValue.isValid())
- result->second = defaultStartValue; // resets to the default start value
else
keyValues.erase(result); // removes the previous value
}
@@ -307,11 +316,10 @@ void QVariantAnimationPrivate::setValueAt(qreal step, const QVariant &value)
recalculateCurrentInterval(/*force=*/true);
}
-void QVariantAnimationPrivate::setDefaultStartValue(const QVariant &value)
+void QVariantAnimationPrivate::setDefaultStartEndValue(const QVariant &value)
{
- defaultStartValue = value;
- if (!hasStartValue)
- setValueAt(0, value);
+ defaultStartEndValue = value;
+ recalculateCurrentInterval(/*force=*/true);
}
/*!
@@ -526,11 +534,7 @@ void QVariantAnimation::setEndValue(const QVariant &value)
*/
QVariant QVariantAnimation::keyValueAt(qreal step) const
{
- Q_D(const QVariantAnimation);
- if (step == 0 && !d->hasStartValue)
- return QVariant(); //special case where we don't have an explicit startValue
-
- return d->valueAt(step);
+ return d_func()->valueAt(step);
}
/*!
@@ -552,10 +556,7 @@ QVariant QVariantAnimation::keyValueAt(qreal step) const
*/
void QVariantAnimation::setKeyValueAt(qreal step, const QVariant &value)
{
- Q_D(QVariantAnimation);
- if (step == 0)
- d->hasStartValue = value.isValid();
- d->setValueAt(step, value);
+ d_func()->setValueAt(step, value);
}
/*!
@@ -565,12 +566,7 @@ void QVariantAnimation::setKeyValueAt(qreal step, const QVariant &value)
*/
QVariantAnimation::KeyValues QVariantAnimation::keyValues() const
{
- Q_D(const QVariantAnimation);
- QVariantAnimation::KeyValues ret = d->keyValues;
- //in case we added the default start value, we remove it
- if (!d->hasStartValue && !ret.isEmpty() && ret.at(0).first == 0)
- ret.remove(0);
- return ret;
+ return d_func()->keyValues;
}
/*!
@@ -584,7 +580,6 @@ void QVariantAnimation::setKeyValues(const KeyValues &keyValues)
Q_D(QVariantAnimation);
d->keyValues = keyValues;
qSort(d->keyValues.begin(), d->keyValues.end(), animationValueLessThan);
- d->hasStartValue = !d->keyValues.isEmpty() && d->keyValues.at(0).first == 0;
d->recalculateCurrentInterval(/*force=*/true);
}
diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h
index dbfd956..ef57a4c 100644
--- a/src/corelib/animation/qvariantanimation_p.h
+++ b/src/corelib/animation/qvariantanimation_p.h
@@ -76,15 +76,14 @@ public:
return q->d_func();
}
- void setDefaultStartValue(const QVariant &value);
+ void setDefaultStartEndValue(const QVariant &value);
int duration;
QEasingCurve easing;
QVariantAnimation::KeyValues keyValues;
QVariant currentValue;
- QVariant defaultStartValue;
- bool hasStartValue;
+ QVariant defaultStartEndValue;
//this is used to keep track of the KeyValue interval in which we currently are
struct
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 7076a1e..5a2c329 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -848,6 +848,8 @@ typedef quint64 qulonglong;
&& sizeof(void *) == sizeof(qptrdiff)
*/
template <int> struct QIntegerForSize;
+template <> struct QIntegerForSize<1> { typedef quint8 Unsigned; typedef qint8 Signed; };
+template <> struct QIntegerForSize<2> { typedef quint16 Unsigned; typedef qint16 Signed; };
template <> struct QIntegerForSize<4> { typedef quint32 Unsigned; typedef qint32 Signed; };
template <> struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qint64 Signed; };
template <class T> struct QIntegerForSizeof: QIntegerForSize<sizeof(T)> { };
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 3394a00..4bae9f4 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -107,24 +107,15 @@ typedef DWORD (WINAPI *PtrGetNamedSecurityInfoW)(LPWSTR, SE_OBJECT_TYPE, SECURIT
static PtrGetNamedSecurityInfoW ptrGetNamedSecurityInfoW = 0;
typedef BOOL (WINAPI *PtrLookupAccountSidW)(LPCWSTR, PSID, LPWSTR, LPDWORD, LPWSTR, LPDWORD, PSID_NAME_USE);
static PtrLookupAccountSidW ptrLookupAccountSidW = 0;
-typedef BOOL (WINAPI *PtrAllocateAndInitializeSid)(PSID_IDENTIFIER_AUTHORITY, BYTE, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, PSID*);
-static PtrAllocateAndInitializeSid ptrAllocateAndInitializeSid = 0;
typedef VOID (WINAPI *PtrBuildTrusteeWithSidW)(PTRUSTEE_W, PSID);
static PtrBuildTrusteeWithSidW ptrBuildTrusteeWithSidW = 0;
-typedef VOID (WINAPI *PtrBuildTrusteeWithNameW)(PTRUSTEE_W, unsigned short*);
-static PtrBuildTrusteeWithNameW ptrBuildTrusteeWithNameW = 0;
typedef DWORD (WINAPI *PtrGetEffectiveRightsFromAclW)(PACL, PTRUSTEE_W, OUT PACCESS_MASK);
static PtrGetEffectiveRightsFromAclW ptrGetEffectiveRightsFromAclW = 0;
-typedef PVOID (WINAPI *PtrFreeSid)(PSID);
-static PtrFreeSid ptrFreeSid = 0;
static TRUSTEE_W currentUserTrusteeW;
+static TRUSTEE_W worldTrusteeW;
-typedef BOOL (WINAPI *PtrOpenProcessToken)(HANDLE, DWORD, PHANDLE );
-static PtrOpenProcessToken ptrOpenProcessToken = 0;
typedef BOOL (WINAPI *PtrGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD);
static PtrGetUserProfileDirectoryW ptrGetUserProfileDirectoryW = 0;
-typedef BOOL (WINAPI *PtrSetFilePointerEx)(HANDLE, LARGE_INTEGER, PLARGE_INTEGER, DWORD);
-static PtrSetFilePointerEx ptrSetFilePointerEx = 0;
QT_END_INCLUDE_NAMESPACE
@@ -152,67 +143,37 @@ void QFSFileEnginePrivate::resolveLibs()
if (advapiHnd) {
ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW");
ptrLookupAccountSidW = (PtrLookupAccountSidW)GetProcAddress(advapiHnd, "LookupAccountSidW");
- ptrAllocateAndInitializeSid = (PtrAllocateAndInitializeSid)GetProcAddress(advapiHnd, "AllocateAndInitializeSid");
ptrBuildTrusteeWithSidW = (PtrBuildTrusteeWithSidW)GetProcAddress(advapiHnd, "BuildTrusteeWithSidW");
- ptrBuildTrusteeWithNameW = (PtrBuildTrusteeWithNameW)GetProcAddress(advapiHnd, "BuildTrusteeWithNameW");
ptrGetEffectiveRightsFromAclW = (PtrGetEffectiveRightsFromAclW)GetProcAddress(advapiHnd, "GetEffectiveRightsFromAclW");
- ptrFreeSid = (PtrFreeSid)GetProcAddress(advapiHnd, "FreeSid");
}
- if (ptrBuildTrusteeWithNameW) {
- HINSTANCE versionHnd = LoadLibraryW(L"version");
- if (versionHnd) {
- typedef DWORD (WINAPI *PtrGetFileVersionInfoSizeW)(LPCWSTR lptstrFilename,LPDWORD lpdwHandle);
- PtrGetFileVersionInfoSizeW ptrGetFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)GetProcAddress(versionHnd, "GetFileVersionInfoSizeW");
- typedef BOOL (WINAPI *PtrGetFileVersionInfoW)(LPCWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData);
- PtrGetFileVersionInfoW ptrGetFileVersionInfoW = (PtrGetFileVersionInfoW)GetProcAddress(versionHnd, "GetFileVersionInfoW");
- typedef BOOL (WINAPI *PtrVerQueryValueW)(const LPVOID pBlock,LPCWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen);
- PtrVerQueryValueW ptrVerQueryValueW = (PtrVerQueryValueW)GetProcAddress(versionHnd, "VerQueryValueW");
- if(ptrGetFileVersionInfoSizeW && ptrGetFileVersionInfoW && ptrVerQueryValueW) {
- DWORD fakeHandle;
- DWORD versionSize = ptrGetFileVersionInfoSizeW(L"secur32.dll", &fakeHandle);
- if(versionSize) {
- LPVOID versionData;
- versionData = malloc(versionSize);
- if(ptrGetFileVersionInfoW(L"secur32.dll", 0, versionSize, versionData)) {
- UINT puLen;
- VS_FIXEDFILEINFO *pLocalInfo;
- if(ptrVerQueryValueW(versionData, L"\\", (void**)&pLocalInfo, &puLen)) {
- WORD wVer1, wVer2, wVer3, wVer4;
- wVer1 = HIWORD(pLocalInfo->dwFileVersionMS);
- wVer2 = LOWORD(pLocalInfo->dwFileVersionMS);
- wVer3 = HIWORD(pLocalInfo->dwFileVersionLS);
- wVer4 = LOWORD(pLocalInfo->dwFileVersionLS);
- // It will not work with secur32.dll version 5.0.2195.2862
- if(!(wVer1 == 5 && wVer2 == 0 && wVer3 == 2195 && (wVer4 == 2862 || wVer4 == 4587))) {
- HINSTANCE userHnd = LoadLibraryW(L"secur32");
- if (userHnd) {
- typedef BOOL (WINAPI *PtrGetUserNameExW)(EXTENDED_NAME_FORMAT nameFormat, ushort* lpBuffer, LPDWORD nSize);
- PtrGetUserNameExW ptrGetUserNameExW = (PtrGetUserNameExW)GetProcAddress(userHnd, "GetUserNameExW");
- if(ptrGetUserNameExW) {
- static wchar_t buffer[258];
- DWORD bufferSize = 257;
- ptrGetUserNameExW(NameSamCompatible, (ushort*)buffer, &bufferSize);
- ptrBuildTrusteeWithNameW(&currentUserTrusteeW, (ushort*)buffer);
- }
- FreeLibrary(userHnd);
- }
- }
- }
- }
- free(versionData);
- }
- }
- FreeLibrary(versionHnd);
+ if (ptrBuildTrusteeWithSidW) {
+ // Create TRUSTEE for current user
+ HANDLE hnd = ::GetCurrentProcess();
+ HANDLE token = 0;
+ if (::OpenProcessToken(hnd, TOKEN_QUERY, &token)) {
+ TOKEN_USER tu;
+ DWORD retsize;
+ if (::GetTokenInformation(token, TokenUser, &tu, sizeof(tu), &retsize))
+ ptrBuildTrusteeWithSidW(&currentUserTrusteeW, tu.User.Sid);
+ ::CloseHandle(token);
}
- ptrOpenProcessToken = (PtrOpenProcessToken)GetProcAddress(advapiHnd, "OpenProcessToken");
- HINSTANCE userenvHnd = LoadLibraryW(L"userenv");
- if (userenvHnd) {
- ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW");
+
+ typedef BOOL (WINAPI *PtrAllocateAndInitializeSid)(PSID_IDENTIFIER_AUTHORITY, BYTE, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, PSID*);
+ PtrAllocateAndInitializeSid ptrAllocateAndInitializeSid = (PtrAllocateAndInitializeSid)GetProcAddress(advapiHnd, "AllocateAndInitializeSid");
+ typedef PVOID (WINAPI *PtrFreeSid)(PSID);
+ PtrFreeSid ptrFreeSid = (PtrFreeSid)GetProcAddress(advapiHnd, "FreeSid");
+ if (ptrAllocateAndInitializeSid && ptrFreeSid) {
+ // Create TRUSTEE for Everyone (World)
+ SID_IDENTIFIER_AUTHORITY worldAuth = { SECURITY_WORLD_SID_AUTHORITY };
+ PSID pWorld = 0;
+ if (ptrAllocateAndInitializeSid(&worldAuth, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pWorld))
+ ptrBuildTrusteeWithSidW(&worldTrusteeW, pWorld);
+ ptrFreeSid(pWorld);
}
- HINSTANCE kernelHnd = LoadLibraryW(L"kernel32");
- if (kernelHnd)
- ptrSetFilePointerEx = (PtrSetFilePointerEx)GetProcAddress(kernelHnd, "SetFilePointerEx");
}
+ HINSTANCE userenvHnd = LoadLibraryW(L"userenv");
+ if (userenvHnd)
+ ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW");
#endif
}
}
@@ -596,34 +557,27 @@ qint64 QFSFileEnginePrivate::nativePos() const
if (fileHandle == INVALID_HANDLE_VALUE)
return 0;
-#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
- QFSFileEnginePrivate::resolveLibs();
- if (!ptrSetFilePointerEx) {
-#endif
- LARGE_INTEGER filepos;
- filepos.HighPart = 0;
- DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT);
- if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
- thatQ->setError(QFile::UnspecifiedError, qt_error_string());
- return 0;
- }
-
- // Note: This is the case for MOC, UIC, qmake and other
- // bootstrapped tools, and for Windows CE.
- filepos.LowPart = newFilePointer;
- return filepos.QuadPart;
-#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
- }
-
+#if !defined(Q_OS_WINCE)
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
offset.QuadPart = 0;
- if (!ptrSetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_CURRENT)) {
+ if (!::SetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_CURRENT)) {
thatQ->setError(QFile::UnspecifiedError, qt_error_string());
return 0;
}
return qint64(currentFilePos.QuadPart);
+#else
+ LARGE_INTEGER filepos;
+ filepos.HighPart = 0;
+ DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT);
+ if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+ thatQ->setError(QFile::UnspecifiedError, qt_error_string());
+ return 0;
+ }
+
+ filepos.LowPart = newFilePointer;
+ return filepos.QuadPart;
#endif
}
@@ -632,39 +586,32 @@ qint64 QFSFileEnginePrivate::nativePos() const
*/
bool QFSFileEnginePrivate::nativeSeek(qint64 pos)
{
- Q_Q(const QFSFileEngine);
- QFSFileEngine *thatQ = const_cast<QFSFileEngine *>(q);
+ Q_Q(QFSFileEngine);
if (fh || fd != -1) {
// stdlib / stdio mode.
return seekFdFh(pos);
}
-#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
- QFSFileEnginePrivate::resolveLibs();
- if (!ptrSetFilePointerEx) {
-#endif
- DWORD newFilePointer;
- LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos);
- newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN);
- if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
- thatQ->setError(QFile::PositionError, qt_error_string());
- return false;
- }
-
- // Note: This is the case for MOC, UIC, qmake and other
- // bootstrapped tools, and for Windows CE.
- return true;
-#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
- }
-
+#if !defined(Q_OS_WINCE)
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
offset.QuadPart = pos;
- if (ptrSetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_BEGIN) == 0) {
- thatQ->setError(QFile::UnspecifiedError, qt_error_string());
+ if (!::SetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_BEGIN)) {
+ q->setError(QFile::UnspecifiedError, qt_error_string());
return false;
}
+
+ return true;
+#else
+ DWORD newFilePointer;
+ LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos);
+ newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN);
+ if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+ q->setError(QFile::PositionError, qt_error_string());
+ return false;
+ }
+
return true;
#endif
}
@@ -1044,10 +991,10 @@ QString QFSFileEngine::homePath()
QString ret;
#if !defined(QT_NO_LIBRARY)
QFSFileEnginePrivate::resolveLibs();
- if (ptrOpenProcessToken && ptrGetUserProfileDirectoryW) {
+ if (ptrGetUserProfileDirectoryW) {
HANDLE hnd = ::GetCurrentProcess();
HANDLE token = 0;
- BOOL ok = ::ptrOpenProcessToken(hnd, TOKEN_QUERY, &token);
+ BOOL ok = ::OpenProcessToken(hnd, TOKEN_QUERY, &token);
if (ok) {
DWORD dwBufferSize = 0;
// First call, to determine size of the strings (with '\0').
@@ -1393,7 +1340,7 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const
enum { ReadMask = 0x00000001, WriteMask = 0x00000002, ExecMask = 0x00000020 };
resolveLibs();
- if(ptrGetNamedSecurityInfoW && ptrAllocateAndInitializeSid && ptrBuildTrusteeWithSidW && ptrGetEffectiveRightsFromAclW && ptrFreeSid) {
+ if(ptrGetNamedSecurityInfoW && ptrBuildTrusteeWithSidW && ptrGetEffectiveRightsFromAclW) {
QString fname = filePath.endsWith(QLatin1String(".lnk")) ? readLink(filePath) : filePath;
DWORD res = ptrGetNamedSecurityInfoW((wchar_t*)fname.utf16(), SE_FILE_OBJECT,
@@ -1435,21 +1382,14 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const
ret |= QAbstractFileEngine::ExeGroupPerm;
}
{ //other (world)
- // Create SID for Everyone (World)
- SID_IDENTIFIER_AUTHORITY worldAuth = { SECURITY_WORLD_SID_AUTHORITY };
- PSID pWorld = 0;
- if(ptrAllocateAndInitializeSid(&worldAuth, 1, SECURITY_WORLD_RID, 0,0,0,0,0,0,0, &pWorld)) {
- ptrBuildTrusteeWithSidW(&trustee, pWorld);
- if(ptrGetEffectiveRightsFromAclW(pDacl, &trustee, &access_mask) != ERROR_SUCCESS)
- access_mask = (ACCESS_MASK)-1; // ###
- if(access_mask & ReadMask)
- ret |= QAbstractFileEngine::ReadOtherPerm;
- if(access_mask & WriteMask)
- ret |= QAbstractFileEngine::WriteOtherPerm;
- if(access_mask & ExecMask)
- ret |= QAbstractFileEngine::ExeOtherPerm;
- }
- ptrFreeSid(pWorld);
+ if(ptrGetEffectiveRightsFromAclW(pDacl, &worldTrusteeW, &access_mask) != ERROR_SUCCESS)
+ access_mask = (ACCESS_MASK)-1; // ###
+ if(access_mask & ReadMask)
+ ret |= QAbstractFileEngine::ReadOtherPerm;
+ if(access_mask & WriteMask)
+ ret |= QAbstractFileEngine::WriteOtherPerm;
+ if(access_mask & ExecMask)
+ ret |= QAbstractFileEngine::ExeOtherPerm;
}
LocalFree(pSD);
}
@@ -1703,12 +1643,8 @@ bool QFSFileEngine::setPermissions(uint perms)
if (mode == 0) // not supported
return false;
-#if !defined(Q_OS_WINCE)
- ret = ::_wchmod((wchar_t*)d->filePath.utf16(), mode) == 0;
-#else
- ret = ::_wchmod((wchar_t*)d->longFileName(d->filePath).utf16(), mode);
-#endif
- return ret;
+ ret = ::_wchmod((wchar_t*)d->longFileName(d->filePath).utf16(), mode) == 0;
+ return ret;
}
bool QFSFileEngine::setSize(qint64 size)
diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp
index 2b5d4fe..77f680a 100644
--- a/src/corelib/kernel/qfunctions_wince.cpp
+++ b/src/corelib/kernel/qfunctions_wince.cpp
@@ -292,13 +292,14 @@ bool qt_wince__chmod(const char *file, int mode)
bool qt_wince__wchmod(const wchar_t *file, int mode)
{
+ BOOL success = FALSE;
// ### Does not work properly, what about just adding one property?
if(mode&_S_IWRITE) {
- return SetFileAttributes(file, FILE_ATTRIBUTE_NORMAL);
+ success = SetFileAttributes(file, FILE_ATTRIBUTE_NORMAL);
} else if((mode&_S_IREAD) && !(mode&_S_IWRITE)) {
- return SetFileAttributes(file, FILE_ATTRIBUTE_READONLY);
+ success = SetFileAttributes(file, FILE_ATTRIBUTE_READONLY);
}
- return false;
+ return success ? 0 : -1;
}
HANDLE qt_wince_CreateFileA(LPCSTR filename, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES attr, DWORD dispo, DWORD flags, HANDLE tempFile)
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index dfed4db..b26cfdd 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -658,6 +658,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
break;
case QVariant::Url:
*str = v_cast<QUrl>(d)->toString();
+ break;
default:
return false;
}
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index e3e1db6..60c7db4 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -107,6 +107,249 @@
cases, since they have the same functionality. See
\l{QWeakPointer#tracking-qobject} for more information.
+ \section1 Optional pointer tracking
+
+ A feature of QSharedPointer that can be enabled at compile-time for
+ debugging purposes is a pointer tracking mechanism. When enabled,
+ QSharedPointer registers in a global set all the pointers that it tracks.
+ This allows one to catch mistakes like assigning the same pointer to two
+ QSharedPointer objects.
+
+ This function is enabled by defining the \tt{QT_SHAREDPOINTER_TRACK_POINTERS}
+ macro before including the QSharedPointer header.
+
+ It is safe to use this feature even with code compiled without the
+ feature. QSharedPointer will ensure that the pointer is removed from the
+ tracker even from code compiled without pointer tracking.
+
+ Note, however, that the pointer tracking feature has limitations on
+ multiple- or virtual-inheritance (that is, in cases where two different
+ pointer addresses can refer to the same object). In that case, if a
+ pointer is cast to a different type and its value changes,
+ QSharedPointer's pointer tracking mechanism mail fail to detect that the
+ object being tracked is the same.
+
+ \omit
+ \secton1 QSharedPointer internals
+
+ QSharedPointer is in reality implemented by two ancestor classes:
+ QtSharedPointer::Basic and QtSharedPointer::ExternalRefCount. The reason
+ for having that split is now mostly legacy: in the beginning,
+ QSharedPointer was meant to support both internal reference counting and
+ external reference counting.
+
+ QtSharedPointer::Basic implements the basic functionality that is shared
+ between internal- and external-reference counting. That is, it's mostly
+ the accessor functions into QSharedPointer. Those are all inherited by
+ QSharedPointer, which adds another level of shared functionality (the
+ constructors and assignment operators). The Basic class has one member
+ variable, which is the actual pointer being tracked.
+
+ QtSharedPointer::ExternalRefCount implements the actual reference
+ counting and introduces the d-pointer for QSharedPointer. That d-pointer
+ itself is shared with with other QSharedPointer objects as well as
+ QWeakPointer.
+
+ The reason for keeping the pointer value itself outside the d-pointer is
+ because of multiple inheritance needs. If you have two QSharedPointer
+ objects of different pointer types, but pointing to the same object in
+ memory, it could happen that the pointer values are different. The \tt
+ differentPointers autotest exemplifies this problem. The same thing could
+ happen in the case of virtual inheritance: a pointer of class matching
+ the virtual base has different address compared to the pointer of the
+ complete object. See the \tt virtualBaseDifferentPointers autotest for
+ this problem.
+
+ The d pointer is of type QtSharedPointer::ExternalRefCountData for simple
+ QSharedPointer objects, but could be of a derived type in some cases. It
+ is basically a reference-counted reference-counter.
+
+ \section2 d-pointer
+ \section3 QtSharedPointer::ExternalRefCountData
+
+ This class is basically a reference-counted reference-counter. It has two
+ members: \tt strongref and \tt weakref. The strong reference counter is
+ controlling the lifetime of the object tracked by QSharedPointer. a
+ positive value indicates that the object is alive. It's also the number
+ of QSharedObject instances that are attached to this Data.
+
+ When the strong reference count decreases to zero, the object is deleted
+ (see below for information on custom deleters). The strong reference
+ count can also exceptionally be -1, indicating that there are no
+ QSharedPointers attached to an object, which is tracked too. The only
+ case where this is possible is that of
+ \l{QWeakPointer#tracking-qobject}{QWeakPointers tracking a QObject}.
+
+ The weak reference count controls the lifetime of the d-pointer itself.
+ It can be thought of as an internal/intrusive reference count for
+ ExternalRefCountData itself. This count is equal to the number of
+ QSharedPointers and QWeakPointers that are tracking this object. (In case
+ the object tracked derives from QObject, this number is increased by 1,
+ since QObjectPrivate tracks it too).
+
+ ExternalRefCountData is a virtual class: it has a virtual destructor and
+ a virtual destroy() function. The destroy() function is supposed to
+ delete the object being tracked and return true if it does so. Otherwise,
+ it returns false to indicate that the caller must simply call delete.
+ This allows the normal use-case of QSharedPointer without custom deleters
+ to use only one 12- or 16-byte (depending on whether it's a 32- or 64-bit
+ architecture) external descriptor structure, without paying the price for
+ the custom deleter that it isn't using.
+
+ \section3 QtSharedPointer::ExternalRefCountDataWithDestroyFn
+
+ This class is not used directly, per se. It only exists to enable the two
+ classes that derive from it. It adds one member variable, which is a
+ pointer to a function (which returns void and takes an
+ ExternalRefCountData* as a parameter). It also overrides the destroy()
+ function: it calls that function pointer with \tt this as parameter, and
+ returns true.
+
+ That means when ExternalRefCountDataWithDestroyFn is used, the \tt
+ destroyer field must be set to a valid function that \b will delete the
+ object tracked.
+
+ This class also adds an operator delete function to ensure that simply
+ calls the global operator delete. That should be the behaviour in all
+ compilers already, but to be on the safe side, this class ensures that no
+ funny business happens.
+
+ On a 32-bit architecture, this class is 16 bytes in size, whereas it's 24
+ bytes on 64-bit. (On Itanium where function pointers contain the global
+ pointer, it can be 32 bytes).
+
+ \section3 QtSharedPointer::ExternalRefCountWithCustomDeleter
+
+ This class derives from ExternalRefCountDataWithDestroyFn and is a
+ template class. As template parameters, it has the type of the pointer
+ being tracked (\tt T) and a \tt Deleter, which is anything. It adds two
+ fields to its parent class, matching those template parameters: a member
+ of type \tt Deleter and a member of type \tt T*.
+
+ The purpose of this class is to store the pointer to be deleted and the
+ deleter code along with the d-pointer. This allows the last strong
+ reference to call any arbitrary function that disposes of the object. For
+ example, this allows calling QObject::deleteLater() on a given object.
+ The pointer to the object is kept here to avoid the extra cost of keeping
+ the deleter in the generic case.
+
+ This class is never instantiated directly: the constructors and
+ destructor are private. Only the create() function may be called to
+ return an object of this type. See below for construction details.
+
+ The size of this class depends on the size of \tt Deleter. If it's an
+ empty functor (i.e., no members), ABIs generally assign it the size of 1.
+ But given that it's followed by a pointer, up to 3 or 7 padding bytes may
+ be inserted: in that case, the size of this class is 16+4+4 = 24 bytes on
+ 32-bit architectures, or 24+8+8 = 40 bytes on 64-bit architectures (48
+ bytes on Itanium with global pointers stored). If \tt Deleter is a
+ function pointer, the size should be the same as the empty structure
+ case, except for Itanium where it may be 56 bytes due to another global
+ pointer. If \tt Deleter is a pointer to a member function (PMF), the size
+ will be even bigger and will depend on the ABI. For architectures using
+ the Itanium C++ ABI, a PMF is twice the size of a normal pointer, or 24
+ bytes on Itanium itself. In that case, the size of this structure will be
+ 16+8+4 = 28 bytes on 32-bit architectures, 24+16+8 = 48 bytes on 64-bit,
+ and 32+24+8 = 64 bytes on Itanium.
+
+ (Values for Itanium consider an LP64 architecture; for ILP32, pointers
+ are 32-bit in length, function pointers are 64-bit and PMF are 96-bit, so
+ the sizes are slightly less)
+
+ \section3 QtSharedPointer::ExternalRefCountWithContiguousData
+
+ This class also derives from ExternalRefCountDataWithDestroyFn and it is
+ also a template class. The template parameter is the type \tt T of the
+ class which QSharedPointer tracks. It adds only one member to its parent,
+ which is of type \tt T (the actual type, not a pointer to it).
+
+ The purpose of this class is to lay the \tt T object out next to the
+ reference counts, saving one memory allocation per shared pointer. This
+ is particularly interesting for small \tt T or for the cases when there
+ are few if any QWeakPointer tracking the object. This class exists to
+ implement the QSharedPointer::create() call.
+
+ Like ExternalRefCountWithCustomDeleter, this class is never instantiated
+ directly. This class also provides a create() member that returns the
+ pointer, and hides its constructors and destructor. (With C++0x, we'd
+ delete them).
+
+ The size of this class depends on the size of \tt T.
+
+ \section3 Instantiating ExternalRefCountWithCustomDeleter and ExternalRefCountWithContiguousData
+
+ Like explained above, these classes have private constructors. Moreover,
+ they are not defined anywhere, so trying to call \tt{new ClassType} would
+ result in a compilation or linker error. Instead, these classes must be
+ constructed via their create() methods.
+
+ Instead of instantiating the class by the normal way, the create() method
+ calls \tt{operator new} directly with the size of the class, then calls
+ the parent class's constructor only (ExternalRefCountDataWithDestroyFn).
+ This ensures that the inherited members are initialised properly, as well
+ as the virtual table pointer, which must point to
+ ExternalRefCountDataWithDestroyFn's virtual table. That way, we also
+ ensure that the virtual destructor being called is
+ ExternalRefCountDataWithDestroyFn's.
+
+ After initialising the base class, the
+ ExternalRefCountWithCustomDeleter::create() function initialises the new
+ members directly, by using the placement \tt{operator new}. In the case
+ of the ExternalRefCountWithContiguousData::create() function, the address
+ to the still-uninitialised \tt T member is saved for the callee to use.
+ The member is only initialised in QSharedPointer::create(), so that we
+ avoid having many variants of the internal functions according to the
+ arguments in use for calling the constructor.
+
+ When initialising the parent class, the create() functions pass the
+ address of the static deleter() member function. That is, when the
+ virtual destroy() is called by QSharedPointer, the deleter() functions
+ are called instead. These functiosn static_cast the ExternalRefCountData*
+ parameter to their own type and execute their deletion: for the
+ ExternalRefCountWithCustomDeleter::deleter() case, it runs the user's
+ custom deleter, then destroys the deleter; for
+ ExternalRefCountWithContiguousData::deleter, it simply calls the \tt T
+ destructor directly.
+
+ By not calling the constructor of the derived classes, we avoid
+ instantiating their virtual tables. Since these classes are
+ template-based, there would be one virtual table per \tt T and \tt
+ Deleter type. (This is what Qt 4.5 did)
+
+ Instead, only one non-inline function is required per template, which is
+ the deleter() static member. All the other functions can be inlined.
+ What's more, the address of deleter() is calculated only in code, which
+ can be resolved at link-time if the linker can determine that the
+ function lies in the current application or library module (since these
+ classes are not exported, that is the case for Windows or for builds with
+ \tt{-fvisibility=hidden}).
+
+ In contrast, a virtual table would require at least 3 relocations to be
+ resolved at module load-time, per module where these classes are used.
+ (In the Itanium C++ ABI, there would be more relocations, due to the
+ RTTI)
+
+ \section3 Modifications due to pointer-tracking
+
+ To ensure that pointers created with pointer-tracking enabled get
+ un-tracked when destroyed, even if destroyed by code compiled without the
+ feature, QSharedPointer modifies slightly the instructions of the
+ previous sections.
+
+ When ExternalRefCountWithCustomDeleter or
+ ExternalRefCountWithContiguousData are used, their create() functions
+ will set the ExternalRefCountDataWithDestroyFn::destroyer function
+ pointer to safetyCheckDeleter() instead. These static member functions
+ simply call internalSafetyCheckRemove2() before passing control to the
+ normal deleter() function.
+
+ If neither custom deleter nor QSharedPointer::create() are used, then
+ QSharedPointer uses a custom deleter of its own: the normalDeleter()
+ function, which simply calls \tt delete. By using a custom deleter, the
+ safetyCheckDeleter() procedure described above kicks in.
+
+ \endomit
+
\sa QSharedDataPointer, QWeakPointer
*/
@@ -182,6 +425,29 @@
QWeakPointers created from QObject should never be passed to code that
hasn't been recompiled.
+ \omit
+ \secton1 QWeakPointer internals
+
+ QWeakPointer shares most of its internal functionality with
+ \l{QSharedPointer#qsharedpointer-internals}{QSharedPointer}, so see that
+ class's internal documentation for more information.
+
+ QWeakPointer requires an external reference counter in order to operate.
+ Therefore, it is incompatible by design with \l QSharedData-derived
+ classes.
+
+ It has a special QObject constructor, which works by calling
+ QtSharedPointer::ExternalRefCountData::getAndRef, which retrieves the
+ d-pointer from QObjectPrivate. If one isn't set yet, that function
+ creates the d-pointer and atomically sets it.
+
+ If getAndRef needs to create a d-pointer, it sets the strongref to -1,
+ indicating that the QObject is not shared: QWeakPointer is used only to
+ determine whether the QObject has been deleted. In that case, it cannot
+ be upgraded to QSharedPointer (see the previous section).
+
+ \endomit
+
\sa QSharedPointer
*/
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index ba479f9..cbeb79f 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -115,6 +115,9 @@ namespace QtSharedPointer {
template <class T> struct RemovePointer<QSharedPointer<T> > { typedef T Type; };
template <class T> struct RemovePointer<QWeakPointer<T> > { typedef T Type; };
+ // This class provides the basic functionality of a pointer wrapper.
+ // Its existence is mostly legacy, since originally QSharedPointer
+ // could also be used for internally-refcounted objects.
template <class T>
class Basic
{
@@ -155,6 +158,12 @@ namespace QtSharedPointer {
Type *value;
};
+ // This class is the d-pointer of QSharedPointer and QWeakPointer.
+ //
+ // It is a reference-counted reference counter. "strongref" is the inner
+ // reference counter, and it tracks the lifetime of the pointer itself.
+ // "weakref" is the outer reference counter and it tracks the lifetime of
+ // the ExternalRefCountData object.
struct ExternalRefCountData
{
QBasicAtomicInt weakref;
@@ -168,6 +177,9 @@ namespace QtSharedPointer {
inline ExternalRefCountData(Qt::Initialization) { }
virtual inline ~ExternalRefCountData() { Q_ASSERT(!weakref); Q_ASSERT(strongref <= 0); }
+ // overridden by derived classes
+ // returns false to indicate caller should delete the pointer
+ // returns true in case it has already done so
virtual inline bool destroy() { return false; }
#ifndef QT_NO_QOBJECT
@@ -178,18 +190,8 @@ namespace QtSharedPointer {
};
// sizeof(ExternalRefCount) = 12 (32-bit) / 16 (64-bit)
- template <class T, typename Deleter>
- struct CustomDeleter
- {
- Deleter deleter;
- T *ptr;
-
- inline CustomDeleter(T *p, Deleter d) : deleter(d), ptr(p) {}
- };
- // sizeof(CustomDeleter) = sizeof(Deleter) + sizeof(void*)
- // for Deleter = function pointer: 8 (32-bit) / 16 (64-bit)
- // for Deleter = PMF: 12 (32-bit) / 24 (64-bit) (GCC)
-
+ // This class extends ExternalRefCountData with a pointer
+ // to a function, which is called by the destroy() function.
struct ExternalRefCountWithDestroyFn: public ExternalRefCountData
{
typedef void (*DestroyerFn)(ExternalRefCountData *);
@@ -204,13 +206,26 @@ namespace QtSharedPointer {
};
// sizeof(ExternalRefCountWithDestroyFn) = 16 (32-bit) / 24 (64-bit)
+ // This class extends ExternalRefCountWithDestroyFn and implements
+ // the static function that deletes the object. The pointer and the
+ // custom deleter are kept in the "extra" member.
template <class T, typename Deleter>
struct ExternalRefCountWithCustomDeleter: public ExternalRefCountWithDestroyFn
{
typedef ExternalRefCountWithCustomDeleter Self;
- typedef ExternalRefCountWithDestroyFn Parent;
- typedef CustomDeleter<T, Deleter> Next;
- Next extra;
+ typedef ExternalRefCountWithDestroyFn BaseClass;
+
+ struct CustomDeleter
+ {
+ Deleter deleter;
+ T *ptr;
+
+ inline CustomDeleter(T *p, Deleter d) : deleter(d), ptr(p) {}
+ };
+ CustomDeleter extra;
+ // sizeof(CustomDeleter) = sizeof(Deleter) + sizeof(void*)
+ // for Deleter = function pointer: 8 (32-bit) / 16 (64-bit)
+ // for Deleter = PMF: 12 (32-bit) / 24 (64-bit) (GCC)
static inline void deleter(ExternalRefCountData *self)
{
@@ -218,7 +233,7 @@ namespace QtSharedPointer {
executeDeleter(realself->extra.ptr, realself->extra.deleter);
// delete the deleter too
- realself->extra.~Next();
+ realself->extra.~CustomDeleter();
}
static void safetyCheckDeleter(ExternalRefCountData *self)
{
@@ -236,8 +251,8 @@ namespace QtSharedPointer {
Self *d = static_cast<Self *>(::operator new(sizeof(Self)));
// initialize the two sub-objects
- new (&d->extra) Next(ptr, userDeleter);
- new (d) Parent(destroy); // can't throw
+ new (&d->extra) CustomDeleter(ptr, userDeleter);
+ new (d) BaseClass(destroy); // can't throw
return d;
}
@@ -247,6 +262,10 @@ namespace QtSharedPointer {
~ExternalRefCountWithCustomDeleter();
};
+ // This class extends ExternalRefCountWithDestroyFn and adds a "T"
+ // member. That way, when the create() function is called, we allocate
+ // memory for both QSharedPointer's d-pointer and the actual object being
+ // tracked.
template <class T>
struct ExternalRefCountWithContiguousData: public ExternalRefCountWithDestroyFn
{
@@ -289,6 +308,8 @@ namespace QtSharedPointer {
~ExternalRefCountWithContiguousData();
};
+ // This is the main body of QSharedPointer. It implements the
+ // external reference counting functionality.
template <class T>
class ExternalRefCount: public Basic<T>
{
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index c3e5501..537dab7 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1196,10 +1196,12 @@ QGraphicsItem::~QGraphicsItem()
Q_ASSERT(d_ptr->children.isEmpty());
}
- if (d_ptr->scene)
+ if (d_ptr->scene) {
d_ptr->scene->d_func()->removeItemHelper(this);
- else
+ } else {
+ d_ptr->resetFocusProxy();
d_ptr->setParentItemHelper(0);
+ }
if (d_ptr->transformData) {
for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
@@ -2613,13 +2615,11 @@ void QGraphicsItem::setFocusProxy(QGraphicsItem *item)
}
QGraphicsItem *lastFocusProxy = d_ptr->focusProxy;
+ if (lastFocusProxy)
+ lastFocusProxy->d_ptr->focusProxyRefs.removeOne(&d_ptr->focusProxy);
d_ptr->focusProxy = item;
- if (d_ptr->scene) {
- if (lastFocusProxy)
- d_ptr->scene->d_func()->focusProxyReverseMap.remove(lastFocusProxy, this);
- if (item)
- d_ptr->scene->d_func()->focusProxyReverseMap.insert(item, this);
- }
+ if (item)
+ item->d_ptr->focusProxyRefs << &d_ptr->focusProxy;
}
/*!
@@ -4626,6 +4626,19 @@ void QGraphicsItemPrivate::clearSubFocus()
/*!
\internal
+ Sets the focusProxy pointer to 0 for all items that have this item as their
+ focusProxy. ### Qt 5: Use QPointer instead.
+*/
+void QGraphicsItemPrivate::resetFocusProxy()
+{
+ for (int i = 0; i < focusProxyRefs.size(); ++i)
+ *focusProxyRefs.at(i) = 0;
+ focusProxyRefs.clear();
+}
+
+/*!
+ \internal
+
Tells us if it is a proxy widget
*/
bool QGraphicsItemPrivate::isProxyWidget() const
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 982cdfc..c654d4f 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -398,6 +398,7 @@ public:
void setSubFocus();
void clearSubFocus();
+ void resetFocusProxy();
inline QTransform transformToParent() const;
inline void ensureSortedChildren();
@@ -419,6 +420,7 @@ public:
int siblingIndex;
int depth;
QGraphicsItem *focusProxy;
+ QList<QGraphicsItem **> focusProxyRefs;
QGraphicsItem *subFocusItem;
Qt::InputMethodHints imHints;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index bdd1ac6..2178850 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -494,11 +494,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
item->d_func()->scene = 0;
// Unregister focus proxy.
- QMultiHash<QGraphicsItem *, QGraphicsItem *>::iterator it = focusProxyReverseMap.find(item);
- while (it != focusProxyReverseMap.end() && it.key() == item) {
- it.value()->d_ptr->focusProxy = 0;
- it = focusProxyReverseMap.erase(it);
- }
+ item->d_ptr->resetFocusProxy();
// Remove from parent, or unregister from toplevels.
if (QGraphicsItem *parentItem = item->parentItem()) {
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 8b53306..836522d 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -131,7 +131,6 @@ public:
QGraphicsWidget *activeWindow;
int activationRefCount;
void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason);
- QMultiHash<QGraphicsItem *, QGraphicsItem *> focusProxyReverseMap;
QList<QGraphicsWidget *> popupWidgets;
void addPopup(QGraphicsWidget *widget);
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 769ccef..4f32ecc 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -73,6 +73,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
currentlyCommittingEditor(0),
pressedModifiers(Qt::NoModifier),
pressedPosition(QPoint(-1, -1)),
+ pressedAlreadySelected(false),
viewportEnteredNeeded(false),
state(QAbstractItemView::NoState),
editTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed),
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 945d5e7..1870a3b 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1968,7 +1968,8 @@ QListViewPrivate::QListViewPrivate()
modeProperties(0),
column(0),
uniformItemSizes(false),
- batchSize(100)
+ batchSize(100),
+ showElasticBand(false)
{
}
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index cbe1d2a..539a642 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2797,15 +2797,14 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const
if (isRightToLeft()) {
start = (start == -1 ? count - 1 : start);
- end = (end == -1 ? 0 : end);
+ end = 0;
} else {
start = (start == -1 ? 0 : start);
- end = (end == -1 ? count - 1 : end);
+ end = count - 1;
}
- int tmp = start;
- start = qMin(start, end);
- end = qMax(tmp, end);
+ if (end < start)
+ qSwap(end, start);
int height = -1;
QStyleOptionViewItemV4 option = d->viewOptionsV4();
diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h
index d17016f..1bbba89 100644
--- a/src/gui/itemviews/qtreeview_p.h
+++ b/src/gui/itemviews/qtreeview_p.h
@@ -82,7 +82,7 @@ public:
uniformRowHeights(false), rootDecoration(true),
itemsExpandable(true), sortingEnabled(false),
expandsOnDoubleClick(true),
- allColumnsShowFocus(false), current(0),
+ allColumnsShowFocus(false), current(0), spanning(false),
animationsEnabled(false), columnResizeTimerID(0),
autoExpandDelay(-1), hoverBranch(-1), geometryRecursionBlock(false) {}
diff --git a/src/gui/kernel/qkde.cpp b/src/gui/kernel/qkde.cpp
index 23de838..98bf0a0 100644
--- a/src/gui/kernel/qkde.cpp
+++ b/src/gui/kernel/qkde.cpp
@@ -139,8 +139,6 @@ QString QKde::kdeStyle()
return QLatin1String("plastique");
else
return QLatin1String("windows");
-
- return QString();
}
/*!\internal
diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp
index ac0ea08..ae8afed 100644
--- a/src/gui/painting/qcssutil.cpp
+++ b/src/gui/painting/qcssutil.cpp
@@ -353,7 +353,7 @@ void qDrawBorder(QPainter *p, const QRect &rect, const QCss::BorderStyle *styles
qNormalizeRadii(rect, radii, &tlr, &trr, &blr, &brr);
// Drawn in increasing order of precendence
- if (styles[BottomEdge] != BorderStyle_None) {
+ if (styles[BottomEdge] != BorderStyle_None && borders[BottomEdge] > 0) {
qreal dw1 = (blr.width() || paintsOver(styles, colors, BottomEdge, LeftEdge)) ? 0 : borders[LeftEdge];
qreal dw2 = (brr.width() || paintsOver(styles, colors, BottomEdge, RightEdge)) ? 0 : borders[RightEdge];
qreal x1 = br.x() + blr.width();
@@ -365,7 +365,7 @@ void qDrawBorder(QPainter *p, const QRect &rect, const QCss::BorderStyle *styles
if (blr.width() || brr.width())
qDrawRoundedCorners(p, x1, y1, x2, y2, blr, brr, BottomEdge, styles[BottomEdge], colors[BottomEdge]);
}
- if (styles[RightEdge] != BorderStyle_None) {
+ if (styles[RightEdge] != BorderStyle_None && borders[RightEdge] > 0) {
qreal dw1 = (trr.height() || paintsOver(styles, colors, RightEdge, TopEdge)) ? 0 : borders[TopEdge];
qreal dw2 = (brr.height() || paintsOver(styles, colors, RightEdge, BottomEdge)) ? 0 : borders[BottomEdge];
qreal x1 = br.x() + br.width() - borders[RightEdge];
@@ -377,7 +377,7 @@ void qDrawBorder(QPainter *p, const QRect &rect, const QCss::BorderStyle *styles
if (trr.height() || brr.height())
qDrawRoundedCorners(p, x1, y1, x2, y2, trr, brr, RightEdge, styles[RightEdge], colors[RightEdge]);
}
- if (styles[LeftEdge] != BorderStyle_None) {
+ if (styles[LeftEdge] != BorderStyle_None && borders[LeftEdge] > 0) {
qreal dw1 = (tlr.height() || paintsOver(styles, colors, LeftEdge, TopEdge)) ? 0 : borders[TopEdge];
qreal dw2 = (blr.height() || paintsOver(styles, colors, LeftEdge, BottomEdge)) ? 0 : borders[BottomEdge];
qreal x1 = br.x();
@@ -389,7 +389,7 @@ void qDrawBorder(QPainter *p, const QRect &rect, const QCss::BorderStyle *styles
if (tlr.height() || blr.height())
qDrawRoundedCorners(p, x1, y1, x2, y2, tlr, blr, LeftEdge, styles[LeftEdge], colors[LeftEdge]);
}
- if (styles[TopEdge] != BorderStyle_None) {
+ if (styles[TopEdge] != BorderStyle_None && borders[TopEdge] > 0) {
qreal dw1 = (tlr.width() || paintsOver(styles, colors, TopEdge, LeftEdge)) ? 0 : borders[LeftEdge];
qreal dw2 = (trr.width() || paintsOver(styles, colors, TopEdge, RightEdge)) ? 0 : borders[RightEdge];
qreal x1 = br.x() + tlr.width();
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index b6d7842..8832a3d 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
ny = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; \
if (t == TxProject) { \
qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); \
- if (w < Q_NEAR_CLIP) w = Q_NEAR_CLIP; \
+ if (w < qreal(Q_NEAR_CLIP)) w = qreal(Q_NEAR_CLIP); \
w = 1./w; \
nx *= w; \
ny *= w; \
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index d4940d6..cce35b7 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -5196,8 +5196,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = Qt::ToolButtonIconOnly;
#ifdef Q_WS_X11
{
- Q_D(const QCommonStyle);
- static int buttonStyle = d->lookupToolButtonStyle();
+ static int buttonStyle = d_func()->lookupToolButtonStyle();
return buttonStyle;
}
#endif
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 370290f..8ac811c 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1298,7 +1298,6 @@ void QRenderRule::unsetClip(QPainter *p)
void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& off)
{
- setClip(p, borderRect(rect));
QBrush brush = hasBackground() ? background()->brush : QBrush();
if (brush.style() == Qt::NoBrush)
brush = defaultBackground;
@@ -1306,11 +1305,19 @@ void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& o
if (brush.style() != Qt::NoBrush) {
Origin origin = hasBackground() ? background()->clip : Origin_Border;
// ### fix for gradients
- p->fillRect(originRect(rect, origin), brush);
+ const QPainterPath &borderPath = borderClip(originRect(rect, origin));
+ if (!borderPath.isEmpty()) {
+ // Drawn intead of being used as clipping path for better visual quality
+ bool wasAntialiased = p->renderHints() & QPainter::Antialiasing;
+ p->setRenderHint(QPainter::Antialiasing);
+ p->fillPath(borderPath, brush);
+ p->setRenderHint(QPainter::Antialiasing, wasAntialiased);
+ } else {
+ p->fillRect(originRect(rect, origin), brush);
+ }
}
drawBackgroundImage(p, rect, off);
- unsetClip(p);
}
void QRenderRule::drawFrame(QPainter *p, const QRect& rect)
diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
index ae3af31..2900d39 100644
--- a/src/gui/widgets/qdatetimeedit.cpp
+++ b/src/gui/widgets/qdatetimeedit.cpp
@@ -1086,6 +1086,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
//hide cursor
d->edit->d_func()->setCursorVisible(false);
+ d->edit->d_func()->control->setCursorBlinkPeriod(0);
d->setSelected(0);
}
}
@@ -1106,9 +1107,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
//hide cursor
d->edit->d_func()->setCursorVisible(false);
- if (d->edit->d_func()->cursorTimer > 0)
- killTimer(d->edit->d_func()->cursorTimer);
- d->edit->d_func()->cursorTimer = 0;
+ d->edit->d_func()->control->setCursorBlinkPeriod(0);
d->setSelected(0);
oldCurrent = 0;
diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp
index 5950d85..08fce9b 100644
--- a/src/gui/widgets/qlineedit_p.cpp
+++ b/src/gui/widgets/qlineedit_p.cpp
@@ -138,6 +138,7 @@ void QLineEditPrivate::init(const QString& txt)
{
Q_Q(QLineEdit);
control = new QLineControl(txt);
+ control->setFont(q->font());
QObject::connect(control, SIGNAL(textChanged(const QString &)),
q, SIGNAL(textChanged(const QString &)));
QObject::connect(control, SIGNAL(textEdited(const QString &)),
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 9243217..88059a0 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -73,7 +73,7 @@ class QMainWindowPrivate : public QWidgetPrivate
Q_DECLARE_PUBLIC(QMainWindow)
public:
inline QMainWindowPrivate()
- : layout(0), toolButtonStyle(Qt::ToolButtonIconOnly)
+ : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly)
#ifdef Q_WS_MAC
, useHIToolBar(false)
#endif
@@ -107,8 +107,6 @@ void QMainWindowPrivate::init()
layout = new QMainWindowLayout(q);
const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q);
iconSize = QSize(metric, metric);
- explicitIconSize = false;
-
q->setAttribute(Qt::WA_Hover);
}
diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp
index 390d1b8..37525e2 100644
--- a/src/gui/widgets/qscrollbar.cpp
+++ b/src/gui/widgets/qscrollbar.cpp
@@ -431,6 +431,12 @@ void QScrollBarPrivate::init()
q->setSizePolicy(sp);
q->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
q->setAttribute(Qt::WA_OpaquePaintEvent);
+
+#if !defined(QT_NO_CONTEXTMENU) && defined(Q_WS_WINCE)
+ if (!q->style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, 0, q)) {
+ q->setContextMenuPolicy(Qt::PreventContextMenu);
+ }
+#endif
}
#ifndef QT_NO_CONTEXTMENU
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 8eb2e15..6a8609e 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -2400,18 +2400,12 @@ QVariant QODBCDriver::handle() const
QString QODBCDriver::escapeIdentifier(const QString &identifier, IdentifierType) const
{
+ QChar quote = d->quoteChar();
QString res = identifier;
- if (d->isMySqlServer) {
- if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('`')) && !identifier.endsWith(QLatin1Char('`')) ) {
- res.prepend(QLatin1Char('`')).append(QLatin1Char('`'));
- res.replace(QLatin1Char('.'), QLatin1String("`.`"));
- }
- } else {
- if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) {
- res.replace(QLatin1Char('"'), QLatin1String("\"\""));
- res.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
- res.replace(QLatin1Char('.'), QLatin1String("\".\""));
- }
+ if(!identifier.isEmpty() && !identifier.startsWith(quote) && !identifier.endsWith(quote) ) {
+ res.replace(quote, QString(quote)+QString(quote));
+ res.prepend(quote).append(quote);
+ res.replace(QLatin1Char('.'), QString(quote)+QLatin1Char('.')+QString(quote));
}
return res;
}
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 3b877ae..1d22dec 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -894,10 +894,10 @@ bool RCCResourceLibrary::writeInitializer()
if (m_useNameSpace)
writeString("QT_BEGIN_NAMESPACE\n\n");
if (m_root) {
- writeString("extern bool qRegisterResourceData\n "
+ writeString("extern Q_CORE_EXPORT bool qRegisterResourceData\n "
"(int, const unsigned char *, "
"const unsigned char *, const unsigned char *);\n\n");
- writeString("extern bool qUnregisterResourceData\n "
+ writeString("extern Q_CORE_EXPORT bool qUnregisterResourceData\n "
"(int, const unsigned char *, "
"const unsigned char *, const unsigned char *);\n\n");
}