1 /********* 2 * 3 * In the name of the Father, and of the Son, and of the Holy Spirit. 4 * 5 * This file is part of BibleTime's source code, http://www.bibletime.info/. 6 * 7 * Copyright 1999-2016 by the BibleTime developers. 8 * The BibleTime source code is licensed under the GNU General Public License 9 * version 2.0. 10 * 11 **********/ 12 13 #include "findqmlobject.h" 14 15 #include <QQuickItem> 16 #include "mobile/btmmain.h" 17 #include "mobile/ui/qtquick2applicationviewer.h" 18 #include "mobile/ui/viewmanager.h" 19 #include "util/btassert.h" 20 21 namespace btm { 22 findQmlObject(const QString & objectName)23QQuickItem* findQmlObject(const QString& objectName) { 24 25 QtQuick2ApplicationViewer* viewer = getViewManager()->getViewer(); 26 QQuickItem * rootObject = nullptr; 27 if (viewer != nullptr) 28 rootObject = viewer->rootObject(); 29 QQuickItem* object = nullptr; 30 if (rootObject != nullptr) 31 object = rootObject->findChild<QQuickItem*>(objectName); 32 BT_ASSERT(object); 33 return object; 34 } 35 36 } 37