summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-04-22 08:29:37 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-04-22 08:29:37 (GMT)
commit27f566fb608d9465110dc67d16fe8f88ee9d4a0a (patch)
treec8925b7aa4effc946ba8330648c95a288f923d4d
parent79a093b7f4c78994504a0a9e306169df1eb4c7a3 (diff)
parent144f3bade4d5f48ebc268dae0df26ddf7dfe1228 (diff)
downloadQt-27f566fb608d9465110dc67d16fe8f88ee9d4a0a.zip
Qt-27f566fb608d9465110dc67d16fe8f88ee9d4a0a.tar.gz
Qt-27f566fb608d9465110dc67d16fe8f88ee9d4a0a.tar.bz2
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
Conflicts: src/openvg/qpaintengine_vg.cpp
-rw-r--r--examples/widgets/stylesheet/mainwindow.ui2
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp9
-rw-r--r--src/gui/styles/qstylesheetstyle_p.h1
-rw-r--r--src/gui/text/qfontengine_s60.cpp8
-rw-r--r--src/openvg/qpaintengine_vg.cpp54
-rw-r--r--tests/auto/qtipc/qsharedmemory/test/test.pro6
-rw-r--r--tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp16
-rw-r--r--tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro5
-rw-r--r--tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp37
-rw-r--r--tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp2
10 files changed, 84 insertions, 56 deletions
diff --git a/examples/widgets/stylesheet/mainwindow.ui b/examples/widgets/stylesheet/mainwindow.ui
index 2b232df..cc29257 100644
--- a/examples/widgets/stylesheet/mainwindow.ui
+++ b/examples/widgets/stylesheet/mainwindow.ui
@@ -196,7 +196,7 @@
</item>
<item row="1" column="2" colspan="2" >
<widget class="QRadioButton" name="femaleRadioButton" >
- <property name="styleSheet" >
+ <property name="toolTip">
<string>Check this if you are female</string>
</property>
<property name="text" >
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 81b923b..515b6c7 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1539,7 +1539,9 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const
QHash<const void *, StyleSheet>::const_iterator defaultCacheIt = styleSheetCache->constFind(baseStyle());
if (defaultCacheIt == styleSheetCache->constEnd()) {
defaultSs = getDefaultStyleSheet();
- styleSheetCache->insert(baseStyle(), defaultSs);
+ QStyle *bs = baseStyle();
+ styleSheetCache->insert(bs, defaultSs);
+ QObject::connect(bs, SIGNAL(destroyed(QObject*)), this, SLOT(styleDestroyed(QObject*)), Qt::UniqueConnection);
} else {
defaultSs = defaultCacheIt.value();
}
@@ -2666,6 +2668,11 @@ void QStyleSheetStyle::widgetDestroyed(QObject *o)
autoFillDisabledWidgets->remove((const QWidget *)o);
}
+void QStyleSheetStyle::styleDestroyed(QObject *o)
+{
+ styleSheetCache->remove(o);
+}
+
/*!
* Make sure that the cache will be clean by connecting destroyed if needed.
* return false if the widget is not stylable;
diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/gui/styles/qstylesheetstyle_p.h
index 50abef9..fd81437 100644
--- a/src/gui/styles/qstylesheetstyle_p.h
+++ b/src/gui/styles/qstylesheetstyle_p.h
@@ -147,6 +147,7 @@ protected:
private Q_SLOTS:
void widgetDestroyed(QObject *);
+ void styleDestroyed(QObject *);
private:
int refcount;
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index c9ff661..e557f56 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -221,9 +221,11 @@ bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout
HB_Glyph *g = glyphs->glyphs;
const unsigned char* cmap = m_extensions->cmap();
+ const bool isRtl = (flags & QTextEngine::RightToLeft);
for (int i = 0; i < len; ++i) {
const unsigned int uc = getChar(characters, i, len);
- *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap, uc);
+ *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap,
+ isRtl ? QChar::mirroredChar(uc) : uc);
}
glyphs->numGlyphs = g - glyphs->glyphs;
@@ -241,8 +243,8 @@ void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
Q_UNUSED(flags);
for (int i = 0; i < glyphs->numGlyphs; i++) {
const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]);
- glyphs->advances_x[i] = glyphs->offsets[i].x = bbox.xoff;
- glyphs->advances_y[i] = glyphs->offsets[i].y = bbox.yoff;
+ glyphs->advances_x[i] = bbox.xoff;
+ glyphs->advances_y[i] = bbox.yoff;
}
}
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 4b4333b..b332ba4 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -182,7 +182,6 @@ public:
qreal penScale; // Pen scaling factor from "transform".
QTransform pathTransform; // Calculated VG path transformation.
- QTransform glyphTransform; // Calculated VG glyph transformation.
QTransform imageTransform; // Calculated VG image transformation.
bool pathTransformSet; // True if path transform set in the VG context.
@@ -507,24 +506,15 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
// | 1 0 0 |
// | 0 -1 devh |
// | 0 0 1 |
- // The glyph transform uses a slightly different transformation:
- // | 1 0 0 | | 1 0 0.5 | | 1 0 0.5 |
- // | 0 -1 devh - 1 | * | 0 1 -0.5 | = | 0 -1 (devh - 0.5) |
- // | 0 0 1 | | 0 0 1 | | 0 0 1 |
// The full VG transform is effectively:
// 1. Apply the user's transformation matrix.
- // 2. Translate glyphs by an extra (0.5, -0.5).
- // 3. Flip the co-ordinate system upside down.
+ // 2. Flip the co-ordinate system upside down.
QTransform viewport(1.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f,
0.0f, devh, 1.0f);
- QTransform gviewport(1.0f, 0.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.5f, devh - 0.5f, 1.0f);
// Compute the path transform and determine if it is projective.
pathTransform = transform * viewport;
- glyphTransform = transform * gviewport;
bool projective = (pathTransform.m13() != 0.0f ||
pathTransform.m23() != 0.0f ||
pathTransform.m33() != 1.0f);
@@ -533,7 +523,6 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
// so we will have to convert the co-ordinates ourselves.
// Change the matrix to just the viewport transformation.
pathTransform = viewport;
- glyphTransform = gviewport;
simpleTransform = false;
} else {
simpleTransform = true;
@@ -3242,10 +3231,10 @@ void QVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d,
vgImageSubData(vgImage, img.constBits(), img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, img.width(), img.height());
}
}
- origin[0] = -metrics.x.toReal() + 0.5f;
- origin[1] = -metrics.y.toReal() + 0.5f;
- escapement[0] = metrics.xoff.toReal();
- escapement[1] = metrics.yoff.toReal();
+ origin[0] = -metrics.x.toReal();
+ origin[1] = -metrics.y.toReal();
+ escapement[0] = 0;
+ escapement[1] = 0;
vgSetGlyphToImage(font, glyph, vgImage, origin, escapement);
vgDestroyImage(vgImage); // Reduce reference count.
#else
@@ -3261,8 +3250,8 @@ void QVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d,
}
origin[0] = 0;
origin[1] = 0;
- escapement[0] = metrics.xoff.toReal();
- escapement[1] = metrics.yoff.toReal();
+ escapement[0] = 0;
+ escapement[1] = 0;
vgSetGlyphToPath(font, glyph, vgPath, VG_FALSE, origin, escapement);
vgDestroyPath(vgPath); // Reduce reference count.
#endif // !defined(QVG_NO_IMAGE_GLYPHS)
@@ -3287,10 +3276,8 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
// Get the glyphs and positions associated with the text item.
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
- QTransform matrix = d->transform;
- matrix.translate(p.x(), p.y());
- ti.fontEngine->getGlyphPositions
- (ti.glyphs, matrix, ti.flags, glyphs, positions);
+ QTransform matrix;
+ ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
if (!drawCachedGlyphs(glyphs.size(), glyphs.data(), ti.font(), ti.fontEngine, p))
QPaintEngineEx::drawTextItem(p, textItem);
@@ -3334,7 +3321,7 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
}
// Set the transformation to use for drawing the current glyphs.
- QTransform glyphTransform(d->glyphTransform);
+ QTransform glyphTransform(d->pathTransform);
glyphTransform.translate(p.x(), p.y());
#if defined(QVG_NO_IMAGE_GLYPHS)
glyphTransform.scale(glyphCache->scaleX, glyphCache->scaleY);
@@ -3344,10 +3331,18 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
// Add the glyphs from the text item into the glyph cache.
glyphCache->cacheGlyphs(d, fontEngine, glyphs, numGlyphs);
+ // Create the array of adjustments between glyphs
+ QVarLengthArray<VGfloat> adjustments_x(glyphs.size());
+ QVarLengthArray<VGfloat> adjustments_y(glyphs.size());
+ for (int i = 1; i < glyphs.size(); ++i) {
+ adjustments_x[i-1] = (positions[i].x - positions[i-1].x).toReal();
+ adjustments_y[i-1] = (positions[i].y - positions[i-1].y).toReal();
+ }
+
// Set the glyph drawing origin.
VGfloat origin[2];
- origin[0] = 0;
- origin[1] = 0;
+ origin[0] = positions[0].x.toReal();
+ origin[1] = positions[0].y.toReal();
vgSetfv(VG_GLYPH_ORIGIN, 2, origin);
// Fast anti-aliasing for paths, better for images.
@@ -3361,13 +3356,8 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
// Draw the glyphs. We need to fill with the brush associated with
// the Qt pen, not the Qt brush.
d->ensureBrush(state()->pen.brush());
- if (ti.renderFlags() & QTextItem::RightToLeft) {
- for (int index = numGlyphs - 1; index >= 0; --index)
- vgDrawGlyph(glyphCache->font, glyphs[index], VG_FILL_PATH, VG_TRUE);
- } else {
- vgDrawGlyphs(glyphCache->font, numGlyphs, (VGuint*)glyphs.data(),
- NULL, NULL, VG_FILL_PATH, VG_TRUE);
- }
+ vgDrawGlyphs(glyphCache->font, numGlyphs, (VGuint*)glyphs.data(),
+ adjustments_x.data(), adjustments_y.data(), VG_FILL_PATH, VG_TRUE);
return true;
#else
Q_UNUSED(numGlyphs);
diff --git a/tests/auto/qtipc/qsharedmemory/test/test.pro b/tests/auto/qtipc/qsharedmemory/test/test.pro
index 40ba8b9..4ff5486 100644
--- a/tests/auto/qtipc/qsharedmemory/test/test.pro
+++ b/tests/auto/qtipc/qsharedmemory/test/test.pro
@@ -20,10 +20,10 @@ TARGET = ../tst_qsharedmemory
wince*:{
requires(contains(QT_CONFIG,script))
QT += gui script
-addFiles.sources = ../../lackey/lackey.exe ../../lackey/scripts
-addFiles.path = lackey
+addFiles.sources = $$OUT_PWD/../../lackey/lackey.exe ../../lackey/scripts
+addFiles.path = .
DEPLOYMENT += addFiles
-DEFINES += SRCDIR=\\\"\\\"
+DEFINES += SRCDIR=\\\".\\\"
}else:symbian*{
requires(contains(QT_CONFIG,script))
QT += gui script
diff --git a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
index 83f65b0..dac631b 100644
--- a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <qsharedmemory.h>
+#include <QtCore/QFile>
//TESTED_CLASS=
//TESTED_FILES=
@@ -52,8 +53,8 @@
#ifdef Q_OS_SYMBIAN
#define SRCDIR "c:/data/qsharedmemorytemp/"
#define LACKEYDIR SRCDIR "lackey"
-#elif Q_OS_WINCE
-#define LACKEYDIR SRCDIR "lackey"
+#elif defined(Q_OS_WINCE)
+#define LACKEYDIR SRCDIR
#else
#define LACKEYDIR SRCDIR "../lackey"
#endif
@@ -746,7 +747,18 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
QStringList arguments = QStringList() << LACKEYDIR "/scripts/consumer.js";
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::ForwardedChannels);
+#ifdef Q_OS_WINCE
+ // We can't start the same executable twice on Windows CE.
+ // Create a copy instead.
+ QString lackeyCopy = QLatin1String(LACKEYDIR "/lackey");
+ lackeyCopy.append(QString::number(i));
+ lackeyCopy.append(QLatin1String(".exe"));
+ if (!QFile::exists(lackeyCopy))
+ QVERIFY(QFile::copy(LACKEYDIR "/lackey.exe", lackeyCopy));
+ p->start(lackeyCopy, arguments);
+#else
p->start(LACKEYDIR "/lackey", arguments);
+#endif
if (p->waitForStarted(2000))
consumers.append(p);
diff --git a/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro
index 1f9205e..8a5f8b2 100644
--- a/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro
+++ b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro
@@ -17,9 +17,8 @@ requires(contains(QT_CONFIG,script))
# this test calls lackey, which then again depends on QtScript.
# let's add it here so that it gets deployed easily
QT += script
-lackey.sources = ../lackey/lackey.exe
-lackey.path = ../lackey
-
+lackey.sources = $$OUT_PWD/../lackey/lackey.exe ../lackey/scripts
+lackey.path = .
DEPLOYMENT += lackey
}
diff --git a/tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp b/tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp
index eb82fd4..cb3bb6b 100644
--- a/tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp
+++ b/tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp
@@ -46,7 +46,11 @@
//TESTED_FILES=
#define EXISTING_SHARE "existing"
-#define LACKYLOC "../lackey"
+#ifdef Q_OS_WINCE
+#define LACKEYLOC "."
+#else
+#define LACKEYLOC "../lackey"
+#endif
#define LACKYWAITTIME 10000
class tst_QSystemSemaphore : public QObject
@@ -109,7 +113,7 @@ private:
tst_QSystemSemaphore::tst_QSystemSemaphore()
{
- if (!QFile::exists(LACKYLOC "/lackey"))
+ if (!QFile::exists(LACKEYLOC "/lackey"))
qWarning() << "lackey executable doesn't exists!";
}
@@ -197,11 +201,11 @@ void tst_QSystemSemaphore::basicProcesses()
QProcess release;
release.setProcessChannelMode(QProcess::ForwardedChannels);
- acquire.start(LACKYLOC "/lackey", acquireArguments);
+ acquire.start(LACKEYLOC "/lackey", acquireArguments);
acquire.waitForFinished(LACKYWAITTIME);
QVERIFY(acquire.state() == QProcess::Running);
acquire.kill();
- release.start(LACKYLOC "/lackey", releaseArguments);
+ release.start(LACKEYLOC "/lackey", releaseArguments);
acquire.waitForFinished(LACKYWAITTIME);
release.waitForFinished(LACKYWAITTIME);
QVERIFY(acquire.state() == QProcess::NotRunning);
@@ -235,7 +239,20 @@ void tst_QSystemSemaphore::processes()
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::ForwardedChannels);
consumers.append(p);
- p->start(LACKYLOC "/lackey", arguments);
+#ifdef Q_OS_WINCE
+ // We can't start the same executable twice on Windows CE.
+ // Create a copy instead.
+ QString lackeyCopy = QLatin1String(LACKEYLOC "/lackey");
+ if (i > 0) {
+ lackeyCopy.append(QString::number(i));
+ lackeyCopy.append(QLatin1String(".exe"));
+ if (!QFile::exists(lackeyCopy))
+ QVERIFY(QFile::copy(LACKEYLOC "/lackey.exe", lackeyCopy));
+ }
+ p->start(lackeyCopy, arguments);
+#else
+ p->start(LACKEYLOC "/lackey", arguments);
+#endif
}
while (!consumers.isEmpty()) {
@@ -257,13 +274,13 @@ void tst_QSystemSemaphore::undo()
QStringList acquireArguments = QStringList() << acquire_js();
QProcess acquire;
acquire.setProcessChannelMode(QProcess::ForwardedChannels);
- acquire.start(LACKYLOC "/lackey", acquireArguments);
+ acquire.start(LACKEYLOC "/lackey", acquireArguments);
acquire.waitForFinished(LACKYWAITTIME);
QVERIFY(acquire.state()== QProcess::NotRunning);
// At process exit the kernel should auto undo
- acquire.start(LACKYLOC "/lackey", acquireArguments);
+ acquire.start(LACKEYLOC "/lackey", acquireArguments);
acquire.waitForFinished(LACKYWAITTIME);
QVERIFY(acquire.state()== QProcess::NotRunning);
}
@@ -283,16 +300,16 @@ void tst_QSystemSemaphore::initialValue()
QProcess release;
release.setProcessChannelMode(QProcess::ForwardedChannels);
- acquire.start(LACKYLOC "/lackey", acquireArguments);
+ acquire.start(LACKEYLOC "/lackey", acquireArguments);
acquire.waitForFinished(LACKYWAITTIME);
QVERIFY(acquire.state()== QProcess::NotRunning);
- acquire.start(LACKYLOC "/lackey", acquireArguments << "2");
+ acquire.start(LACKEYLOC "/lackey", acquireArguments << "2");
acquire.waitForFinished(LACKYWAITTIME);
QVERIFY(acquire.state()== QProcess::Running);
acquire.kill();
- release.start(LACKYLOC "/lackey", releaseArguments);
+ release.start(LACKEYLOC "/lackey", releaseArguments);
acquire.waitForFinished(LACKYWAITTIME);
release.waitForFinished(LACKYWAITTIME);
QVERIFY(acquire.state()== QProcess::NotRunning);
diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp
index 81f6f25..7534e09 100644
--- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp
+++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp
@@ -141,7 +141,7 @@ void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead()
{
QNetworkAccessManager manager;
QTime t;
- QNetworkRequest request(QUrl(testFile.fileName()));
+ QNetworkRequest request(QUrl::fromLocalFile(testFile.fileName()));
// do 3 dry runs for cache warmup
qnamImmediateFileRead_iteration(manager, request);