diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-24 20:29:41 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-24 20:29:41 (GMT) |
commit | 675188b766b7b0f7eb65c2e9f3ee7d6017e63453 (patch) | |
tree | 5b7c0b514a5918a7a4719db4f76d0f5e86ebb225 /src | |
parent | 1e55b0ecf415d023bbb5f291a2f26ba50c1a508b (diff) | |
parent | a60940d89cf7bf075e5b1f2055d63477d1187125 (diff) | |
download | Qt-675188b766b7b0f7eb65c2e9f3ee7d6017e63453.zip Qt-675188b766b7b0f7eb65c2e9f3ee7d6017e63453.tar.gz Qt-675188b766b7b0f7eb65c2e9f3ee7d6017e63453.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Stabilize tst_qgraphicsscene
QDeclarativeDebug: send a message when new object are added
QDeclarativeEngineDebugServer: make it a singleton.
Fix mispositioned text with QStaticText and OpenVG graphics system
Use binarysort to find items.
QGraphicsView: Fix assert that may occurs if there are 'empty' item to draw, and changed() signal connected
Fix tst_Collections::QTBUG13079_collectionInsideCollection
Fix assignment of a Q(Explicitly)SharedDataPointer included in the data itself
Fix assignment of a container included in the container itself
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qhash.h | 5 | ||||
-rw-r--r-- | src/corelib/tools/qlinkedlist.h | 5 | ||||
-rw-r--r-- | src/corelib/tools/qlist.h | 5 | ||||
-rw-r--r-- | src/corelib/tools/qmap.h | 5 | ||||
-rw-r--r-- | src/corelib/tools/qshareddata.h | 20 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 5 | ||||
-rw-r--r-- | src/declarative/debugger/qdeclarativedebug.cpp | 2 | ||||
-rw-r--r-- | src/declarative/debugger/qdeclarativedebug_p.h | 3 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecomponent.cpp | 8 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 7 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeenginedebug.cpp | 23 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeenginedebug_p.h | 9 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 7 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 19 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 24 |
16 files changed, 105 insertions, 46 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 0777f06..c7e4bc1 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -589,10 +589,11 @@ template <class Key, class T> Q_INLINE_TEMPLATE QHash<Key, T> &QHash<Key, T>::operator=(const QHash<Key, T> &other) { if (d != other.d) { - other.d->ref.ref(); + QHashData *o = other.d; + o->ref.ref(); if (!d->ref.deref()) freeData(d); - d = other.d; + d = o; if (!d->sharable) detach_helper(); } diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index d145fe3..9b3efa3 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -312,10 +312,11 @@ template <typename T> QLinkedList<T> &QLinkedList<T>::operator=(const QLinkedList<T> &l) { if (d != l.d) { - l.d->ref.ref(); + QLinkedListData *o = l.d; + o->ref.ref(); if (!d->ref.deref()) free(d); - d = l.d; + d = o; if (!d->sharable) detach_helper(); } diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 722744c..d843cbe 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -424,10 +424,11 @@ template <typename T> Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l) { if (d != l.d) { - l.d->ref.ref(); + QListData::Data *o = l.d; + o->ref.ref(); if (!d->ref.deref()) free(d); - d = l.d; + d = o; if (!d->sharable) detach_helper(); } diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index e4b73a1..1c2aad3 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -426,10 +426,11 @@ template <class Key, class T> Q_INLINE_TEMPLATE QMap<Key, T> &QMap<Key, T>::operator=(const QMap<Key, T> &other) { if (d != other.d) { - other.d->ref.ref(); + QMapData* o = other.d; + o->ref.ref(); if (!d->ref.deref()) freeData(d); - d = other.d; + d = o; if (!d->sharable) detach_helper(); } diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 7e9934d..6483c90 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -95,9 +95,10 @@ public: if (o.d != d) { if (o.d) o.d->ref.ref(); - if (d && !d->ref.deref()) - delete d; + T *old = d; d = o.d; + if (old && !old->ref.deref()) + delete old; } return *this; } @@ -105,9 +106,10 @@ public: if (o != d) { if (o) o->ref.ref(); - if (d && !d->ref.deref()) - delete d; + T *old = d; d = o; + if (old && !old->ref.deref()) + delete old; } return *this; } @@ -174,9 +176,10 @@ public: if (o.d != d) { if (o.d) o.d->ref.ref(); - if (d && !d->ref.deref()) - delete d; + T *old = d; d = o.d; + if (old && !old->ref.deref()) + delete old; } return *this; } @@ -184,9 +187,10 @@ public: if (o != d) { if (o) o->ref.ref(); - if (d && !d->ref.deref()) - delete d; + T *old = d; d = o; + if (old && !old->ref.deref()) + delete old; } return *this; } diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index c2e2485..b762b8a 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -377,10 +377,11 @@ inline void QVector<T>::replace(int i, const T &t) template <typename T> QVector<T> &QVector<T>::operator=(const QVector<T> &v) { - v.d->ref.ref(); + QVectorData *o = v.d; + o->ref.ref(); if (!d->ref.deref()) free(p); - d = v.d; + d = o; if (!d->sharable) detach_helper(); return *this; diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp index 154df51..1ffe441 100644 --- a/src/declarative/debugger/qdeclarativedebug.cpp +++ b/src/declarative/debugger/qdeclarativedebug.cpp @@ -340,6 +340,8 @@ void QDeclarativeEngineDebugPrivate::message(const QByteArray &data) if (!watch) return; emit watch->valueChanged(name, value); + } else if (type == "OBJECT_CREATED") { + emit q_func()->newObjects(); } } diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h index 2e79c5d..f0fc488 100644 --- a/src/declarative/debugger/qdeclarativedebug_p.h +++ b/src/declarative/debugger/qdeclarativedebug_p.h @@ -99,6 +99,9 @@ public: bool resetBindingForObject(int objectDebugId, const QString &propertyName); bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody); +Q_SIGNALS: + void newObjects(); + private: Q_DECLARE_PRIVATE(QDeclarativeEngineDebug) }; diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 15cef16..d2d1f19 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -54,6 +54,7 @@ #include "private/qdeclarativeglobal_p.h" #include "private/qdeclarativescriptparser_p.h" #include "private/qdeclarativedebugtrace_p.h" +#include "private/qdeclarativeenginedebug_p.h" #include <QStack> #include <QStringList> @@ -765,8 +766,11 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons QObject *rv = begin(ctxt, ep, cc, start, count, &state, bindings); - if (rv && !context->isInternal && ep->isDebugging) - context->asQDeclarativeContextPrivate()->instances.append(rv); + if (ep->isDebugging && rv) { + if (!context->isInternal) + context->asQDeclarativeContextPrivate()->instances.append(rv); + QDeclarativeEngineDebugServer::instance()->objectCreated(engine, rv); + } return rv; } diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 4e45636..c5a5c18 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -438,8 +438,6 @@ void QDeclarativeEnginePrivate::clear(SimpleList<QDeclarativeParserStatus> &pss) pss.clear(); } -Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); - void QDeclarativePrivate::qdeclarativeelement_destructor(QObject *o) { QObjectPrivate *p = QObjectPrivate::get(o); @@ -481,9 +479,8 @@ void QDeclarativeEnginePrivate::init() if (QCoreApplication::instance()->thread() == q->thread() && QDeclarativeEngineDebugServer::isDebuggingEnabled()) { - qmlEngineDebugServer(); isDebugging = true; - QDeclarativeEngineDebugServer::addEngine(q); + QDeclarativeEngineDebugServer::instance()->addEngine(q); } } @@ -547,7 +544,7 @@ QDeclarativeEngine::~QDeclarativeEngine() { Q_D(QDeclarativeEngine); if (d->isDebugging) - QDeclarativeEngineDebugServer::remEngine(this); + QDeclarativeEngineDebugServer::instance()->remEngine(this); } /*! \fn void QDeclarativeEngine::quit() diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 688e0fc..ed28185 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -58,7 +58,13 @@ QT_BEGIN_NAMESPACE -QList<QDeclarativeEngine *> QDeclarativeEngineDebugServer::m_engines; +Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); + +QDeclarativeEngineDebugServer *QDeclarativeEngineDebugServer::instance() +{ + return qmlEngineDebugServer(); +} + QDeclarativeEngineDebugServer::QDeclarativeEngineDebugServer(QObject *parent) : QDeclarativeDebugService(QLatin1String("QDeclarativeEngine"), parent), m_watch(new QDeclarativeWatcher(this)) @@ -598,4 +604,19 @@ void QDeclarativeEngineDebugServer::remEngine(QDeclarativeEngine *engine) m_engines.removeAll(engine); } +void QDeclarativeEngineDebugServer::objectCreated(QDeclarativeEngine *engine, QObject *object) +{ + Q_ASSERT(engine); + Q_ASSERT(m_engines.contains(engine)); + + int engineId = QDeclarativeDebugService::idForObject(engine); + int objectId = QDeclarativeDebugService::idForObject(object); + + QByteArray reply; + QDataStream rs(&reply, QIODevice::WriteOnly); + + rs << QByteArray("OBJECT_CREATED") << engineId << objectId; + sendMessage(reply); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h index aa450f3..613f1fe 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/qml/qdeclarativeenginedebug_p.h @@ -92,8 +92,11 @@ public: bool hasNotifySignal; }; - static void addEngine(QDeclarativeEngine *); - static void remEngine(QDeclarativeEngine *); + void addEngine(QDeclarativeEngine *); + void remEngine(QDeclarativeEngine *); + void objectCreated(QDeclarativeEngine *, QObject *); + + static QDeclarativeEngineDebugServer *instance(); protected: virtual void messageReceived(const QByteArray &); @@ -111,7 +114,7 @@ private: void resetBinding(int objectId, const QString &propertyName); void setMethodBody(int objectId, const QString &method, const QString &body); - static QList<QDeclarativeEngine *> m_engines; + QList<QDeclarativeEngine *> m_engines; QDeclarativeWatcher *m_watch; }; Q_DECLARATIVE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectData &); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a98ce6f..3c23884 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5126,7 +5126,9 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool q->update(itemBoundingRect.translated(item->d_ptr->sceneTransform.dx(), item->d_ptr->sceneTransform.dy())); } else { - q->update(item->d_ptr->sceneTransform.mapRect(itemBoundingRect)); + QRectF rect = item->d_ptr->sceneTransform.mapRect(itemBoundingRect); + if (!rect.isEmpty()) + q->update(rect); } } else { QRectF dirtyRect; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index b694d9c..be90006 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5862,10 +5862,13 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText return; } - if (d->extended->type() == QPaintEngine::OpenGL2 && !staticText_d->untransformedCoordinates) { + bool paintEngineSupportsTransformations = d->extended->type() == QPaintEngine::OpenGL2 + || d->extended->type() == QPaintEngine::OpenVG; + + if (paintEngineSupportsTransformations && !staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = true; staticText_d->needsRelayout = true; - } else if (d->extended->type() != QPaintEngine::OpenGL2 && staticText_d->untransformedCoordinates) { + } else if (!paintEngineSupportsTransformations && staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = false; staticText_d->needsRelayout = true; } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 5670e29..8d6dd6c 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1561,14 +1561,19 @@ bool QTextEngine::isRightToLeft() const int QTextEngine::findItem(int strPos) const { itemize(); - - // ##### use binary search - int item; - for (item = layoutData->items.size()-1; item > 0; --item) { - if (layoutData->items[item].position <= strPos) - break; + int left = 0; + int right = layoutData->items.size()-1; + while(left <= right) { + int middle = ((right-left)/2)+left; + if (strPos > layoutData->items[middle].position) + left = middle+1; + else if(strPos < layoutData->items[middle].position) + right = middle-1; + else { + return middle; + } } - return item; + return right; } QFixed QTextEngine::width(int from, int len) const diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 7d5fa43..f432b7e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1217,7 +1217,7 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang bool hasText = (selection.format.foreground().style() != Qt::NoBrush); bool hasBackground= (selection.format.background().style() != Qt::NoBrush); - + if (hasBackground) { selection.format.setProperty(ObjectSelectionBrush, selection.format.property(QTextFormat::BackgroundBrush)); // don't just clear the property, set an empty brush that overrides a potential @@ -1731,7 +1731,7 @@ namespace { }; inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line) -{ +{ LB_DEBUG("possible break width %f, spacew=%f", tmpData.textWidth.toReal(), spaceData.textWidth.toReal()); QFixed newWidth = calculateNewWidth(line); @@ -1797,13 +1797,23 @@ void QTextLine::layout_helper(int maxGlyphs) bool breakany = (wrapMode == QTextOption::WrapAnywhere); lbh.manualWrap = (wrapMode == QTextOption::ManualWrap || wrapMode == QTextOption::NoWrap); - // #### binary search! int item = -1; - int newItem; - for (newItem = eng->layoutData->items.size()-1; newItem > 0; --newItem) { - if (eng->layoutData->items[newItem].position <= line.from) + int newItem = -1; + int left = 0; + int right = eng->layoutData->items.size()-1; + while(left <= right) { + int middle = ((right-left)/2)+left; + if (line.from > eng->layoutData->items[middle].position) + left = middle+1; + else if(line.from < eng->layoutData->items[middle].position) + right = middle-1; + else { + newItem = middle; break; + } } + if (newItem == -1) + newItem = right; LB_DEBUG("from: %d: item=%d, total %d, width available %f", line.from, newItem, eng->layoutData->items.size(), line.width.toReal()); @@ -1975,7 +1985,7 @@ void QTextLine::layout_helper(int maxGlyphs) } LB_DEBUG("reached end of line"); lbh.checkFullOtherwiseExtend(line); -found: +found: if (lbh.rightBearing > 0 && !lbh.whiteSpaceOrObject) // If right bearing has not yet been adjusted lbh.adjustRightBearing(); line.textAdvance = line.textWidth; |