KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
ObjectViewer.h
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2019 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: SĂ©rgio Martins <sergio.martins@kdab.com>
6
7 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
20#ifndef OBJECTVIEWER_H
21#define OBJECTVIEWER_H
22
23#include <QWidget>
24#include <QStandardItemModel>
25#include <QTreeView>
26#include <QPointer>
27#include <QObject>
28#include <QMenu>
29
30QT_BEGIN_NAMESPACE
31class QStandardItem;
32QT_END_NAMESPACE
33
34namespace KDDockWidgets {
35namespace Debug {
36
37class ObjectViewer : public QWidget // clazy:exclude=missing-qobject-macro
38{
39public:
40 explicit ObjectViewer(QWidget *parent = nullptr);
41
42 void refresh();
43
44private:
45 void dumpSelectedWidgetToPng();
46 void updateSelectedWidget();
47 void toggleVisible();
48 void dumpWindows();
49 QString nameForObj(QObject *o) const;
50 void add(QObject *obj, QStandardItem *parent);
51 void remove(QObject *obj);
52 void onSelectionChanged();
53 void printProperties(QObject *) const;
54 QObject *selectedObject() const;
55 QWidget *selectedWidget() const;
56 void updateItemAppearence(QStandardItem *);
57 QObject *objectForItem(QStandardItem *) const;
58 QWidget *widgetForItem(QStandardItem *) const;
59
60#ifdef Q_OS_WIN
61 void sendHitTest();
62#endif
63
64 QTreeView m_treeView;
65 QStandardItemModel m_model;
66 QPointer<QObject> m_selectedObject;
67 QMenu m_menu;
68 bool m_highlightsWidget = true;
69 bool m_ignoreMenus = true;
70 bool m_ignoreShortcuts = true;
71 bool m_ignoreToolBars = true;
73
74protected:
76 bool eventFilter(QObject *watched, QEvent *event) override;
77};
78}
79}
80
81#endif
bool eventFilter(QObject *watched, QEvent *event) override
void contextMenuEvent(QContextMenuEvent *event) override
Class to abstract QAction, so code still works with QtQuick and Flutter.
QObject * parent() const const
virtual bool event(QEvent *event) override

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated by doxygen 1.9.8