summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/boxes/scene.cpp5
-rw-r--r--demos/boxes/trackball.cpp14
-rw-r--r--examples/graphicsview/flowlayout/flowlayout.cpp28
-rw-r--r--examples/graphicsview/flowlayout/main.cpp1
-rw-r--r--examples/graphicsview/flowlayout/window.cpp2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp23
-rw-r--r--src/corelib/arch/qatomic_windows.h49
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp10
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp18
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp6
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp164
-rw-r--r--src/gui/kernel/qsizepolicy.h12
-rw-r--r--src/gui/painting/qpaintbuffer.cpp101
-rw-r--r--src/gui/painting/qpaintbuffer_p.h8
-rw-r--r--src/gui/painting/qpainter.cpp68
-rw-r--r--src/gui/text/qtextdocument.cpp8
-rw-r--r--src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp60
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt8
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result8
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result8
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result6
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result10
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt8
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result6
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result8
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result12
-rw-r--r--tests/auto/linguist/lupdate/testdata/recursivescan/project.ui6
-rw-r--r--tests/auto/qfiledialog/qfiledialog.pro9
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp3
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp60
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp79
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp21
-rw-r--r--tests/auto/qtimer/tst_qtimer.cpp40
-rw-r--r--tests/manual/qtabletevent/device_information/tabletwidget.cpp1
-rw-r--r--tools/qttracereplay/main.cpp52
40 files changed, 690 insertions, 251 deletions
diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp
index 7c0d4d8..0975fc5 100644
--- a/demos/boxes/scene.cpp
+++ b/demos/boxes/scene.cpp
@@ -718,8 +718,6 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox)
glPushMatrix();
QMatrix4x4 m;
m.rotate(m_trackBalls[1].rotation());
- m = m.transposed();
-
multMatrix(m);
glRotatef(360.0f * i / m_programs.size(), 0.0f, 0.0f, 1.0f);
@@ -753,7 +751,6 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox)
if (-1 != excludeBox) {
QMatrix4x4 m;
m.rotate(m_trackBalls[0].rotation());
- m = m.transposed();
multMatrix(m);
if (glActiveTexture) {
@@ -880,7 +877,7 @@ void Scene::renderCubemaps()
GLRenderTargetCube::getViewMatrix(mat, face);
QVector4D v = QVector4D(-center.x(), -center.y(), -center.z(), 1.0);
- mat.setColumn(3, v * mat);
+ mat.setColumn(3, mat * v);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
renderBoxes(mat, i);
diff --git a/demos/boxes/trackball.cpp b/demos/boxes/trackball.cpp
index 9898441..60de6af 100644
--- a/demos/boxes/trackball.cpp
+++ b/demos/boxes/trackball.cpp
@@ -92,9 +92,9 @@ void TrackBall::move(const QPointF& p, const QQuaternion &transformation)
{
QLineF delta(m_lastPos, p);
m_angularVelocity = 180*delta.length() / (PI*msecs);
- m_axis = QVector3D(delta.dy(), -delta.dx(), 0.0f).normalized();
+ m_axis = QVector3D(-delta.dy(), delta.dx(), 0.0f).normalized();
m_axis = transformation.rotateVector(m_axis);
- m_rotation *= QQuaternion::fromAxisAndAngle(m_axis, delta.length());
+ m_rotation = QQuaternion::fromAxisAndAngle(m_axis, 180 / PI * delta.length()) * m_rotation;
}
break;
case Sphere:
@@ -113,13 +113,13 @@ void TrackBall::move(const QPointF& p, const QQuaternion &transformation)
else
currentPos3D.normalize();
- m_axis = QVector3D::crossProduct(currentPos3D, lastPos3D);
- float angle = asin(sqrt(QVector3D::dotProduct(m_axis, m_axis)));
+ m_axis = QVector3D::crossProduct(lastPos3D, currentPos3D);
+ float angle = 180 / PI * asin(sqrt(QVector3D::dotProduct(m_axis, m_axis)));
- m_angularVelocity = 180*angle / (PI*msecs);
+ m_angularVelocity = angle / msecs;
m_axis.normalize();
m_axis = transformation.rotateVector(m_axis);
- m_rotation *= QQuaternion::fromAxisAndAngle(m_axis, angle);
+ m_rotation = QQuaternion::fromAxisAndAngle(m_axis, angle) * m_rotation;
}
break;
}
@@ -155,6 +155,6 @@ QQuaternion TrackBall::rotation() const
QTime currentTime = QTime::currentTime();
float angle = m_angularVelocity * m_lastTime.msecsTo(currentTime);
- return m_rotation * QQuaternion::fromAxisAndAngle(m_axis, angle);
+ return QQuaternion::fromAxisAndAngle(m_axis, angle) * m_rotation;
}
diff --git a/examples/graphicsview/flowlayout/flowlayout.cpp b/examples/graphicsview/flowlayout/flowlayout.cpp
index d4fc49d..32a2830 100644
--- a/examples/graphicsview/flowlayout/flowlayout.cpp
+++ b/examples/graphicsview/flowlayout/flowlayout.cpp
@@ -98,12 +98,10 @@ void FlowLayout::setGeometry(const QRectF &geom)
qreal FlowLayout::doLayout(const QRectF &geom, bool applyNewGeometry) const
{
- QPointF tl = geom.topLeft();
- qreal maxw = geom.width();
-
qreal left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
- maxw = maxw - left - right;
+ const qreal maxw = geom.width() - left - right;
+
qreal x = 0;
qreal y = 0;
qreal maxRowHeight = 0;
@@ -139,9 +137,11 @@ QSizeF FlowLayout::minSize(const QSizeF &constraint) const
QSizeF size(0, 0);
qreal left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
- if (constraint.width() > 0) { // height for width
- qreal height = doLayout(QRectF(QPointF(0,0), constraint), false);
+ if (constraint.width() >= 0) { // height for width
+ const qreal height = doLayout(QRectF(QPointF(0,0), constraint), false);
size = QSizeF(constraint.width(), height);
+ } else if (constraint.height() >= 0) { // width for height?
+ // not supported
} else {
QGraphicsLayoutItem *item;
foreach (item, m_items)
@@ -153,8 +153,8 @@ QSizeF FlowLayout::minSize(const QSizeF &constraint) const
QSizeF FlowLayout::prefSize() const
{
- qreal left, top, right, bottom;
- getContentsMargins(&left, &top, &right, &bottom);
+ qreal left, right;
+ getContentsMargins(&left, 0, &right, 0);
QGraphicsLayoutItem *item;
qreal maxh = 0;
@@ -196,15 +196,19 @@ QSizeF FlowLayout::maxSize() const
QSizeF FlowLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
{
+ QSizeF sh = constraint;
switch (which) {
case Qt::PreferredSize:
- return prefSize();
+ sh = prefSize();
+ break;
case Qt::MinimumSize:
- return minSize(constraint);
+ sh = minSize(constraint);
+ break;
case Qt::MaximumSize:
- return maxSize();
+ sh = maxSize();
+ break;
default:
break;
}
- return constraint;
+ return sh;
}
diff --git a/examples/graphicsview/flowlayout/main.cpp b/examples/graphicsview/flowlayout/main.cpp
index 206f604..e672ae6 100644
--- a/examples/graphicsview/flowlayout/main.cpp
+++ b/examples/graphicsview/flowlayout/main.cpp
@@ -50,6 +50,7 @@ int main(int argc, char **argv)
QGraphicsView *view = new QGraphicsView(&scene);
Window *w = new Window;
scene.addItem(w);
+ view->resize(400, 300);
view->show();
return app.exec();
}
diff --git a/examples/graphicsview/flowlayout/window.cpp b/examples/graphicsview/flowlayout/window.cpp
index 2d98026..017659a 100644
--- a/examples/graphicsview/flowlayout/window.cpp
+++ b/examples/graphicsview/flowlayout/window.cpp
@@ -49,7 +49,7 @@ Window::Window()
{
FlowLayout *lay = new FlowLayout;
QLatin1String wiseWords("I am not bothered by the fact that I am unknown."
- "I am bothered when I do not know others. (Confucius)");
+ " I am bothered when I do not know others. (Confucius)");
QString sentence(wiseWords);
QStringList words = sentence.split(QLatin1Char(' '), QString::SkipEmptyParts);
for (int i = 0; i < words.count(); ++i) {
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
index f0d3b84..0eb0799 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
@@ -73,6 +73,19 @@ namespace JSC {
#define SYMBOL_STRING(name) #name
#endif
+#if PLATFORM(DARWIN)
+ // Mach-O platform
+#define HIDE_SYMBOL(name) ".private_extern _" #name
+#elif PLATFORM(AIX)
+ // IBM's own file format
+#define HIDE_SYMBOL(name) ".lglobl " #name
+#elif PLATFORM(LINUX) || PLATFORM(FREEBSD) || PLATFORM(OPENBSD) || PLATFORM(SOLARIS) || (PLATFORM(HPUX) && PLATFORM(IA64)) || PLATFORM(SYMBIAN) || PLATFORM(NETBSD)
+ // ELF platform
+#define HIDE_SYMBOL(name) ".hidden " #name
+#else
+#define HIDE_SYMBOL(name)
+#endif
+
#if COMPILER(GCC) && PLATFORM(X86)
// These ASSERTs remind you that, if you change the layout of JITStackFrame, you
@@ -83,6 +96,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x1c, JITStackFrame_s
asm volatile (
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
SYMBOL_STRING(ctiTrampoline) ":" "\n"
"pushl %ebp" "\n"
"movl %esp, %ebp" "\n"
@@ -103,6 +117,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
asm volatile (
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
#if !USE(JIT_STUB_ARGUMENT_VA_LIST)
"movl %esp, %ecx" "\n"
@@ -118,6 +133,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
asm volatile (
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"addl $0x1c, %esp" "\n"
"popl %ebx" "\n"
@@ -141,6 +157,7 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x48, JITStackFrame_s
asm volatile (
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
SYMBOL_STRING(ctiTrampoline) ":" "\n"
"pushq %rbp" "\n"
"movq %rsp, %rbp" "\n"
@@ -167,6 +184,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
asm volatile (
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"movq %rsp, %rdi" "\n"
"call " SYMBOL_STRING(cti_vm_throw) "\n"
@@ -182,6 +200,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
asm volatile (
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"addq $0x48, %rsp" "\n"
"popq %rbx" "\n"
@@ -203,6 +222,7 @@ asm volatile (
".text" "\n"
".align 2" "\n"
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
".thumb" "\n"
".thumb_func " SYMBOL_STRING(ctiTrampoline) "\n"
SYMBOL_STRING(ctiTrampoline) ":" "\n"
@@ -229,6 +249,7 @@ asm volatile (
".text" "\n"
".align 2" "\n"
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
".thumb" "\n"
".thumb_func " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
@@ -246,6 +267,7 @@ asm volatile (
".text" "\n"
".align 2" "\n"
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
".thumb" "\n"
".thumb_func " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
@@ -591,6 +613,7 @@ namespace JITStubs {
".text" "\n" \
".align 2" "\n" \
".globl " SYMBOL_STRING(cti_##op) "\n" \
+ HIDE_SYMBOL(cti_##op) "\n" \
".thumb" "\n" \
".thumb_func " SYMBOL_STRING(cti_##op) "\n" \
SYMBOL_STRING(cti_##op) ":" "\n" \
diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h
index 6082d0b..07b0b25 100644
--- a/src/corelib/arch/qatomic_windows.h
+++ b/src/corelib/arch/qatomic_windows.h
@@ -102,9 +102,14 @@
#define QT_INTERLOCKED_CONCAT(prefix, suffix) \
QT_INTERLOCKED_CONCAT_I(prefix, suffix)
-// MSVC intrinsics prefix function names with an underscore
+// MSVC intrinsics prefix function names with an underscore. Also, if platform
+// SDK headers have been included, the Interlocked names may be defined as
+// macros.
+// To avoid double underscores, we paste the prefix with Interlocked first and
+// then the remainder of the function name.
#define QT_INTERLOCKED_FUNCTION(name) \
- QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, name)
+ QT_INTERLOCKED_CONCAT( \
+ QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, Interlocked), name)
#ifdef QT_INTERLOCKED_NO_VOLATILE
# define QT_INTERLOCKED_VOLATILE
@@ -127,16 +132,16 @@
extern "C" {
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedIncrement )(long QT_INTERLOCKED_VOLATILE *);
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedDecrement )(long QT_INTERLOCKED_VOLATILE *);
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedCompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long);
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchange )(long QT_INTERLOCKED_VOLATILE *, long);
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment )(long QT_INTERLOCKED_VOLATILE *);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement )(long QT_INTERLOCKED_VOLATILE *);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
- void * QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
- void * QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
- __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
+ void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
+ void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
+ __int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
# endif
}
@@ -156,7 +161,7 @@ extern "C" {
# pragma intrinsic (_InterlockedCompareExchange)
# pragma intrinsic (_InterlockedExchangeAdd)
-# ifndef _M_IX86
+# if !defined(Q_OS_WINCE) && !defined(_M_IX86)
# pragma intrinsic (_InterlockedCompareExchangePointer)
# pragma intrinsic (_InterlockedExchangePointer)
# pragma intrinsic (_InterlockedExchangeAdd64)
@@ -168,26 +173,26 @@ extern "C" {
// Interlocked* replacement macros
#define QT_INTERLOCKED_INCREMENT(value) \
- QT_INTERLOCKED_FUNCTION(InterlockedIncrement)( \
+ QT_INTERLOCKED_FUNCTION( Increment )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ) )
#define QT_INTERLOCKED_DECREMENT(value) \
- QT_INTERLOCKED_FUNCTION(InterlockedDecrement)( \
+ QT_INTERLOCKED_FUNCTION( Decrement )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ) )
#define QT_INTERLOCKED_COMPARE_EXCHANGE(value, newValue, expectedValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedCompareExchange)( \
+ QT_INTERLOCKED_FUNCTION( CompareExchange )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
newValue, \
expectedValue )
#define QT_INTERLOCKED_EXCHANGE(value, newValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchange)( \
+ QT_INTERLOCKED_FUNCTION( Exchange )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
newValue )
#define QT_INTERLOCKED_EXCHANGE_ADD(value, valueToAdd) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd)( \
+ QT_INTERLOCKED_FUNCTION( ExchangeAdd )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
valueToAdd )
@@ -195,36 +200,36 @@ extern "C" {
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
reinterpret_cast<void *>( \
- QT_INTERLOCKED_FUNCTION(InterlockedCompareExchange)( \
+ QT_INTERLOCKED_FUNCTION( CompareExchange )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
(long)( newValue ), \
(long)( expectedValue ) ))
# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchange)( \
+ QT_INTERLOCKED_FUNCTION( Exchange )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
(quintptr)( newValue ) )
# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd)( \
+ QT_INTERLOCKED_FUNCTION( ExchangeAdd )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
valueToAdd )
#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedCompareExchangePointer)( \
+ QT_INTERLOCKED_FUNCTION( CompareExchangePointer )( \
reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \
newValue, \
expectedValue )
# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchangePointer)( \
+ QT_INTERLOCKED_FUNCTION( ExchangePointer )( \
reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \
newValue )
# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd64)( \
+ QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
valueToAdd )
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index b7934db..9c308a3 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -331,7 +331,7 @@ public:
WinTimerVec timerVec;
WinTimerDict timerDict;
void registerTimer(WinTimerInfo *t);
- void unregisterTimer(WinTimerInfo *t);
+ void unregisterTimer(WinTimerInfo *t, bool closingDown = false);
void sendTimerEvent(int timerId);
// socket notifiers
@@ -557,10 +557,10 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
qErrnoWarning("QEventDispatcherWin32::registerTimer: Failed to create a timer");
}
-void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t)
+void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t, bool closingDown)
{
// mark timer as unused
- if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent)
+ if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent && !closingDown)
QAbstractEventDispatcherPrivate::releaseTimerId(t->timerId);
if (t->interval == 0) {
@@ -1019,8 +1019,8 @@ void QEventDispatcherWin32::closingDown()
unregisterSocketNotifier((*(d->sn_except.begin()))->obj);
// clean up any timers
- while (!d->timerDict.isEmpty())
- unregisterTimer((*(d->timerDict.begin()))->timerId);
+ for (int i = 0; i < d->timerVec.count(); ++i)
+ d->unregisterTimer(d->timerVec.at(i), true);
}
bool QEventDispatcherWin32::event(QEvent *e)
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index cdcb0c4..eae3e63 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -4770,7 +4770,7 @@ void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(const QPointF &n
{
Q_ASSERT(inSetPosHelper);
- if (!(ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren))
+ if (inDestructor || !(ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren))
return; // Not clipped by any ancestor.
// Find closest clip ancestor and transform.
@@ -4780,15 +4780,19 @@ void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(const QPointF &n
if (transformData)
thisToParentTransform = transformData->computedFullTransform(&thisToParentTransform);
QGraphicsItem *clipParent = parent;
- while (clipParent && !(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)) {
+ while (clipParent && !clipParent->d_ptr->inDestructor && !(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)) {
thisToParentTransform *= clipParent->d_ptr->transformToParent();
clipParent = clipParent->d_ptr->parent;
}
- // thisToParentTransform is now the same as q->itemTransform(clipParent), except
- // that the new position (which is not yet set on the item) is taken into account.
- Q_ASSERT(clipParent);
- Q_ASSERT(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape);
+ // Ensure no parents are currently being deleted. This can only
+ // happen if the item is moved by a dying ancestor.
+ QGraphicsItem *p = clipParent;
+ while (p) {
+ if (p->d_ptr->inDestructor)
+ return;
+ p = p->d_ptr->parent;
+ }
// From here everything is calculated in clip parent's coordinates.
const QRectF parentBoundingRect(clipParent->boundingRect());
@@ -6850,6 +6854,8 @@ void QGraphicsItem::removeFromIndex()
*/
void QGraphicsItem::prepareGeometryChange()
{
+ if (d_ptr->inDestructor)
+ return;
if (d_ptr->scene) {
d_ptr->scene->d_func()->dirtyGrowingItemsBoundingRect = true;
d_ptr->geometryChanged = 1;
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index afabf49..d0f3b99 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -687,11 +687,13 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c
Q_D(const QGraphicsWidget);
QSizeF sh;
if (d->layout) {
- sh = d->layout->effectiveSizeHint(which, constraint);
+ QSizeF marginSize(0,0);
if (d->margins) {
- sh += QSizeF(d->margins[d->Left] + d->margins[d->Right],
+ marginSize = QSizeF(d->margins[d->Left] + d->margins[d->Right],
d->margins[d->Top] + d->margins[d->Bottom]);
}
+ sh = d->layout->effectiveSizeHint(which, constraint - marginSize);
+ sh += marginSize;
} else {
switch (which) {
case Qt::MinimumSize:
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index 787bbb1..bf826a9 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -393,49 +393,162 @@ void QGraphicsWidgetPrivate::windowFrameMousePressEvent(QGraphicsSceneMouseEvent
event->setAccepted(windowData->grabbedSection != Qt::NoSection);
}
+/*!
+ Used to calculate the
+ Precondition:
+ \a widget should support either hfw or wfh
+
+ If \a heightForWidth is set to false, this function will query the width for height
+ instead. \a width will then be interpreted as height, \a minh and \a maxh will be interpreted
+ as minimum width and maximum width.
+ */
+static qreal minimumHeightForWidth(qreal width, qreal minh, qreal maxh,
+ const QGraphicsWidget *widget,
+ bool heightForWidth = true)
+{
+ qreal minimumHeightForWidth = -1;
+ const QSizePolicy sp = widget->layout() ? widget->layout()->sizePolicy() : widget->sizePolicy();
+ const bool hasHFW = sp.hasHeightForWidth();
+ if (hasHFW == heightForWidth) {
+ minimumHeightForWidth = hasHFW
+ ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(width, -1)).height()
+ : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, width)).width(); //"width" is here height!
+ } else {
+ // widthForHeight
+ const qreal constraint = width;
+ while (maxh - minh > 0.1) {
+ qreal middle = minh + (maxh - minh)/2;
+ // ### really bad, if we are a widget with a layout it will call
+ // layout->effectiveSizeHint(Qt::MiniumumSize), which again will call
+ // sizeHint three times because of how the cache works
+ qreal hfw = hasHFW
+ ? widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(middle, -1)).height()
+ : widget->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, middle)).width();
+ if (hfw > constraint) {
+ minh = middle;
+ } else if (hfw <= constraint) {
+ maxh = middle;
+ }
+ }
+ minimumHeightForWidth = maxh;
+ }
+ return minimumHeightForWidth;
+}
+
+static qreal minimumWidthForHeight(qreal height, qreal minw, qreal maxw,
+ const QGraphicsWidget *widget)
+{
+ return minimumHeightForWidth(height, minw, maxw, widget, false);
+}
+
+static QSizeF closestAcceptableSize(const QSizeF &proposed,
+ const QGraphicsWidget *widget)
+{
+ const QSizeF current = widget->size();
+
+ qreal minw = proposed.width();
+ qreal maxw = current.width();
+ qreal minh = proposed.height();
+ qreal maxh = current.height();
+
+ qreal middlew = maxw;
+ qreal middleh = maxh;
+ qreal min_hfw;
+ min_hfw = minimumHeightForWidth(maxw, minh, maxh, widget);
+
+ do {
+ if (maxw - minw < 0.1) {
+ // we still havent found anything, cut off binary search
+ minw = maxw;
+ minh = maxh;
+ }
+ middlew = minw + (maxw - minw)/2.0;
+ middleh = minh + (maxh - minh)/2.0;
+
+ min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget);
+
+ if (min_hfw > middleh) {
+ minw = middlew;
+ minh = middleh;
+ } else if (min_hfw <= middleh) {
+ maxw = middlew;
+ maxh = middleh;
+ }
+ } while (maxw != minw);
+
+ min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget);
+
+ QSizeF result;
+ if (min_hfw < maxh) {
+ result = QSizeF(middlew, min_hfw);
+ } else {
+ // Needed because of the cut-off we do above.
+ result = QSizeF(minimumWidthForHeight(maxh, proposed.width(), current.width(), widget), maxh);
+ }
+ return result;
+}
+
static void _q_boundGeometryToSizeConstraints(const QRectF &startGeometry,
QRectF *rect, Qt::WindowFrameSection section,
- const QSizeF &min, const QSizeF &max)
+ const QSizeF &min, const QSizeF &max,
+ const QGraphicsWidget *widget)
{
- int height;
- int width;
+ const QRectF proposedRect = *rect;
+ qreal width = qBound(min.width(), proposedRect.width(), max.width());
+ qreal height = qBound(min.height(), proposedRect.height(), max.height());
+
+ QSizePolicy sp = widget->sizePolicy();
+ if (const QGraphicsLayout *l = widget->layout()) {
+ sp = l->sizePolicy();
+ }
+ const bool hasHFW = sp.hasHeightForWidth(); // || sp.hasWidthForHeight();
+
+ const bool widthChanged = proposedRect.width() < widget->size().width();
+ const bool heightChanged = proposedRect.height() < widget->size().height();
+
+ if (hasHFW) {
+ if (widthChanged || heightChanged) {
+ const qreal minh = min.height();
+ const qreal maxh = max.height();
+ const qreal proposedHFW = minimumHeightForWidth(width, minh, maxh, widget);
+ if (proposedHFW > proposedRect.height()) {
+ QSizeF effectiveSize = closestAcceptableSize(QSizeF(width, height), widget);
+ width = effectiveSize.width();
+ height = effectiveSize.height();
+ }
+ }
+ }
+
switch (section) {
case Qt::LeftSection:
- width = qRound(qBound(min.width(), rect->width(), max.width()));
- rect->setRect(startGeometry.right() - width, startGeometry.top(),
- width, startGeometry.height());
+ rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(),
+ qRound(width), startGeometry.height());
break;
case Qt::TopLeftSection:
- width = qRound(qBound(min.width(), rect->width(), max.width()));
- height = qRound(qBound(min.height(), rect->height(), max.height()));
- rect->setRect(startGeometry.right() - width, startGeometry.bottom() - height,
- width, height);
+ rect->setRect(startGeometry.right() - qRound(width), startGeometry.bottom() - qRound(height),
+ qRound(width), qRound(height));
break;
case Qt::TopSection:
- height = qRound(qBound(min.height(), rect->height(), max.height()));
- rect->setRect(startGeometry.left(), startGeometry.bottom() - height,
- startGeometry.width(), height);
+ rect->setRect(startGeometry.left(), startGeometry.bottom() - qRound(height),
+ startGeometry.width(), qRound(height));
break;
case Qt::TopRightSection:
- height = qRound(qBound(min.height(), rect->height(), max.height()));
- rect->setTop(rect->bottom() - height);
- rect->setWidth(qBound(min.width(), rect->width(), max.width()));
+ rect->setTop(rect->bottom() - qRound(height));
+ rect->setWidth(qRound(width));
break;
case Qt::RightSection:
- rect->setWidth(qBound(min.width(), rect->width(), max.width()));
+ rect->setWidth(qRound(width));
break;
case Qt::BottomRightSection:
- rect->setWidth(qBound(min.width(), rect->width(), max.width()));
- rect->setHeight(qBound(min.height(), rect->height(), max.height()));
+ rect->setWidth(qRound(width));
+ rect->setHeight(qRound(height));
break;
case Qt::BottomSection:
- rect->setHeight(qBound(min.height(), rect->height(), max.height()));
+ rect->setHeight(qRound(height));
break;
case Qt::BottomLeftSection:
- height = qRound(qBound(min.height(), rect->height(), max.height()));
- width = qRound(qBound(min.width(), rect->width(), max.width()));
- rect->setRect(startGeometry.right() - width, startGeometry.top(),
- width, height);
+ rect->setRect(startGeometry.right() - qRound(width), startGeometry.top(),
+ qRound(width), qRound(height));
break;
default:
break;
@@ -506,7 +619,8 @@ void QGraphicsWidgetPrivate::windowFrameMouseMoveEvent(QGraphicsSceneMouseEvent
_q_boundGeometryToSizeConstraints(windowData->startGeometry, &newGeometry,
windowData->grabbedSection,
q->effectiveSizeHint(Qt::MinimumSize),
- q->effectiveSizeHint(Qt::MaximumSize));
+ q->effectiveSizeHint(Qt::MaximumSize),
+ q);
q->setGeometry(newGeometry);
}
}
diff --git a/src/gui/kernel/qsizepolicy.h b/src/gui/kernel/qsizepolicy.h
index 4261dda..eb13788 100644
--- a/src/gui/kernel/qsizepolicy.h
+++ b/src/gui/kernel/qsizepolicy.h
@@ -64,6 +64,7 @@ private:
VMask = HMask << HSize,
CTShift = 9,
CTSize = 5,
+ WFHShift = CTShift + CTSize,
CTMask = ((0x1 << CTSize) - 1) << CTShift,
UnusedShift = CTShift + CTSize,
UnusedSize = 2
@@ -199,6 +200,17 @@ private:
QSizePolicy(int i) : data(i) { }
quint32 data;
+/* use bit flags instead, keep it here for improved readability for now
+ quint32 horzPolicy : 4;
+ quint32 vertPolicy : 4;
+ quint32 hfw : 1;
+ quint32 ctype : 5;
+ quint32 wfh : 1;
+ quint32 padding : 1; // we cannot use the highest bit
+ quint32 horStretch : 8;
+ quint32 verStretch : 8;
+*/
+
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp
index 04ddd7d..f9cb108 100644
--- a/src/gui/painting/qpaintbuffer.cpp
+++ b/src/gui/painting/qpaintbuffer.cpp
@@ -239,7 +239,7 @@ bool QPaintBuffer::isEmpty() const
-void QPaintBuffer::draw(QPainter *painter) const
+void QPaintBuffer::draw(QPainter *painter, int frame) const
{
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << "QPaintBuffer::draw() --------------------------------";
@@ -270,10 +270,10 @@ void QPaintBuffer::draw(QPainter *painter) const
? (QPaintEngineEx *) painter->paintEngine() : 0;
if (xengine) {
QPaintEngineExReplayer player;
- player.draw(*this, painter);
+ player.draw(*this, painter, frame);
} else {
QPainterReplayer player;
- player.draw(*this, painter);
+ player.draw(*this, painter, frame);
}
#ifdef QPAINTBUFFER_DEBUG_DRAW
@@ -1035,17 +1035,31 @@ void QPainterReplayer::setupTransform(QPainter *_painter)
painter->setTransform(m_world_matrix);
}
-void QPainterReplayer::draw(const QPaintBuffer &buffer, QPainter *_painter)
+void QPainterReplayer::draw(const QPaintBuffer &buffer, QPainter *_painter, int frame)
{
d = buffer.d_ptr;
setupTransform(_painter);
- for (int cmdIndex=0; cmdIndex<d->commands.size(); ++cmdIndex) {
+ int frameStart = (frame == 0) ? 0 : d->frames.at(frame-1);
+ int frameEnd = (frame == d->frames.size()) ? d->commands.size() : d->frames.at(frame);
+
+ for (int cmdIndex=frameStart; cmdIndex<frameEnd; ++cmdIndex) {
const QPaintBufferCommand &cmd = d->commands.at(cmdIndex);
process(cmd);
}
}
+void QPaintBuffer::beginNewFrame()
+{
+ if (!d_ptr->commands.isEmpty())
+ d_ptr->frames << d_ptr->commands.size();
+}
+
+int QPaintBuffer::numFrames() const
+{
+ return d_ptr->frames.size() + 1;
+}
+
void QPainterReplayer::process(const QPaintBufferCommand &cmd)
{
switch (cmd.id) {
@@ -1721,24 +1735,99 @@ QDataStream &operator>>(QDataStream &stream, QPaintBufferCommand &command)
return stream;
}
+struct QPaintBufferCacheEntry
+{
+ QVariant::Type type;
+ quint64 cacheKey;
+};
+
+QDataStream &operator<<(QDataStream &stream, const QPaintBufferCacheEntry &entry)
+{
+ return stream << entry.type << entry.cacheKey;
+}
+
+QDataStream &operator>>(QDataStream &stream, QPaintBufferCacheEntry &entry)
+{
+ return stream >> entry.type >> entry.cacheKey;
+}
+
+static int qRegisterPaintBufferMetaTypes()
+{
+ qRegisterMetaType<QPaintBufferCacheEntry>();
+ qRegisterMetaTypeStreamOperators<QPaintBufferCacheEntry>("QPaintBufferCacheEntry");
+
+ return 0; // something
+}
+
+Q_DECLARE_METATYPE(QPaintBufferCacheEntry);
+Q_CONSTRUCTOR_FUNCTION(qRegisterPaintBufferMetaTypes)
+
QDataStream &operator<<(QDataStream &stream, const QPaintBuffer &buffer)
{
+ QHash<qint64, QPixmap> pixmaps;
+ QHash<qint64, QImage> images;
+
+ QVector<QVariant> variants = buffer.d_ptr->variants;
+ for (int i = 0; i < variants.size(); ++i) {
+ const QVariant &v = variants.at(i);
+ if (v.type() == QVariant::Image) {
+ const QImage image(v.value<QImage>());
+ images[image.cacheKey()] = image;
+
+ QPaintBufferCacheEntry entry;
+ entry.type = QVariant::Image;
+ entry.cacheKey = image.cacheKey();
+ variants[i] = QVariant::fromValue(entry);
+ } else if (v.type() == QVariant::Pixmap) {
+ const QPixmap pixmap(v.value<QPixmap>());
+ pixmaps[pixmap.cacheKey()] = pixmap;
+
+ QPaintBufferCacheEntry entry;
+ entry.type = QVariant::Pixmap;
+ entry.cacheKey = pixmap.cacheKey();
+ variants[i] = QVariant::fromValue(entry);
+ }
+ }
+
+ stream << pixmaps;
+ stream << images;
+
stream << buffer.d_ptr->ints;
stream << buffer.d_ptr->floats;
- stream << buffer.d_ptr->variants;
+ stream << variants;
stream << buffer.d_ptr->commands;
stream << buffer.d_ptr->boundingRect;
+ stream << buffer.d_ptr->frames;
return stream;
}
QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer)
{
+ QHash<qint64, QPixmap> pixmaps;
+ QHash<qint64, QImage> images;
+
+ stream >> pixmaps;
+ stream >> images;
+
stream >> buffer.d_ptr->ints;
stream >> buffer.d_ptr->floats;
stream >> buffer.d_ptr->variants;
stream >> buffer.d_ptr->commands;
stream >> buffer.d_ptr->boundingRect;
+ stream >> buffer.d_ptr->frames;
+
+ QVector<QVariant> &variants = buffer.d_ptr->variants;
+ for (int i = 0; i < variants.size(); ++i) {
+ const QVariant &v = variants.at(i);
+ if (v.canConvert<QPaintBufferCacheEntry>()) {
+ QPaintBufferCacheEntry entry = v.value<QPaintBufferCacheEntry>();
+ if (entry.type == QVariant::Image)
+ variants[i] = QVariant(images.value(entry.cacheKey));
+ else
+ variants[i] = QVariant(pixmaps.value(entry.cacheKey));
+ }
+ }
return stream;
}
diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h
index b360279..2cb1d7c 100644
--- a/src/gui/painting/qpaintbuffer_p.h
+++ b/src/gui/painting/qpaintbuffer_p.h
@@ -71,7 +71,10 @@ public:
bool isEmpty() const;
- void draw(QPainter *painter) const;
+ void beginNewFrame();
+ int numFrames() const;
+
+ void draw(QPainter *painter, int frame = 0) const;
void setBoundingRect(const QRectF &rect);
QRectF boundingRect() const;
@@ -270,6 +273,7 @@ public:
QVector<QVariant> variants;
QVector<QPaintBufferCommand> commands;
+ QList<int> frames;
QPaintBufferEngine *engine;
QRectF boundingRect;
@@ -306,7 +310,7 @@ public:
void setupTransform(QPainter *painter);
void process(const QPaintBufferCommand &cmd);
- void draw(const QPaintBuffer &buffer, QPainter *painter);
+ void draw(const QPaintBuffer &buffer, QPainter *painter, int frame);
protected:
QPaintBufferPrivate *d;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index a6bea76..263e53e 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -7545,10 +7545,9 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
if (!painter)
tf |= Qt::TextDontPrint;
- int maxUnderlines = 0;
+ uint maxUnderlines = 0;
int numUnderlines = 0;
- int underlinePositionStack[32];
- int *underlinePositions = underlinePositionStack;
+ QVarLengthArray<int, 32> underlinePositions(1);
QFontMetricsF fm(fnt);
QString text = str;
@@ -7557,54 +7556,46 @@ start_lengthVariant:
bool hasMoreLengthVariants = false;
// compatible behaviour to the old implementation. Replace
// tabs by spaces
- QChar *chr = text.data() + offset;
- QChar *end = text.data() + text.length();
bool has_tab = false;
- while (chr != end) {
- if (*chr == QLatin1Char('\r') || (singleline && *chr == QLatin1Char('\n'))) {
- *chr = QLatin1Char(' ');
- } else if (*chr == QLatin1Char('\n')) {
- *chr = QChar::LineSeparator;
- } else if (*chr == QLatin1Char('&')) {
+ int old_offset = offset;
+ for (; offset < text.length(); offset++) {
+ QChar chr = text.at(offset);
+ if (chr == QLatin1Char('\r') || (singleline && chr == QLatin1Char('\n'))) {
+ text[offset] = QLatin1Char(' ');
+ } else if (chr == QLatin1Char('\n')) {
+ text[offset] = QChar::LineSeparator;
+ } else if (chr == QLatin1Char('&')) {
++maxUnderlines;
- } else if (*chr == QLatin1Char('\t')) {
+ } else if (chr == QLatin1Char('\t')) {
+ if (!expandtabs) {
+ text[offset] = QLatin1Char(' ');
+ } else if (!tabarraylen && !tabstops) {
+ tabstops = qRound(fm.width(QLatin1Char('x'))*8);
+ }
has_tab = true;
- } else if (*chr == QChar(ushort(0x9c))) {
+ } else if (chr == QChar(ushort(0x9c))) {
// string with multiple length variants
- end = chr;
hasMoreLengthVariants = true;
break;
}
- ++chr;
- }
- if (has_tab) {
- if (!expandtabs) {
- chr = text.data() + offset;
- while (chr != end) {
- if (*chr == QLatin1Char('\t'))
- *chr = QLatin1Char(' ');
- ++chr;
- }
- } else if (!tabarraylen && !tabstops) {
- tabstops = qRound(fm.width(QLatin1Char('x'))*8);
- }
}
- QChar *cout = end;
- if (hidemnmemonic || showmnemonic) {
- if (maxUnderlines > 32)
- underlinePositions = new int[maxUnderlines];
- cout = text.data() + offset;
+ int length = offset - old_offset;
+ if ((hidemnmemonic || showmnemonic) && maxUnderlines > 0) {
+ underlinePositions.resize(maxUnderlines + 1);
+
+ QChar *cout = text.data() + old_offset;
QChar *cin = cout;
- int l = end - cout;
+ int l = length;
while (l) {
if (*cin == QLatin1Char('&')) {
++cin;
+ --length;
--l;
if (!l)
break;
if (*cin != QLatin1Char('&') && !hidemnmemonic)
- underlinePositions[numUnderlines++] = cout - text.unicode();
+ underlinePositions[numUnderlines++] = cout - text.data() - old_offset;
}
*cout = *cin;
++cout;
@@ -7621,7 +7612,7 @@ start_lengthVariant:
qreal height = 0;
qreal width = 0;
- QString finalText = text.mid(offset, cout - (text.data() + offset));
+ QString finalText = text.mid(old_offset, length);
QStackTextEngine engine(finalText, fnt);
if (option) {
engine.option = *option;
@@ -7640,7 +7631,7 @@ start_lengthVariant:
engine.forceJustification = true;
QTextLayout textLayout(&engine);
textLayout.setCacheEnabled(true);
- textLayout.engine()->underlinePositions = underlinePositions;
+ textLayout.engine()->underlinePositions = underlinePositions.data();
if (finalText.isEmpty()) {
height = fm.height();
@@ -7709,7 +7700,7 @@ start_lengthVariant:
QRectF bounds = QRectF(r.x() + xoff, r.y() + yoff, width, height);
if (hasMoreLengthVariants && !(tf & Qt::TextLongestVariant) && !r.contains(bounds)) {
- offset = end - text.data() + 1;
+ offset++;
goto start_lengthVariant;
}
if (brect)
@@ -7738,9 +7729,6 @@ start_lengthVariant:
painter->restore();
}
}
-
- if (underlinePositions != underlinePositionStack)
- delete [] underlinePositions;
}
/*!
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 1bdaceb..e565d0a 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2521,13 +2521,15 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
default: html += QLatin1String("<ul"); // ### should not happen
}
+ html += QLatin1String(" style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;");
+
if (format.hasProperty(QTextFormat::ListIndent)) {
- html += QLatin1String(" style=\"-qt-list-indent: ");
+ html += QLatin1String(" -qt-list-indent: ");
html += QString::number(format.indent());
- html += QLatin1String(";\"");
+ html += QLatin1Char(';');
}
- html += QLatin1Char('>');
+ html += QLatin1String("\">");
}
html += QLatin1String("<li");
diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp
index 36a8df1..bbb6536 100644
--- a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp
+++ b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp
@@ -57,30 +57,35 @@ public:
~QTraceWindowSurface();
QPaintDevice *paintDevice();
+ void beginPaint(const QRegion &rgn);
void endPaint(const QRegion &rgn);
+ bool scroll(const QRegion &area, int dx, int dy);
+
private:
QPaintBuffer *buffer;
+ QList<QRegion> updates;
- QFile *outputFile;
- QDataStream *out;
-
- int frameId;
+ qulonglong winId;
};
QTraceWindowSurface::QTraceWindowSurface(QWidget *widget)
: QRasterWindowSurface(widget)
, buffer(0)
- , outputFile(0)
- , out(0)
- , frameId(0)
+ , winId(0)
{
}
QTraceWindowSurface::~QTraceWindowSurface()
{
- delete out;
- delete outputFile;
+ if (buffer) {
+ QFile outputFile(QString(QLatin1String("qtgraphics-%0.trace")).arg(winId));
+ if (outputFile.open(QIODevice::WriteOnly)) {
+ QDataStream out(&outputFile);
+ out << *buffer << updates;
+ }
+ delete buffer;
+ }
}
QPaintDevice *QTraceWindowSurface::paintDevice()
@@ -92,28 +97,33 @@ QPaintDevice *QTraceWindowSurface::paintDevice()
return buffer;
}
-void QTraceWindowSurface::endPaint(const QRegion &rgn)
+void QTraceWindowSurface::beginPaint(const QRegion &rgn)
{
- if (!out) {
- outputFile = new QFile(QString(QLatin1String("qtgraphics-%0.trace")).arg((qulonglong)window()->winId()));
- if (outputFile->open(QIODevice::WriteOnly))
- out = new QDataStream(outputFile);
- }
+ // ensure paint buffer is created
+ paintDevice();
+ buffer->beginNewFrame();
+
+ QRasterWindowSurface::beginPaint(rgn);
+}
+void QTraceWindowSurface::endPaint(const QRegion &rgn)
+{
QPainter p(QRasterWindowSurface::paintDevice());
- buffer->draw(&p);
+ buffer->draw(&p, buffer->numFrames()-1);
p.end();
- if (out) {
- *out << frameId++;
- *out << (qulonglong)window()->winId();
- *out << geometry();
- *out << rgn;
- *out << *buffer;
- }
+ winId = (qulonglong)window()->winId();
+
+ updates << rgn;
- delete buffer;
- buffer = 0;
+ QRasterWindowSurface::endPaint(rgn);
+}
+
+bool QTraceWindowSurface::scroll(const QRegion &, int, int)
+{
+ // TODO: scrolling should also be streamed and replayed
+ // to test scrolling performance
+ return false;
}
QTraceGraphicsSystem::QTraceGraphicsSystem()
diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt
index 1a6cfeb..72ec3c5 100644
--- a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt
+++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt
@@ -1,8 +1,8 @@
-.*/lupdate/testdata/good/lacksqobject/main.cpp:17: Class 'B' lacks Q_OBJECT macro
+.*/lupdate/testdata/good/lacksqobject/main.cpp:58: Class 'B' lacks Q_OBJECT macro
-.*/lupdate/testdata/good/lacksqobject/main.cpp:24: Class 'C' lacks Q_OBJECT macro
+.*/lupdate/testdata/good/lacksqobject/main.cpp:65: Class 'C' lacks Q_OBJECT macro
-.*/lupdate/testdata/good/lacksqobject/main.cpp:37: Class 'nsB::B' lacks Q_OBJECT macro
+.*/lupdate/testdata/good/lacksqobject/main.cpp:78: Class 'nsB::B' lacks Q_OBJECT macro
-.*/lupdate/testdata/good/lacksqobject/main.cpp:43: Class 'nsB::C' lacks Q_OBJECT macro
+.*/lupdate/testdata/good/lacksqobject/main.cpp:84: Class 'nsB::C' lacks Q_OBJECT macro
diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp
index e1fca6e..0f7f9fb 100644
--- a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp
@@ -1,3 +1,4 @@
+
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result
index de2c45a..b328e90 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result
@@ -4,22 +4,22 @@
<context>
<name>FindDialog</name>
<message>
- <location filename="finddialog.cpp" line="19"/>
+ <location filename="finddialog.cpp" line="85"/>
<source>Enter the text you want to find.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="29"/>
+ <location filename="finddialog.cpp" line="135"/>
<source>Search reached end of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="31"/>
+ <location filename="finddialog.cpp" line="137"/>
<source>Search reached start of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="33"/>
+ <location filename="finddialog.cpp" line="139"/>
<source>Text not found</source>
<translation type="unfinished"></translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result
index 4012182..cfd11b1 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result
@@ -8,22 +8,22 @@
<translation type="obsolete">Skriv inn teksten du soker etter</translation>
</message>
<message>
- <location filename="finddialog.cpp" line="18"/>
+ <location filename="finddialog.cpp" line="88"/>
<source>Enter the text you want to find.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="28"/>
+ <location filename="finddialog.cpp" line="138"/>
<source>Search reached end of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="30"/>
+ <location filename="finddialog.cpp" line="140"/>
<source>Search reached start of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="finddialog.cpp" line="32"/>
+ <location filename="finddialog.cpp" line="142"/>
<source>Text not found</source>
<translation type="unfinished"></translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result
index 4c5f74d..1a2244b 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result
@@ -4,18 +4,18 @@
<context>
<name>FindDialog</name>
<message>
- <location filename="project.ui" line="15"/>
+ <location filename="project.ui" line="57"/>
<source>Qt Assistant - Find Text</source>
<oldsource>Qt Assistant - Find text</oldsource>
<translation type="unfinished">Qt Assistant - Finn tekst</translation>
</message>
<message>
- <location filename="project.ui" line="18"/>
+ <location filename="project.ui" line="60"/>
<source>300px</source>
<translation>300px</translation>
</message>
<message>
- <location filename="project.ui" line="21"/>
+ <location filename="project.ui" line="63"/>
<source>401 pixels</source>
<translation type="unfinished"></translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui
index d022101..1d8a716 100644
--- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui
+++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui
@@ -1,6 +1,7 @@
<ui version="4.0" >
<author></author>
- <comment>*********************************************************************
+ <comment>
+*********************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,7 +40,8 @@
**
** $QT_END_LICENSE$
**
-*********************************************************************</comment>
+*********************************************************************
+</comment>
<exportmacro></exportmacro>
<class>FindDialog</class>
<widget class="QWidget" name="FindDialog" >
diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result
index ec1f02f..a7ae155 100644
--- a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result
@@ -4,9 +4,9 @@
<context>
<name>context</name>
<message>
- <location filename="finddialog.cpp" line="43"/>
- <location filename="finddialog.cpp" line="48"/>
- <location filename="main.cpp" line="47"/>
+ <location filename="finddialog.cpp" line="42"/>
+ <location filename="finddialog.cpp" line="47"/>
+ <location filename="main.cpp" line="46"/>
<source>just a message</source>
<extracomment>This is one comment
----------
diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result
index bb5b739..c1a34bd 100644
--- a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result
@@ -30,7 +30,7 @@
<context>
<name>Outer::Middle1::Different</name>
<message>
- <location filename="main.cpp" line="106/>
+ <location filename="main.cpp" line="106"/>
<source>different namespaced class def</source>
<translation type="unfinished"></translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
index 9e4e319..d63c7c3 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -4,14 +4,14 @@
<context>
<name></name>
<message id="this_a_id">
- <location filename="main.cpp" line="185"/>
+ <location filename="main.cpp" line="226"/>
<source>This is supposed to be quoted &quot; newline
backslashed \ stuff.</source>
<extracomment>again an extra comment, this time for id-based NOOP</extracomment>
<translation type="unfinished"></translation>
</message>
<message id="this_another_id" numerus="yes">
- <location filename="main.cpp" line="189"/>
+ <location filename="main.cpp" line="230"/>
<source>This needs to be here. Really.</source>
<translation type="unfinished">
<numerusform></numerusform>
@@ -259,7 +259,7 @@ backslashed \ stuff.</source>
<context>
<name>TestingTake17</name>
<message id="this_is_an_id">
- <location filename="main.cpp" line="170"/>
+ <location filename="main.cpp" line="211"/>
<source>something cool</source>
<extracomment>random comment</extracomment>
<translation type="unfinished"></translation>
@@ -267,12 +267,12 @@ backslashed \ stuff.</source>
<extra-loc-layout_id>fooish_bar</extra-loc-layout_id>
</message>
<message>
- <location filename="main.cpp" line="172"/>
+ <location filename="main.cpp" line="213"/>
<source>less cool</source>
<translation type="unfinished"></translation>
</message>
<message id="another_id">
- <location filename="main.cpp" line="175"/>
+ <location filename="main.cpp" line="216"/>
<source>even more cool</source>
<translation type="unfinished"></translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt
index e3f7926..8d057d8 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt
@@ -1,7 +1,7 @@
-.*/lupdate/testdata/good/parsecpp2/main.cpp:10: Excess closing brace .*
+.*/lupdate/testdata/good/parsecpp2/main.cpp:51: Excess closing brace .*
-.*/lupdate/testdata/good/parsecpp2/main.cpp:14: Excess closing brace .*
+.*/lupdate/testdata/good/parsecpp2/main.cpp:55: Excess closing brace .*
-.*/lupdate/testdata/good/parsecpp2/main.cpp:20: Excess closing brace .*
+.*/lupdate/testdata/good/parsecpp2/main.cpp:61: Excess closing brace .*
-.*/lupdate/testdata/good/parsecpp2/main.cpp:24: Excess closing brace .*
+.*/lupdate/testdata/good/parsecpp2/main.cpp:65: Excess closing brace .*
diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result
index 7f665f4..93adae4 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result
@@ -4,12 +4,12 @@
<context>
<name>FindDialog</name>
<message>
- <location filename="project.ui" line="15"/>
+ <location filename="project.ui" line="48"/>
<source>Qt Assistant - Finn text</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
- <location filename="project.ui" line="18"/>
+ <location filename="project.ui" line="51"/>
<source>Finn tekst - Der Bjørn möchte auch mal.</source>
<translation type="unfinished"></translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result
index c15b986..e356921 100644
--- a/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result
@@ -4,18 +4,18 @@
<context>
<name>Foo</name>
<message>
- <location filename="main.cpp" line="46"/>
+ <location filename="main.cpp" line="45"/>
<source>XXX</source>
<comment>YYY</comment>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="51"/>
+ <location filename="main.cpp" line="50"/>
<source>CTOR</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="main.cpp" line="56"/>
+ <location filename="main.cpp" line="55"/>
<source>BAR</source>
<translation type="unfinished"></translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result
index b86edae..5c3c21c 100644
--- a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result
@@ -4,22 +4,22 @@
<context>
<name>FindDialog</name>
<message>
- <location filename="sub/finddialog.cpp" line="85"/>
+ <location filename="sub/finddialog.cpp" line="57"/>
<source>Enter the text you want to find.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sub/finddialog.cpp" line="135"/>
+ <location filename="sub/finddialog.cpp" line="66"/>
<source>Search reached end of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sub/finddialog.cpp" line="137"/>
+ <location filename="sub/finddialog.cpp" line="68"/>
<source>Search reached start of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sub/finddialog.cpp" line="139"/>
+ <location filename="sub/finddialog.cpp" line="70"/>
<source>Text not found</source>
<translation type="unfinished"></translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result
index 835b3e0..95a34fa 100644
--- a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result
@@ -4,32 +4,32 @@
<context>
<name>FindDialog</name>
<message>
- <location filename="project.ui" line="55"/>
+ <location filename="project.ui" line="57"/>
<source>Qt Assistant - Finn text</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="project.ui" line="58"/>
+ <location filename="project.ui" line="60"/>
<source>Finn tekst</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sub/finddialog.cpp" line="85"/>
+ <location filename="sub/finddialog.cpp" line="57"/>
<source>Enter the text you want to find.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sub/finddialog.cpp" line="135"/>
+ <location filename="sub/finddialog.cpp" line="66"/>
<source>Search reached end of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sub/finddialog.cpp" line="137"/>
+ <location filename="sub/finddialog.cpp" line="68"/>
<source>Search reached start of the document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sub/finddialog.cpp" line="139"/>
+ <location filename="sub/finddialog.cpp" line="70"/>
<source>Text not found</source>
<translation type="unfinished"></translation>
</message>
diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui
index 709b3e8..d25001f 100644
--- a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui
+++ b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui
@@ -1,6 +1,7 @@
<ui version="4.0" >
<author></author>
-<comment>*********************************************************************
+<comment>
+*********************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -39,7 +40,8 @@
**
** $QT_END_LICENSE$
**
-*********************************************************************</comment>
+*********************************************************************
+</comment>
<exportmacro></exportmacro>
<class>FindDialog</class>
<widget class="QWidget" name="FindDialog" >
diff --git a/tests/auto/qfiledialog/qfiledialog.pro b/tests/auto/qfiledialog/qfiledialog.pro
index bea7716..058acc5 100644
--- a/tests/auto/qfiledialog/qfiledialog.pro
+++ b/tests/auto/qfiledialog/qfiledialog.pro
@@ -16,3 +16,12 @@ wince*|symbian: {
symbian:TARGET.EPOCHEAPSIZE="0x100 0x1000000"
symbian:HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h
+
+wince*: {
+ DEFINES += SRCDIR=\\\"./\\\"
+} symbian: {
+ TARGET.UID3 = 0xE0340003
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index 161efe0..67be797 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -297,7 +297,8 @@ void tst_QFiledialog::filesSelectedSignal()
QNonNativeFileDialog fd;
fd.setViewMode(QFileDialog::List);
fd.setOptions(QFileDialog::DontUseNativeDialog);
- fd.setDirectory(QDir::homePath());
+ QDir testDir(SRCDIR"/../../..");
+ fd.setDirectory(testDir);
QFETCH(QFileDialog::FileMode, fileMode);
fd.setFileMode(fileMode);
QSignalSpy spyFilesSelected(&fd, SIGNAL(filesSelected(const QStringList &)));
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 408decc..77c2d45 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -292,6 +292,7 @@ private slots:
void activate();
void setActivePanelOnInactiveScene();
void activationOnShowHide();
+ void moveWhileDeleting();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -8103,5 +8104,64 @@ void tst_QGraphicsItem::activationOnShowHide()
QVERIFY(otherItem->isActive());
}
+class MoveWhileDying : public QGraphicsRectItem
+{
+public:
+ MoveWhileDying(QGraphicsItem *parent = 0)
+ : QGraphicsRectItem(parent)
+ { }
+ ~MoveWhileDying()
+ {
+ foreach (QGraphicsItem *c, childItems()) {
+ foreach (QGraphicsItem *cc, c->childItems()) {
+ cc->moveBy(10, 10);
+ }
+ c->moveBy(10, 10);
+ }
+ if (QGraphicsItem *p = parentItem()) { p->moveBy(10, 10); }
+ }
+};
+
+void tst_QGraphicsItem::moveWhileDeleting()
+{
+ QGraphicsScene scene;
+ QGraphicsRectItem *rect = new QGraphicsRectItem;
+ MoveWhileDying *silly = new MoveWhileDying(rect);
+ QGraphicsRectItem *child = new QGraphicsRectItem(silly);
+ scene.addItem(rect);
+ delete rect; // don't crash!
+
+ rect = new QGraphicsRectItem;
+ silly = new MoveWhileDying(rect);
+ child = new QGraphicsRectItem(silly);
+
+ QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(125);
+
+ delete rect;
+
+ rect = new QGraphicsRectItem;
+ rect->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
+ silly = new MoveWhileDying(rect);
+ child = new QGraphicsRectItem(silly);
+
+ QTest::qWait(125);
+
+ delete rect;
+
+ rect = new MoveWhileDying;
+ rect->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
+ child = new QGraphicsRectItem(rect);
+ silly = new MoveWhileDying(child);
+
+ QTest::qWait(125);
+
+ delete rect;
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 03054f9..d1193bd 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -157,6 +157,7 @@ private slots:
void shortcutsDeletion();
void painterStateProtectionOnWindowFrame();
void ensureClipping();
+ void respectHFW();
// Task fixes
void task236127_bspTreeIndexFails();
@@ -2543,6 +2544,84 @@ void tst_QGraphicsWidget::ensureClipping()
QVERIFY(scene.drawnItems.contains(childitem));
}
+class HFWWidget : public QGraphicsWidget
+{
+public:
+ HFWWidget() : QGraphicsWidget(0, Qt::Window)
+ {
+ QSizePolicy sp;
+ sp.setHeightForWidth(true);
+ setSizePolicy(sp);
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+ {
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ qreal w = rect().width();
+ QRectF box(0, 0, w, 2400/w);
+ painter->drawRoundRect(box);
+ painter->drawLine(box.topLeft(), box.bottomRight());
+ painter->drawLine(box.bottomLeft(), box.topRight());
+ }
+
+protected:
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
+ {
+ qreal w = constraint.width();
+ switch (which) {
+ case Qt::MinimumSize:
+ if (w >= 0 && constraint.height() < 0) {
+ // keep the same area of 60x40 = 2400
+ return QSizeF(w, 2400.0/w);
+ } else {
+ return QSizeF(10, 10);
+ }
+ break;
+ case Qt::PreferredSize:
+ return QSizeF(48.989794, 48.989794);
+ default:
+ break;
+ }
+ return QGraphicsWidget::sizeHint(which, constraint);
+ }
+};
+
+void tst_QGraphicsWidget::respectHFW()
+{
+ QGraphicsScene scene;
+ HFWWidget *window = new HFWWidget;
+ scene.addItem(window);
+ QGraphicsView *view = new QGraphicsView(&scene);
+ view->resize(400, 400);
+ view->setSceneRect(-100, -100, 300,300);
+
+ view->show();
+ window->setGeometry(0, 0, 70, 70);
+
+ { // here we go - simulate a interactive resize of the window
+ QTest::qWait(200);
+ QTest::mouseMove(view, view->mapFromScene(71, 71)); // bottom right corner
+ QTest::qWait(200);
+
+ QTest::mousePress(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(71, 71), 200);
+ view->grabMouse();
+ // move both mouse cursor and set correct event in order to emulate resize
+ QTest::mouseMove(view->viewport(), view->mapFromScene(60, 30), 200);
+ QMouseEvent e = QMouseEvent(QEvent::MouseMove,
+ view->mapFromScene(60, 20),
+ Qt::NoButton,
+ Qt::LeftButton,
+ Qt::NoModifier);
+ QApplication::sendEvent(view->viewport(), &e);
+ view->releaseMouse();
+ }
+ QTest::qWait(200);
+ const QSizeF winSize = window->size();
+ qreal minHFW = window->effectiveSizeHint(Qt::MinimumSize, QSizeF(winSize.width(), -1)).height();
+ QVERIFY(qAbs(minHFW - winSize.height()) < 1);
+}
+
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index 1835373..34b6f14 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -1128,7 +1128,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("lists") << QTextDocumentFragment(&doc)
<<
QString("EMPTYBLOCK") +
- QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li DEFAULTBLOCKSTYLE>Blah</li></ul>");
+ QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li DEFAULTBLOCKSTYLE>Blah</li></ul>");
}
{
@@ -1151,7 +1151,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("charfmt-for-list-item") << QTextDocumentFragment(&doc)
<<
QString("EMPTYBLOCK") +
- QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li style=\" color:#0000ff;\" DEFAULTBLOCKSTYLE><span style=\" color:#ff0000;\">Blah</span></li></ul>");
+ QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li style=\" color:#0000ff;\" DEFAULTBLOCKSTYLE><span style=\" color:#ff0000;\">Blah</span></li></ul>");
}
{
@@ -1181,7 +1181,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("list-indent") << QTextDocumentFragment(&doc)
<<
QString("EMPTYBLOCK") +
- QString("<ul style=\"-qt-list-indent: 4;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>");
+ QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 4;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>");
}
{
@@ -1445,6 +1445,21 @@ void tst_QTextDocument::toHtml_data()
"\n<p OPENDEFAULTBLOCKSTYLE page-break-before:always; page-break-after:always;\">Bar</p>"
"\n<table border=\"1\" style=\" page-break-after:always;\" cellspacing=\"2\">\n<tr>\n<td></td></tr></table>");
}
+
+ {
+ CREATE_DOC_AND_CURSOR();
+
+ QTextListFormat listFmt;
+ listFmt.setStyle(QTextListFormat::ListDisc);
+
+ cursor.insertList(listFmt);
+ cursor.insertText("Blah");
+
+ QTest::newRow("list-ul-margin") << QTextDocumentFragment(&doc)
+ << QString("EMPTYBLOCK") +
+ QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>");
+
+ }
}
void tst_QTextDocument::toHtml()
diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp
index 57502c7..36fce76 100644
--- a/tests/auto/qtimer/tst_qtimer.cpp
+++ b/tests/auto/qtimer/tst_qtimer.cpp
@@ -87,6 +87,7 @@ private slots:
void restartedTimerFiresTooSoon();
void timerFiresOnlyOncePerProcessEvents_data();
void timerFiresOnlyOncePerProcessEvents();
+ void timerIdPersistsAfterThreadExit();
};
class TimerHelper : public QObject
@@ -562,5 +563,44 @@ void tst_QTimer::timerFiresOnlyOncePerProcessEvents()
QCOMPARE(longSlot.count, 1);
}
+class TimerIdPersistsAfterThreadExitThread : public QThread
+{
+public:
+ QTimer *timer;
+ int timerId, returnValue;
+
+ TimerIdPersistsAfterThreadExitThread()
+ : QThread(), timer(0), timerId(-1), returnValue(-1)
+ { }
+ ~TimerIdPersistsAfterThreadExitThread()
+ {
+ delete timer;
+ }
+
+ void run()
+ {
+ QEventLoop eventLoop;
+ timer = new QTimer;
+ connect(timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
+ timer->start(100);
+ timerId = timer->timerId();
+ returnValue = eventLoop.exec();
+ }
+};
+
+void tst_QTimer::timerIdPersistsAfterThreadExit()
+{
+ TimerIdPersistsAfterThreadExitThread thread;
+ thread.start();
+ QVERIFY(thread.wait(30000));
+ QCOMPARE(thread.returnValue, 0);
+
+ // even though the thread has exited, and the event dispatcher destroyed, the timer is still
+ // "active", meaning the timer id should NOT be reused (i.e. the event dispatcher should not
+ // have unregistered it)
+ int timerId = thread.startTimer(100);
+ QVERIFY((timerId & 0xffffff) != (thread.timerId & 0xffffff));
+}
+
QTEST_MAIN(tst_QTimer)
#include "tst_qtimer.moc"
diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.cpp b/tests/manual/qtabletevent/device_information/tabletwidget.cpp
index 15a3d80..684f2a5 100644
--- a/tests/manual/qtabletevent/device_information/tabletwidget.cpp
+++ b/tests/manual/qtabletevent/device_information/tabletwidget.cpp
@@ -47,6 +47,7 @@ TabletWidget::TabletWidget()
{
QPalette newPalette = palette();
newPalette.setColor(QPalette::Window, Qt::white);
+ newPalette.setColor(QPalette::WindowText, Qt::black);
setPalette(newPalette);
qApp->installEventFilter(this);
resetAttributes();
diff --git a/tools/qttracereplay/main.cpp b/tools/qttracereplay/main.cpp
index 970531b..34508e2 100644
--- a/tools/qttracereplay/main.cpp
+++ b/tools/qttracereplay/main.cpp
@@ -45,12 +45,6 @@
#include <private/qpaintengineex_p.h>
#include <private/qpaintbuffer_p.h>
-struct Frame
-{
- QRegion updateRegion;
- QPaintBuffer *buffer;
-};
-
class ReplayWidget : public QWidget
{
Q_OBJECT
@@ -63,7 +57,9 @@ public slots:
void updateRect();
private:
- QList<Frame> frames;
+ QList<QRegion> updates;
+ QPaintBuffer buffer;
+
int currentFrame;
int currentIteration;
QTime timer;
@@ -74,7 +70,7 @@ private:
void ReplayWidget::updateRect()
{
- update(frames.at(currentFrame).updateRegion);
+ update(updates.at(currentFrame));
}
void ReplayWidget::paintEvent(QPaintEvent *)
@@ -83,10 +79,10 @@ void ReplayWidget::paintEvent(QPaintEvent *)
// p.setClipRegion(frames.at(currentFrame).updateRegion);
- frames.at(currentFrame).buffer->draw(&p);
+ buffer.draw(&p, currentFrame);
++currentFrame;
- if (currentFrame >= frames.size()) {
+ if (currentFrame >= buffer.numFrames()) {
currentFrame = 0;
++currentIteration;
@@ -116,15 +112,13 @@ void ReplayWidget::paintEvent(QPaintEvent *)
stddev = qSqrt(stddev / iterationTimes.size());
qSort(iterationTimes.begin(), iterationTimes.end());
- qreal median = iterationTimes.at(iterationTimes.size() / 2);
- if ((iterationTimes.size() % 1) == 1)
- median = (median + iterationTimes.at(iterationTimes.size() / 2 - 1)) * 0.5;
+ uint median = iterationTimes.at(iterationTimes.size() / 2);
stddev = 100 * stddev / mean;
if (iterationTimes.size() >= 10 || stddev < 4) {
- printf("%s, iterations: %d, frames: %d, min(ms): %d, median(ms): %f, stddev: %f %%, max(fps): %f\n", qPrintable(filename),
- iterationTimes.size(), frames.size(), min, median, stddev, 1000. * frames.size() / min);
+ printf("%s, iterations: %d, frames: %d, min(ms): %d, median(ms): %d, stddev: %f %%, max(fps): %f\n", qPrintable(filename),
+ iterationTimes.size(), updates.size(), min, median, stddev, 1000. * updates.size() / min);
deleteLater();
return;
}
@@ -146,34 +140,12 @@ ReplayWidget::ReplayWidget(const QString &filename_)
QRect bounds;
if (file.open(QIODevice::ReadOnly)) {
QDataStream in(&file);
-
- while (true) {
- int frameId;
- in >> frameId;
-
- if (in.status() != QDataStream::Ok)
- break;
-
- qulonglong windowId;
- QRegion rgn;
-
- in >> windowId;
-
- Frame frame;
- frame.buffer = new QPaintBuffer;
-
- in >> bounds;
-
- in >> frame.updateRegion;
- in >> *frame.buffer;
-
- frames << frame;
- }
+ in >> buffer >> updates;
}
- qDebug() << "Read" << frames.size() << "frames";
+ qDebug() << "Read paint buffer with" << buffer.numFrames() << "frames";
- resize(bounds.size());
+ resize(buffer.boundingRect().size().toSize());
setAutoFillBackground(false);
setAttribute(Qt::WA_NoSystemBackground);