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 #ifndef OBJECTTRACKING_H 0021 #define OBJECTTRACKING_H 0022 0023 #include <QObject> 0024 #include <QSet> 0025 0026 #include "kobjecttracking_export.h" 0027 0028 class ObjectDebug; 0029 0030 class KOBJECTTRACKING_EXPORT ObjectTracking : public QObject 0031 { 0032 Q_OBJECT 0033 public: 0034 ObjectTracking(QObject* parent = nullptr); 0035 ~ObjectTracking() override; 0036 0037 /** If it's easier to use it as a singleton, it's also possible */ 0038 static ObjectTracking* self(); 0039 0040 enum Option { 0041 Watch = 1, 0042 Track = 2 0043 }; 0044 Q_ENUM(Option); 0045 Q_DECLARE_FLAGS(Options, Option) 0046 0047 enum Depth { 0048 Alone, 0049 Inherit 0050 }; 0051 Q_ENUM(Depth); 0052 0053 void track(QObject* object, Options options, Depth depth); 0054 0055 private: 0056 QSet<QPointer<ObjectDebug>> m_used; 0057 }; 0058 0059 Q_DECLARE_OPERATORS_FOR_FLAGS(ObjectTracking::Options) 0060 0061 #endif