summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-04 10:08:23 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-04 10:08:23 (GMT)
commit7de32cff0f6d209fe5305b4a537ce2b3b2996fa8 (patch)
treeb22935bf7693a14dca78f4f25378098f049aa143
parentfb80e2646874919f9ae8c459b21c190ff89e839b (diff)
parente3fb16c08a0b219703c6d3ca47d0c62bafdd013c (diff)
downloadQt-7de32cff0f6d209fe5305b4a537ce2b3b2996fa8.zip
Qt-7de32cff0f6d209fe5305b4a537ce2b3b2996fa8.tar.gz
Qt-7de32cff0f6d209fe5305b4a537ce2b3b2996fa8.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: SqlBrowser not respecting casings. Remove vgClearPath() change to OpenVG paint engine QVariant: Fix crash when comparing two variant with the same undefined type. Fix compositing when QWS background is completely transparent. Fixes wrong composition mode for cached backgrounds in Graphics View. Support keypad input with vnc driver
-rw-r--r--demos/sqlbrowser/browser.cpp2
-rw-r--r--src/corelib/kernel/qvariant.cpp3
-rw-r--r--src/gui/embedded/qscreen_qws.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp6
-rw-r--r--src/openvg/qpaintengine_vg.cpp124
-rw-r--r--src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp34
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp34
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp4
8 files changed, 133 insertions, 76 deletions
diff --git a/demos/sqlbrowser/browser.cpp b/demos/sqlbrowser/browser.cpp
index 6aed73a..1232428 100644
--- a/demos/sqlbrowser/browser.cpp
+++ b/demos/sqlbrowser/browser.cpp
@@ -146,7 +146,7 @@ void Browser::showTable(const QString &t)
{
QSqlTableModel *model = new QSqlTableModel(table, connectionWidget->currentDatabase());
model->setEditStrategy(QSqlTableModel::OnRowChange);
- model->setTable(t);
+ model->setTable(connectionWidget->currentDatabase().driver()->escapeIdentifier(t, QSqlDriver::TableName));
model->select();
if (model->lastError().type() != QSqlError::NoError)
emit statusMessage(model->lastError().text());
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index e1b5825..95b2352 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -466,7 +466,8 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
* QMetaType::VoidStar, QMetaType::QObjectStar and so forth, is that it wouldn't include
* user defined pointer types. */
const char *const typeName = QMetaType::typeName(a->type);
- if (typeName[qstrlen(typeName) - 1] == '*')
+ uint typeNameLen = qstrlen(typeName);
+ if (typeNameLen > 0 && typeName[typeNameLen - 1] == '*')
return *static_cast<void *const *>(a_ptr) == *static_cast<void *const *>(b_ptr);
return a_ptr == b_ptr;
diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp
index 8eb8123..9bd73a4 100644
--- a/src/gui/embedded/qscreen_qws.cpp
+++ b/src/gui/embedded/qscreen_qws.cpp
@@ -2739,7 +2739,7 @@ void QScreen::compose(int level, const QRegion &exposed, QRegion &blend,
default:
break;
}
- spanData.setup(qwsServer->backgroundBrush(), 256, QPainter::CompositionMode_SourceOver);
+ spanData.setup(qwsServer->backgroundBrush(), 256, QPainter::CompositionMode_Source);
spanData.dx = off.x();
spanData.dy = off.y();
} else if (!surface->isBuffered()) {
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 1ced3d7..a767987 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -3360,12 +3360,6 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
backgroundPainter.setClipRegion(d->backgroundPixmapExposed, Qt::ReplaceClip);
if (viewTransformed)
backgroundPainter.setTransform(viewTransform);
-#ifdef Q_WS_X11
-#undef X11
- if (backgroundPainter.paintEngine()->type() != QPaintEngine::X11)
-#define X11 qt_x11Data
-#endif
- backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source);
QRectF backgroundExposedSceneRect = mapToScene(d->backgroundPixmapExposed.boundingRect()).boundingRect();
drawBackground(&backgroundPainter, backgroundExposedSceneRect);
d->backgroundPixmapExposed = QRegion();
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 4192dbb..da47f06 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -131,9 +131,8 @@ public:
void draw(VGPath path, const QPen& pen, const QBrush& brush, VGint rule = VG_EVEN_ODD);
void stroke(VGPath path, const QPen& pen);
void fill(VGPath path, const QBrush& brush, VGint rule = VG_EVEN_ODD);
- inline void releasePath(VGPath path);
- VGPath vectorPathToVGPath(const QVectorPath& path, bool forceNewPath = false);
- VGPath painterPathToVGPath(const QPainterPath& path, bool forceNewPath = false);
+ VGPath vectorPathToVGPath(const QVectorPath& path);
+ VGPath painterPathToVGPath(const QPainterPath& path);
VGPath roundedRectPath(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode);
VGPaintType setBrush
(VGPaint paint, const QBrush& brush, VGMatrixMode mode,
@@ -179,8 +178,6 @@ public:
VGPath roundRectPath; // Cached path for quick drawing of rounded rects.
#endif
- VGPath reusablePath; // Reusable path for vectorPathToVGPath(), etc.
-
QTransform transform; // Currently active transform.
bool simpleTransform; // True if the transform is simple (non-projective).
qreal penScale; // Pen scaling factor from "transform".
@@ -353,8 +350,6 @@ void QVGPaintEnginePrivate::init()
roundRectPath = 0;
#endif
- reusablePath = 0;
-
simpleTransform = true;
pathTransformSet = false;
penScale = 1.0;
@@ -451,15 +446,6 @@ void QVGPaintEnginePrivate::initObjects()
VG_PATH_CAPABILITY_ALL);
vgAppendPathData(linePath, 2, segments, coords);
#endif
-
- // This path can be reused over and over by calling vgClearPath().
- reusablePath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
- VG_PATH_DATATYPE_F,
- 1.0f, // scale
- 0.0f, // bias
- 32 + 1, // segmentCapacityHint
- 32 * 2, // coordCapacityHint
- VG_PATH_CAPABILITY_ALL);
}
void QVGPaintEnginePrivate::destroy()
@@ -479,8 +465,6 @@ void QVGPaintEnginePrivate::destroy()
if (roundRectPath)
vgDestroyPath(roundRectPath);
#endif
- if (reusablePath)
- vgDestroyPath(reusablePath);
#if !defined(QVG_NO_DRAW_GLYPHS)
QVGFontCache::Iterator it;
@@ -557,32 +541,19 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
qt_scaleForTransform(transform, &penScale);
}
-inline void QVGPaintEnginePrivate::releasePath(VGPath path)
-{
- if (path == reusablePath)
- vgClearPath(path, VG_PATH_CAPABILITY_ALL);
- else
- vgDestroyPath(path);
-}
-
-VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path, bool forceNewPath)
+VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path)
{
int count = path.elementCount();
const qreal *points = path.points();
const QPainterPath::ElementType *elements = path.elements();
- VGPath vgpath;
- if (forceNewPath) {
- vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
- VG_PATH_DATATYPE_F,
- 1.0f, // scale
- 0.0f, // bias
- count + 1, // segmentCapacityHint
- count * 2, // coordCapacityHint
- VG_PATH_CAPABILITY_ALL);
- } else {
- vgpath = reusablePath;
- }
+ VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ count + 1, // segmentCapacityHint
+ count * 2, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
// Size is sufficient segments for drawRoundedRect() paths.
QVarLengthArray<VGubyte, 20> segments;
@@ -754,22 +725,17 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path, bool f
return vgpath;
}
-VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path, bool forceNewPath)
+VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path)
{
int count = path.elementCount();
- VGPath vgpath;
- if (forceNewPath) {
- vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
- VG_PATH_DATATYPE_F,
- 1.0f, // scale
- 0.0f, // bias
- count + 1, // segmentCapacityHint
- count * 2, // coordCapacityHint
- VG_PATH_CAPABILITY_ALL);
- } else {
- vgpath = reusablePath;
- }
+ VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ count + 1, // segmentCapacityHint
+ count * 2, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
if (count == 0)
return vgpath;
@@ -988,7 +954,13 @@ VGPath QVGPaintEnginePrivate::roundedRectPath(const QRectF &rect, qreal xRadius,
vgModifyPathCoords(vgpath, 0, 9, pts);
}
#else
- VGPath vgpath = reusablePath;
+ VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ 10, // segmentCapacityHint
+ 17 * 2, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
vgAppendPathData(vgpath, 10, roundedrect_types, pts);
#endif
@@ -1544,7 +1516,7 @@ void QVGPaintEngine::draw(const QVectorPath &path)
d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD);
else
d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO);
- d->releasePath(vgpath);
+ vgDestroyPath(vgpath);
}
void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
@@ -1555,7 +1527,7 @@ void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
d->fill(vgpath, brush, VG_EVEN_ODD);
else
d->fill(vgpath, brush, VG_NON_ZERO);
- d->releasePath(vgpath);
+ vgDestroyPath(vgpath);
}
void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
@@ -1563,7 +1535,7 @@ void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
Q_D(QVGPaintEngine);
VGPath vgpath = d->vectorPathToVGPath(path);
d->stroke(vgpath, pen);
- d->releasePath(vgpath);
+ vgDestroyPath(vgpath);
}
// Determine if a co-ordinate transform is simple enough to allow
@@ -1759,7 +1731,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
default: break;
}
- d->releasePath(vgpath);
+ vgDestroyPath(vgpath);
vgSeti(VG_MASKING, VG_TRUE);
d->maskValid = true;
@@ -2076,7 +2048,7 @@ void QVGPaintEngine::clip(const QPainterPath &path, Qt::ClipOperation op)
default: break;
}
- d->releasePath(vgpath);
+ vgDestroyPath(vgpath);
vgSeti(VG_MASKING, VG_TRUE);
d->maskValid = true;
@@ -2515,7 +2487,7 @@ void QVGPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad,
VGPath vgpath = d->roundedRectPath(rect, xrad, yrad, mode);
d->draw(vgpath, s->pen, s->brush);
#if defined(QVG_NO_MODIFY_PATH)
- d->releasePath(vgpath);
+ vgDestroyPath(vgpath);
#endif
} else {
QPaintEngineEx::drawRoundedRect(rect, xrad, yrad, mode);
@@ -2664,7 +2636,13 @@ void QVGPaintEngine::drawEllipse(const QRectF &r)
Q_D(QVGPaintEngine);
if (d->simpleTransform) {
QVGPainterState *s = state();
- VGPath path = d->reusablePath;
+ VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ 4, // segmentCapacityHint
+ 12, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
static VGubyte segments[4] = {
VG_MOVE_TO_ABS,
VG_SCCWARC_TO_REL,
@@ -2688,7 +2666,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r)
coords[11] = 0.0f;
vgAppendPathData(path, 4, segments, coords);
d->draw(path, s->pen, s->brush);
- d->releasePath(path);
+ vgDestroyPath(path);
} else {
// The projective transform version of an ellipse is difficult.
// Generate a QVectorPath containing cubic curves and transform that.
@@ -2712,7 +2690,7 @@ void QVGPaintEngine::drawPath(const QPainterPath &path)
d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD);
else
d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO);
- d->releasePath(vgpath);
+ vgDestroyPath(vgpath);
}
void QVGPaintEngine::drawPoints(const QPointF *points, int pointCount)
@@ -2787,7 +2765,13 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD
{
Q_D(QVGPaintEngine);
QVGPainterState *s = state();
- VGPath path = d->reusablePath;
+ VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ pointCount + 1, // segmentCapacityHint
+ pointCount * 2, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
QVarLengthArray<VGfloat, 16> coords;
QVarLengthArray<VGubyte, 10> segments;
for (int i = 0; i < pointCount; ++i, ++points) {
@@ -2821,14 +2805,20 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD
d->draw(path, s->pen, s->brush, VG_EVEN_ODD);
break;
}
- d->releasePath(path);
+ vgDestroyPath(path);
}
void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
{
Q_D(QVGPaintEngine);
QVGPainterState *s = state();
- VGPath path = d->reusablePath;
+ VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ pointCount + 1, // segmentCapacityHint
+ pointCount * 2, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
QVarLengthArray<VGfloat, 16> coords;
QVarLengthArray<VGubyte, 10> segments;
for (int i = 0; i < pointCount; ++i, ++points) {
@@ -2862,7 +2852,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr
d->draw(path, s->pen, s->brush, VG_EVEN_ODD);
break;
}
- d->releasePath(path);
+ vgDestroyPath(path);
}
void QVGPaintEnginePrivate::setImageOptions()
@@ -3261,7 +3251,7 @@ void QVGFontGlyphCache::cacheGlyphs
ti.fontEngine->getUnscaledGlyph(glyph, &path, &metrics);
VGPath vgPath;
if (!path.isEmpty()) {
- vgPath = d->painterPathToVGPath(path, true);
+ vgPath = d->painterPathToVGPath(path);
} else {
// Probably a "space" character with no visible outline.
vgPath = VG_INVALID_HANDLE;
diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
index 7bcb74d..e78fec1 100644
--- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
+++ b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
@@ -325,6 +325,36 @@ static const struct {
{ 0xffe8, Qt::Key_Meta },
{ 0xffe9, Qt::Key_Alt },
{ 0xffea, Qt::Key_Alt },
+
+ { 0xffb0, Qt::Key_0 },
+ { 0xffb1, Qt::Key_1 },
+ { 0xffb2, Qt::Key_2 },
+ { 0xffb3, Qt::Key_3 },
+ { 0xffb4, Qt::Key_4 },
+ { 0xffb5, Qt::Key_5 },
+ { 0xffb6, Qt::Key_6 },
+ { 0xffb7, Qt::Key_7 },
+ { 0xffb8, Qt::Key_8 },
+ { 0xffb9, Qt::Key_9 },
+
+ { 0xff8d, Qt::Key_Return },
+ { 0xffaa, Qt::Key_Asterisk },
+ { 0xffab, Qt::Key_Plus },
+ { 0xffad, Qt::Key_Minus },
+ { 0xffae, Qt::Key_Period },
+ { 0xffaf, Qt::Key_Slash },
+
+ { 0xff95, Qt::Key_Home },
+ { 0xff96, Qt::Key_Left },
+ { 0xff97, Qt::Key_Up },
+ { 0xff98, Qt::Key_Right },
+ { 0xff99, Qt::Key_Down },
+ { 0xff9a, Qt::Key_PageUp },
+ { 0xff9b, Qt::Key_PageDown },
+ { 0xff9c, Qt::Key_End },
+ { 0xff9e, Qt::Key_Insert },
+ { 0xff9f, Qt::Key_Delete },
+
{ 0, 0 }
};
@@ -483,6 +513,10 @@ bool QRfbKeyEvent::read(QTcpSocket *s)
keycode = keyMap[i].keycode;
i++;
}
+
+ if (keycode >= ' ' && keycode <= '~')
+ unicode = keycode;
+
if (!keycode) {
if (key <= 0xff) {
unicode = key;
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index c77f76d..1c19fab 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -219,6 +219,7 @@ private slots:
void inputMethodSensitivity();
void inputContextReset();
void indirectPainting();
+ void compositionModeInDrawBackground();
// task specific tests below me
void task172231_untransformableItems();
@@ -3825,6 +3826,39 @@ void tst_QGraphicsView::indirectPainting()
QTRY_VERIFY(scene.drawCount > 0);
}
+void tst_QGraphicsView::compositionModeInDrawBackground()
+{
+ class MyView : public QGraphicsView
+ { public:
+ MyView(QGraphicsScene *scene) : QGraphicsView(scene),
+ painted(false), compositionMode(QPainter::CompositionMode_SourceOver) {}
+ bool painted;
+ QPainter::CompositionMode compositionMode;
+ void drawBackground(QPainter *painter, const QRectF &)
+ {
+ compositionMode = painter->compositionMode();
+ painted = true;
+ }
+ };
+
+ QGraphicsScene dummy;
+ MyView view(&dummy);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ // Make sure the painter's composition mode is SourceOver in drawBackground.
+ QTRY_VERIFY(view.painted);
+ QCOMPARE(view.compositionMode, QPainter::CompositionMode_SourceOver);
+
+ view.painted = false;
+ view.setCacheMode(QGraphicsView::CacheBackground);
+ view.viewport()->update();
+
+ // Make sure the painter's composition mode is SourceOver in drawBackground
+ // with background cache enabled.
+ QTRY_VERIFY(view.painted);
+ QCOMPARE(view.compositionMode, QPainter::CompositionMode_SourceOver);
+}
void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
{
QGraphicsView view;
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index a316dda..b7e2c81 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -1968,6 +1968,10 @@ void tst_QVariant::operator_eq_eq_data()
QTest::newRow("HashSecondLarger") << QVariant(hash1) << QVariant(hash2) << false;
}
+
+ QTest::newRow( "UserType" ) << QVariant(QVariant::UserType) << QVariant(QVariant::UserType) << false;
+ QVariant mUserType(QVariant::UserType);
+ QTest::newRow( "Shared UserType" ) << mUserType << mUserType << true;
}
void tst_QVariant::operator_eq_eq()