summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-03-03 23:56:08 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-03-03 23:56:08 (GMT)
commit458b710351232d06fb55fb82589c9a097f145379 (patch)
treecbb3d99c02506891330f80221913126761723fe4
parentb67d5d90a306534a1ea2fcb333981c6b1126105c (diff)
parent340d7982be8929be065981a0dcb30efd4dffc50f (diff)
downloadQt-458b710351232d06fb55fb82589c9a097f145379.zip
Qt-458b710351232d06fb55fb82589c9a097f145379.tar.gz
Qt-458b710351232d06fb55fb82589c9a097f145379.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp25
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp14
3 files changed, 31 insertions, 13 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index d534f21..05fe0f7 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -393,9 +393,10 @@ void QDeclarativeRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *,
void QDeclarativeRectangle::drawRect(QPainter &p)
{
Q_D(QDeclarativeRectangle);
- if (d->gradient && d->gradient->gradient()) {
+ if ((d->gradient && d->gradient->gradient())
+ || d->radius > width()/2 || d->radius > height()/2) {
// XXX This path is still slower than the image path
- // Image path won't work for gradients though
+ // Image path won't work for gradients or invalid radius though
bool oldAA = p.testRenderHint(QPainter::Antialiasing);
if (d->smooth)
p.setRenderHint(QPainter::Antialiasing);
@@ -405,11 +406,23 @@ void QDeclarativeRectangle::drawRect(QPainter &p)
} else {
p.setPen(Qt::NoPen);
}
- p.setBrush(*d->gradient->gradient());
- if (d->radius > 0.)
- p.drawRoundedRect(0, 0, width(), height(), d->radius, d->radius);
+ if (d->gradient && d->gradient->gradient())
+ p.setBrush(*d->gradient->gradient());
else
- p.drawRect(0, 0, width(), height());
+ p.setBrush(d->color);
+ const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
+ QRectF rect;
+ if (pw%2)
+ rect = QRectF(0.5, 0.5, width()-1, height()-1);
+ else
+ rect = QRectF(0, 0, width(), height());
+ qreal radius = d->radius;
+ if (radius > width()/2 || radius > height()/2)
+ radius = qMin(width()/2, height()/2);
+ if (radius > 0.)
+ p.drawRoundedRect(rect, radius, radius);
+ else
+ p.drawRect(rect);
if (d->smooth)
p.setRenderHint(QPainter::Antialiasing, oldAA);
} else {
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
index 2982010..bb4028f 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
@@ -4,9 +4,10 @@ WorkerScript {
id: worker
source: "script.js"
- property bool done : false
property var response
+ signal done()
+
function testSend(value) {
worker.sendMessage(value)
}
@@ -21,7 +22,7 @@ WorkerScript {
}
onMessage: {
- worker.done = true
worker.response = messageObject
+ worker.done()
}
}
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index de11fe2..9957b50 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qtest.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qtimer.h>
#include <QtScript/qscriptengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
@@ -67,11 +68,14 @@ private slots:
private:
void waitForEchoMessage(QDeclarativeWorkerScript *worker) {
- const QMetaObject *mo = worker->metaObject();
- int index = mo->indexOfProperty("done");
- QVERIFY(index >= 0);
- QTRY_COMPARE(mo->property(index).read(worker).toBool(), true);
- QTRY_COMPARE(mo->property(mo->indexOfProperty("done")).read(worker).toBool(), true);
+ QEventLoop loop;
+ QVERIFY(connect(worker, SIGNAL(done()), &loop, SLOT(quit())));
+ QTimer timer;
+ timer.setSingleShot(true);
+ connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.start(10000);
+ loop.exec();
+ QVERIFY(timer.isActive());
}
QDeclarativeEngine m_engine;