File indexing completed on 2024-05-19 05:28:50

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