File indexing completed on 2024-05-19 05:35:23
0001 #ifndef oxygenwidgetexplorer_h 0002 #define oxygenwidgetexplorer_h 0003 0004 ////////////////////////////////////////////////////////////////////////////// 0005 // oxygenwidgetexplorer.h 0006 // print widget's and parent's information on mouse click 0007 // ------------------- 0008 // 0009 // SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0010 // 0011 // SPDX-License-Identifier: MIT 0012 ////////////////////////////////////////////////////////////////////////////// 0013 0014 #include <QEvent> 0015 #include <QMap> 0016 #include <QObject> 0017 #include <QSet> 0018 #include <QWidget> 0019 0020 namespace Oxygen 0021 { 0022 //* print widget's and parent's information on mouse click 0023 class WidgetExplorer : public QObject 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 //* constructor 0029 explicit WidgetExplorer(QObject *); 0030 0031 //* enable 0032 bool enabled(void) const; 0033 0034 //* enable 0035 void setEnabled(bool); 0036 0037 //* widget rects 0038 void setDrawWidgetRects(bool value) 0039 { 0040 _drawWidgetRects = value; 0041 } 0042 0043 //* event filter 0044 bool eventFilter(QObject *, QEvent *) override; 0045 0046 private: 0047 //* event type 0048 QString eventType(const QEvent::Type &) const; 0049 0050 //* print widget information 0051 QString widgetInformation(const QWidget *) const; 0052 0053 //* enable state 0054 bool _enabled = false; 0055 0056 //* widget rects 0057 bool _drawWidgetRects = false; 0058 0059 //* map event types to string 0060 QMap<QEvent::Type, QString> _eventTypes; 0061 }; 0062 } 0063 0064 #endif