Search
SailfishOS Open Build Service
>
Projects
>
home:kaltsi
:
tnhlbug
>
qt
> 0029-Add-internal-qt_qmlIdForObject-to-retrieve-the-id-fo.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0029-Add-internal-qt_qmlIdForObject-to-retrieve-the-id-fo.patch of Package qt
From ab151c88c5a89b8808d1c8a9869b9060e9836747 Mon Sep 17 00:00:00 2001 From: Robin Burchell <robin+qt@viroteck.net> Date: Fri, 8 Mar 2013 11:00:28 +0200 Subject: [PATCH 29/29] Add internal qt_qmlIdForObject to retrieve the id for a given QObject in a context. This is useful for testing frameworks built around QML. Change-Id: I37e57f2c1e758f6e999c72e95d2df538faee5d36 --- src/declarative/qml/qdeclarativecontext.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index bbdbb34..2b47ae3 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -58,6 +58,21 @@ QT_BEGIN_NAMESPACE +class QDeclarativeExposedContext : public QDeclarativeContext +{ +public: + static QDeclarativeContextPrivate *expose_dptr(QDeclarativeContext *c) + { + return static_cast<QDeclarativeContextPrivate *>(reinterpret_cast<QDeclarativeExposedContext*>(c)->d_ptr.data()); + } +}; + +Q_GUI_EXPORT QString qt_qmlIdForObject(QDeclarativeContext *context, QObject *obj) +{ + QDeclarativeContextPrivate *d_ptr = QDeclarativeExposedContext::expose_dptr(context); + return d_ptr->data->findObjectId(obj); +} + QDeclarativeContextPrivate::QDeclarativeContextPrivate() : data(0), notifyIndex(-1) { -- 1.7.10.3