From 7e7d1f5a796d6dc2878a630252142ea191e57501 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 1 Sep 2013 17:58:52 +0200 Subject: Introduce QAbstractTextDocumentLayout::unregisterHandler() Required for QQuickText & friends to implement image resource handling in a clean way - to get rid of QQuickTextDocumentWithImageResources and eventually make QQuickTextEdit's document interchangeable. Change-Id: I12305b68065a5990997ca4a47821fd29e0e17476 Reviewed-by: Konstantin Ritt Reviewed-by: Simon Hausmann --- src/gui/text/qabstracttextdocumentlayout.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/gui/text/qabstracttextdocumentlayout.cpp') diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp index e051178a47..b8f5aa70a9 100644 --- a/src/gui/text/qabstracttextdocumentlayout.cpp +++ b/src/gui/text/qabstracttextdocumentlayout.cpp @@ -436,6 +436,24 @@ void QAbstractTextDocumentLayout::registerHandler(int objectType, QObject *compo d->handlers.insert(objectType, h); } +/*! + \since 5.2 + + Unregisters the given \a component as a handler for items of the given \a objectType, or + any handler if the \a component is not specified. +*/ +void QAbstractTextDocumentLayout::unregisterHandler(int objectType, QObject *component) +{ + Q_D(QAbstractTextDocumentLayout); + + HandlerHash::iterator it = d->handlers.find(objectType); + if (it != d->handlers.end() && (!component || component == it->component)) { + if (component) + disconnect(component, SIGNAL(destroyed(QObject*)), this, SLOT(_q_handlerDestroyed(QObject*))); + d->handlers.erase(it); + } +} + /*! Returns a handler for objects of the given \a objectType. */ -- cgit v1.2.3