summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/snippets/code/doc_src_stylesheet.qdoc5
-rw-r--r--doc/src/widgets-and-layouts/stylesheet.qdoc3
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp16
-rw-r--r--src/corelib/tools/qbytearray.cpp54
-rw-r--r--src/corelib/tools/qbytearray.h1
-rw-r--r--src/gui/text/qfontengine_qws.cpp6
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp4
-rw-r--r--src/plugins/graphicssystems/opengl/main.cpp10
-rw-r--r--src/s60main/qts60main.cpp1
-rw-r--r--src/s60main/qts60main_mcrt0.cpp2
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp16
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp7
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp5
-rw-r--r--tests/auto/qtwidgets/tst_qtwidgets.cpp3
14 files changed, 100 insertions, 33 deletions
diff --git a/doc/src/snippets/code/doc_src_stylesheet.qdoc b/doc/src/snippets/code/doc_src_stylesheet.qdoc
index f79f7ff..1c0440c 100644
--- a/doc/src/snippets/code/doc_src_stylesheet.qdoc
+++ b/doc/src/snippets/code/doc_src_stylesheet.qdoc
@@ -1007,6 +1007,11 @@ QHeaderView::section {
border: 1px solid #6c6c6c;
}
+QHeaderView::section:checked
+{
+ background-color: red;
+}
+
/* style the sort indicator */
QHeaderView::down-arrow {
image: url(down_arrow.png);
diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc
index c40795a..d2538f4 100644
--- a/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -840,7 +840,8 @@
\l{#first-ps}{:first}, \l{#last-ps}{:last},
\l{#only-one-ps}{:only-one}, \l{#next-selected-ps}{:next-selected},
\l{#previous-selected-ps}{:previous-selected},
- \l{#selected-ps}{:selected} pseudo states.
+ \l{#selected-ps}{:selected},
+ and \l{#checked-ps}{:checked} pseudo states.
Sort indicator in can be styled using the
\l{#up-arrow-sub}{::up-arrow} and the
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index d6ded62..b64d7df 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -106,13 +106,19 @@ void QPropertyAnimationPrivate::updateMetaProperty()
return;
}
+ //propertyType will be set to a valid type only if there is a Q_PROPERTY
+ //otherwise it will be set to QVariant::Invalid at the end of this function
propertyType = targetValue->property(propertyName).userType();
propertyIndex = targetValue->metaObject()->indexOfProperty(propertyName);
- if (propertyIndex == -1 && !targetValue->dynamicPropertyNames().contains(propertyName))
- qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData());
if (propertyType != QVariant::Invalid)
convertValues(propertyType);
+ if (propertyIndex == -1) {
+ //there is no Q_PROPERTY on the object
+ propertyType = QVariant::Invalid;
+ if (!targetValue->dynamicPropertyNames().contains(propertyName))
+ qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData());
+ }
}
void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue)
@@ -125,7 +131,7 @@ void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue)
return;
}
- if (propertyIndex != -1 && newValue.userType() == propertyType) {
+ if (newValue.userType() == propertyType) {
//no conversion is needed, we directly call the QObject::qt_metacall
void *data = const_cast<void*>(newValue.constData());
targetValue->qt_metacall(QMetaObject::WriteProperty, propertyIndex, &data);
@@ -273,9 +279,9 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState,
if (oldState == Stopped) {
d->setDefaultStartEndValue(d->targetValue->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())
+ if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid()))
qWarning("QPropertyAnimation::updateState: starting an animation without start value");
- if (d->direction == Backward && !endValue().isValid() && !d->defaultStartEndValue.isValid())
+ if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid()))
qWarning("QPropertyAnimation::updateState: starting an animation without end value");
}
} else if (hash.value(key) == this) {
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 6d55ef9..d8557e5 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -47,6 +47,7 @@
#include "qlocale.h"
#include "qlocale_p.h"
#include "qunicodetables_p.h"
+#include "qscopedpointer.h"
#ifndef QT_NO_DATASTREAM
#include <qdatastream.h>
#endif
@@ -535,38 +536,49 @@ QByteArray qUncompress(const uchar* data, int nbytes)
ulong expectedSize = (data[0] << 24) | (data[1] << 16) |
(data[2] << 8) | (data[3] );
ulong len = qMax(expectedSize, 1ul);
- QByteArray baunzip;
- int res;
- do {
- QT_TRY {
- baunzip.resize(len);
- res = ::uncompress((uchar*)baunzip.data(), &len,
- (uchar*)data+4, nbytes-4);
- } QT_CATCH (const std::bad_alloc &) {
- res = Z_MEM_ERROR;
+ QScopedPointer<QByteArray::Data, QScopedPointerPodDeleter> d;
+
+ forever {
+ ulong alloc = len;
+ d.reset(q_check_ptr(static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + alloc))));
+ if (!d) {
+ // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS
+ qWarning("qUncompress: could not allocate enough memory to uncompress data");
+ return QByteArray();
}
+ int res = ::uncompress((uchar*)d->array, &len,
+ (uchar*)data+4, nbytes-4);
+
switch (res) {
case Z_OK:
- if ((int)len != baunzip.size())
- baunzip.resize(len);
- break;
+ if (len != alloc) {
+ d.reset(q_check_ptr(static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + len))));
+ if (!d) {
+ // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS
+ qWarning("qUncompress: could not allocate enough memory to uncompress data");
+ return QByteArray();
+ }
+ }
+ d->ref = 1;
+ d->alloc = d->size = len;
+ d->data = d->array;
+
+ return QByteArray(d.take(), 0, 0);
+
case Z_MEM_ERROR:
qWarning("qUncompress: Z_MEM_ERROR: Not enough memory");
- break;
+ return QByteArray();
+
case Z_BUF_ERROR:
len *= 2;
- break;
+ continue;
+
case Z_DATA_ERROR:
qWarning("qUncompress: Z_DATA_ERROR: Input data is corrupted");
- break;
+ return QByteArray();
}
- } while (res == Z_BUF_ERROR);
-
- if (res != Z_OK)
- baunzip = QByteArray();
-
- return baunzip;
+ }
}
#endif
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 191f6a2..9621dbf 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -372,6 +372,7 @@ private:
friend class QByteRef;
friend class QString;
+ friend QByteArray qUncompress(const uchar *data, int nbytes);
public:
typedef Data * DataPtr;
inline DataPtr &data_ptr() { return d; }
diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp
index 62a674a..888e1be 100644
--- a/src/gui/text/qfontengine_qws.cpp
+++ b/src/gui/text/qfontengine_qws.cpp
@@ -381,6 +381,8 @@ class QFontEngineQPF1Data
public:
QPFFontMetrics fm;
QPFGlyphTree *tree;
+ void *mmapStart;
+ size_t mmapLength;
};
@@ -410,6 +412,8 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn)
QT_CLOSE(f);
d = new QFontEngineQPF1Data;
+ d->mmapStart = data;
+ d->mmapLength = st.st_size;
memcpy(reinterpret_cast<char*>(&d->fm),data,sizeof(d->fm));
data += sizeof(d->fm);
@@ -431,6 +435,8 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn)
QFontEngineQPF1::~QFontEngineQPF1()
{
+ if (d->mmapStart)
+ munmap(d->mmapStart, d->mmapLength);
delete d->tree;
delete d;
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 4427ee9..e32bbbd 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1405,8 +1405,8 @@ void QGL2PaintEngineEx::ensureActive()
glViewport(0, 0, d->width, d->height);
glDepthMask(false);
glDepthFunc(GL_LESS);
- setState(state());
d->needsSync = false;
+ setState(state());
}
}
@@ -1519,6 +1519,8 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
// qDebug("QGL2PaintEngineEx::clip()");
Q_D(QGL2PaintEngineEx);
+ ensureActive();
+
if (op == Qt::ReplaceClip && !d->hasClipOperations())
op = Qt::IntersectClip;
diff --git a/src/plugins/graphicssystems/opengl/main.cpp b/src/plugins/graphicssystems/opengl/main.cpp
index 0562132..c28b09a 100644
--- a/src/plugins/graphicssystems/opengl/main.cpp
+++ b/src/plugins/graphicssystems/opengl/main.cpp
@@ -41,6 +41,7 @@
#include <private/qgraphicssystemplugin_p.h>
#include <private/qgraphicssystem_gl_p.h>
+#include <qgl.h>
QT_BEGIN_NAMESPACE
@@ -53,11 +54,18 @@ public:
QStringList QGLGraphicsSystemPlugin::keys() const
{
- return QStringList(QLatin1String("OpenGL"));
+ QStringList list;
+ list << QLatin1String("OpenGL") << QLatin1String("OpenGL1");
+ return list;
}
QGraphicsSystem* QGLGraphicsSystemPlugin::create(const QString& system)
{
+ if (system.toLower() == QLatin1String("opengl1")) {
+ QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);
+ return new QGLGraphicsSystem;
+ }
+
if (system.toLower() == QLatin1String("opengl"))
return new QGLGraphicsSystem;
diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp
index a919593..725b17c 100644
--- a/src/s60main/qts60main.cpp
+++ b/src/s60main/qts60main.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
// INCLUDE FILES
+#include <exception> // must be before e32base.h so uncaught_exception gets defined
#include <e32base.h>
#include <qglobal.h>
diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp
index 9439d2a..d30e07a 100644
--- a/src/s60main/qts60main_mcrt0.cpp
+++ b/src/s60main/qts60main_mcrt0.cpp
@@ -48,8 +48,8 @@
// EPOC32 version of crt0.c for C programs which always want multi-threaded support
#include <e32std.h>
+#include <exception> // must be before e32base.h so uncaught_exception gets defined
#include <e32base.h>
-#include <exception>
#include "estlib.h"
// Needed for QT_TRYCATCH_LEAVING.
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 44cfe4a..b0bf3df 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -236,6 +236,7 @@ void tst_QByteArray::qUncompress_data()
void tst_QByteArray::qUncompress()
{
QFETCH(QByteArray, in);
+ QFETCH(QByteArray, out);
#if defined Q_OS_HPUX && !defined __ia64 && defined Q_CC_GNU
QSKIP("Corrupt data causes this tests to lock up on HP-UX / PA-RISC with gcc", SkipAll);
@@ -245,9 +246,20 @@ void tst_QByteArray::qUncompress()
QSKIP("Corrupt data causes this test to lock up on QNX", SkipAll);
#endif
- QTEST(::qUncompress(in), "out");
+ QByteArray res;
+ QT_TRY {
+ res = ::qUncompress(in);
+ } QT_CATCH(const std::bad_alloc &) {
+ res = QByteArray();
+ }
+ QCOMPARE(res, out);
- QTEST(::qUncompress(in + "blah"), "out");
+ QT_TRY {
+ res = ::qUncompress(in + "blah");
+ } QT_CATCH(const std::bad_alloc &) {
+ res = QByteArray();
+ }
+ QCOMPARE(res, out);
}
#endif
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index c74bbcb..07aa9f4 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -1545,22 +1545,27 @@ void tst_QMenuBar::task256322_highlight()
win.show();
QTest::qWait(200);
+ QTest::mousePress(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file).center());
QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file).center());
- QTest::mouseClick(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file).center());
+ QTest::mouseRelease(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file).center());
QTRY_VERIFY(menu.isVisible());
QVERIFY(!menu2.isVisible());
QCOMPARE(win.menuBar()->activeAction(), file);
+ QTest::mousePress(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file2).center());
QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file2).center());
QTRY_VERIFY(!menu.isVisible());
QVERIFY(menu2.isVisible());
QCOMPARE(win.menuBar()->activeAction(), file2);
+ QTest::mouseRelease(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file2).center());
QPoint nothingCenter = win.menuBar()->actionGeometry(nothing).center();
+ QTest::mousePress(win.menuBar(), Qt::LeftButton, 0, nothingCenter);
QTest::mouseMove(win.menuBar(), nothingCenter);
QTRY_VERIFY(!menu2.isVisible());
QVERIFY(!menu.isVisible());
QCOMPARE(win.menuBar()->activeAction(), nothing);
+ QTest::mouseRelease(win.menuBar(), Qt::LeftButton, 0, nothingCenter);
}
void tst_QMenuBar::menubarSizeHint()
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index 60bc39e..bea399c 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -473,6 +473,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
{
//normal case: the animation finishes and is deleted
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
+ anim->setEndValue(100);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
anim->start(QVariantAnimation::DeleteWhenStopped);
QTest::qWait(anim->duration() + 50);
@@ -482,10 +483,12 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
{
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
+ anim->setEndValue(100);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
anim->start(QVariantAnimation::DeleteWhenStopped);
QTest::qWait(anim->duration()/2);
QPointer<QVariantAnimation> anim2 = new QPropertyAnimation(&o, "ole");
+ anim2->setEndValue(100);
QCOMPARE(runningSpy.count(), 1);
QCOMPARE(anim->state(), QVariantAnimation::Running);
@@ -634,6 +637,7 @@ void tst_QPropertyAnimation::playForwardBackward()
QCOMPARE(o.property("ole").toInt(), 0);
QPropertyAnimation anim(&o, "ole");
+ anim.setStartValue(0);
anim.setEndValue(100);
anim.start();
QTest::qWait(anim.duration() + 50);
@@ -906,6 +910,7 @@ void tst_QPropertyAnimation::operationsInStates()
QObject o;
o.setProperty("ole", 42);
QPropertyAnimation anim(&o, "ole");
+ anim.setEndValue(100);
QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
anim.stop();
diff --git a/tests/auto/qtwidgets/tst_qtwidgets.cpp b/tests/auto/qtwidgets/tst_qtwidgets.cpp
index 12bc02f..a765bde 100644
--- a/tests/auto/qtwidgets/tst_qtwidgets.cpp
+++ b/tests/auto/qtwidgets/tst_qtwidgets.cpp
@@ -72,6 +72,8 @@ tst_QtWidgets::~tst_QtWidgets()
void tst_QtWidgets::snapshot()
{
+ QSKIP("Jesper will fix this test when he has time.", SkipAll);
+#if 0
StyleWidget widget(0, Qt::X11BypassWindowManagerHint);
widget.show();
@@ -100,6 +102,7 @@ void tst_QtWidgets::snapshot()
}
QVERIFY2(ftp.error() == QFtp::NoError, ftp.errorString().toLocal8Bit().constData());
QVERIFY(!ftp.hasPendingCommands());
+#endif
}