File indexing completed on 2024-04-28 13:38:15

0001 /*
0002  *   Copyright 2017 by Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library General Public License as
0006  *   published by the Free Software Foundation; either version 2, or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 #include "objecttracking.h"
0021 #include "objectdebug.h"
0022 
0023 ObjectTracking::ObjectTracking(QObject* parent)
0024     : QObject(parent)
0025 {}
0026 
0027 ObjectTracking * ObjectTracking::self()
0028 {
0029     static ObjectTracking self;
0030     return &self;
0031 }
0032 
0033 ObjectTracking::~ObjectTracking()
0034 {
0035     qDeleteAll(m_used);
0036 }
0037 
0038 void ObjectTracking::track(QObject* object, ObjectTracking::Options options, ObjectTracking::Depth depth)
0039 {
0040     auto od = ObjectDebug::qmlAttachedProperties(object);
0041     od->setWatch(options & Watch);
0042     od->setTimeTracker(options & Track);
0043     od->setInherit(depth == Inherit);
0044 }