File indexing completed on 2024-05-19 04:56:13
0001 /** 0002 * \file debugutils.h 0003 * Utility functions for debugging. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 13 Jan 2013 0008 * 0009 * Copyright (C) 2013-2024 Urs Fleisch 0010 * 0011 * This file is part of Kid3. 0012 * 0013 * Kid3 is free software; you can redistribute it and/or modify 0014 * it under the terms of the GNU General Public License as published by 0015 * the Free Software Foundation; either version 2 of the License, or 0016 * (at your option) any later version. 0017 * 0018 * Kid3 is distributed in the hope that it will be useful, 0019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0021 * GNU General Public License for more details. 0022 * 0023 * You should have received a copy of the GNU General Public License 0024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0025 */ 0026 0027 #pragma once 0028 0029 #include <QObject> 0030 #include <QModelIndex> 0031 #include "kid3api.h" 0032 0033 class QAbstractItemModel; 0034 0035 namespace DebugUtils { 0036 0037 /** 0038 * Displays information about signals emitted by an object. 0039 */ 0040 class KID3_CORE_EXPORT SignalEmissionDumper : public QObject { 0041 Q_OBJECT 0042 public: 0043 /** 0044 * Constructor. 0045 * @param parent parent object 0046 */ 0047 explicit SignalEmissionDumper(QObject* parent = nullptr); 0048 0049 /** 0050 * Destructor. 0051 */ 0052 ~SignalEmissionDumper() override = default; 0053 0054 /** 0055 * Monitor signal emissions of object 0056 * @param obj object to monitor 0057 */ 0058 void connectObject(QObject* obj); 0059 0060 private slots: 0061 void printSignal(); 0062 }; 0063 0064 #ifndef QT_NO_DEBUG 0065 0066 /** 0067 * Dump an item model. 0068 * @param model item model to dump 0069 * @param parent parent model index 0070 * @param indent number of spaces to indent 0071 */ 0072 void KID3_CORE_EXPORT dumpModel(const QAbstractItemModel& model, 0073 const QModelIndex& parent = QModelIndex(), int indent = 0); 0074 0075 #endif 0076 0077 }