From 57b6629507e97c63cf2445eef12443dcb2639887 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 3 Mar 2010 15:41:38 +0100 Subject: Support keypad input with vnc driver Task-number: QT-1849 Reviewed-by: Jeremy --- src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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; -- cgit v0.12 From 13e08bb43bc7c972e77fc7b77ae5de14235cb897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 3 Mar 2010 15:54:54 +0100 Subject: Fixes wrong composition mode for cached backgrounds in Graphics View. This change partially reverts commit a589005f and therefore fully reverts 68be6457. We cannot assume that only opaque pixels are painted in drawBackground(). Regression against 4.5. Auto-test included. Task-number: QTBUG-8168 Reviewed-by: trond --- src/gui/graphicsview/qgraphicsview.cpp | 6 ----- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 34 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 6 deletions(-) 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/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; -- cgit v0.12 From e98d4aece51fa8691cf33325ab96634fcf9baa81 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 3 Mar 2010 17:37:09 +0100 Subject: Fix compositing when QWS background is completely transparent. Specifying the wrong composition mode triggered an optimization which caused uninitialized values to be blended in. Task-number: QTBUG-6625, QTBUG-6906 Reviewed-by: Samuel --- src/gui/embedded/qscreen_qws.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()) { -- cgit v0.12 From a4d7572059b5b56d49d7e0c3f3466686e1dc6e16 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 3 Mar 2010 20:47:13 +0100 Subject: QVariant: Fix crash when comparing two variant with the same undefined type. If the type is the same, but not registered, the returned string could be null (or empty if a empty string was registered) In that case, QVariant compare() function would access invalid memory. Protect against that case. qstrcmp returns 0 if 0 is given as a parametter. Task-number: QTBUG-8700 Reviewed-by: Markus Goetz --- src/corelib/kernel/qvariant.cpp | 3 ++- tests/auto/qvariant/tst_qvariant.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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(a_ptr) == *static_cast(b_ptr); return a_ptr == b_ptr; 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() -- cgit v0.12 From 60a0a4bb680d9f3780cadd25b834492171ef7d38 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 4 Mar 2010 09:36:12 +1000 Subject: Remove vgClearPath() change to OpenVG paint engine Upon further investigation, vgClearPath() doesn't help as much on target devices as just making a new path. Revert "Improve performance of VGPath creation by reusing the same path" This reverts commit 8597e03495f54614e53c6063f1f13077a08109fd. --- src/openvg/qpaintengine_vg.cpp | 124 +++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 67 deletions(-) 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 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 coords; QVarLengthArray 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 coords; QVarLengthArray 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; -- cgit v0.12 From e3fb16c08a0b219703c6d3ca47d0c62bafdd013c Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 4 Mar 2010 16:35:07 +1000 Subject: SqlBrowser not respecting casings. A previous fix broke assumed behaviour. Make it do the correct thing, ie we know the casing, so quote it to tell the system leave it be. Task-number: QTBUG-4001 --- demos/sqlbrowser/browser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()); -- cgit v0.12 From 2aaf4d1a35792ba7d0d0f217dbda1c1297389f3e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 4 Mar 2010 11:55:46 +0100 Subject: Fix tst_QVariant::operator_eq_eq(UserType) It was comparing uninitialized memory. Reviewed-by: Thierry --- src/corelib/kernel/qvariant.cpp | 3 +++ tests/auto/qvariant/tst_qvariant.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 95b2352..9a278bd 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -470,6 +470,9 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) if (typeNameLen > 0 && typeName[typeNameLen - 1] == '*') return *static_cast(a_ptr) == *static_cast(b_ptr); + if (a->is_null && b->is_null) + return true; + return a_ptr == b_ptr; } diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index b7e2c81..1fd6564 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -1969,7 +1969,7 @@ 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; + QTest::newRow( "UserType" ) << QVariant(QVariant::UserType) << QVariant(QVariant::UserType) << true; QVariant mUserType(QVariant::UserType); QTest::newRow( "Shared UserType" ) << mUserType << mUserType << true; } -- cgit v0.12 From a9bf9766f18e15fbecf53ac1cc9cf57c9dba259c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 4 Mar 2010 12:06:19 +0100 Subject: Fixed an exit crash that could occur in the GL 2 engine under X11. The global destructor for the clean up hooks might be called before the global destructor for QPixmap objects. We shouldn't leave pixmaps around that is destroyed after the QApplication destructor is called. Task-number: QTBUG-8681 Reviewed-by: Tom Cooksey --- src/gui/image/qimagepixmapcleanuphooks.cpp | 10 ++++++++++ src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 1 + 2 files changed, 11 insertions(+) diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index 517fcb0..521e348 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -96,6 +96,11 @@ void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook) void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* pmd) { QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); + // the global destructor for the pixmap and image hooks might have + // been called already if the app is "leaking" global + // pixmaps/images + if (!h) + return; for (int i = 0; i < h->pixmapModificationHooks.count(); ++i) h->pixmapModificationHooks[i](pmd); @@ -106,6 +111,11 @@ void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* p void QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(QPixmapData* pmd) { QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); + // the global destructor for the pixmap and image hooks might have + // been called already if the app is "leaking" global + // pixmaps/images + if (!h) + return; for (int i = 0; i < h->pixmapDestructionHooks.count(); ++i) h->pixmapDestructionHooks[i](pmd); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index c08d04a..2b8e097 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1597,6 +1597,7 @@ bool QGL2PaintEngineEx::end() delete d->shaderManager; d->shaderManager = 0; + d->currentBrush = QBrush(); #ifdef QT_OPENGL_CACHE_AS_VBOS if (!d->unusedVBOSToClean.isEmpty()) { -- cgit v0.12 From f1e39e7dea8634695263435f0bf912ce19c43195 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Thu, 4 Mar 2010 13:16:09 +0100 Subject: Make tablet detection work with new wacom drivers wacom driver fixed a bug in assigning atom names where it messed up the device names. Their solution apparently renamed the atoms The type names used now are "STYLUS", "CURSOR", "ERASER", "PAD" and "TOUCH" for each respective device. This change detects those as our tablet input devices. Reviewed-by: Benjamin Poulain Task-number: QTBUG-8599 --- src/gui/kernel/qapplication_x11.cpp | 9 +++++++-- src/gui/kernel/qt_x11_p.h | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 121e9ec..25a7750 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -320,9 +320,14 @@ static const char * x11_atomnames = { "_XEMBED\0" "_XEMBED_INFO\0" + // Wacom old. (before version 0.10) "Wacom Stylus\0" "Wacom Cursor\0" "Wacom Eraser\0" + + // Tablet + "STYLUS\0" + "ERASER\0" }; Q_GUI_EXPORT QX11Data *qt_x11Data = 0; @@ -2366,12 +2371,12 @@ void qt_init(QApplicationPrivate *priv, int, gotStylus = true; } #else - if (devs->type == ATOM(XWacomStylus)) { + if (devs->type == ATOM(XWacomStylus) || devs->type == ATOM(XTabletStylus)) { deviceType = QTabletEvent::Stylus; if (wacomDeviceName()->isEmpty()) wacomDeviceName()->append(devs->name); gotStylus = true; - } else if (devs->type == ATOM(XWacomEraser)) { + } else if (devs->type == ATOM(XWacomEraser) || devs->type == ATOM(XTabletEraser)) { deviceType = QTabletEvent::XFreeEraser; gotEraser = true; } diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index d110084..14e04bb 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -675,6 +675,9 @@ struct QX11Data XWacomCursor, XWacomEraser, + XTabletStylus, + XTabletEraser, + NPredefinedAtoms, _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, -- cgit v0.12