Warning, file /libraries/libqaccessibilityclient/examples/accessibleapps/eventview.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2012 Frederik Gladhorn <gladhorn@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef EVENTVIEW_H 0008 #define EVENTVIEW_H 0009 0010 #include <QTimer> 0011 #include <QBoxLayout> 0012 #include <QAccessible> 0013 0014 #include "qaccessibilityclient/registry.h" 0015 #include "qaccessibilityclient/accessibleobject.h" 0016 0017 #include "ui_eventview.h" 0018 0019 class QStandardItem; 0020 class QSettings; 0021 0022 class EventsModel; 0023 class EventsProxyModel; 0024 0025 class EventsWidget :public QWidget 0026 { 0027 Q_OBJECT 0028 public: 0029 enum EventType { 0030 NoEvents = 0x00, 0031 StateChanged = 0x01, 0032 NameChanged = 0x02, 0033 DescriptionChanged = 0x04, 0034 Window = 0x08, 0035 Focus = 0x10, 0036 Document = 0x20, 0037 Object = 0x40, 0038 Text = 0x80, 0039 Table = 0x100, 0040 0041 0042 0043 Others = 0x100000, 0044 0045 AllEvents = 0xffff 0046 }; 0047 Q_DECLARE_FLAGS(EventTypes, EventType) 0048 Q_ENUM(EventType) 0049 Q_ENUM(EventTypes) 0050 0051 QString eventName(EventType eventType) const; 0052 0053 explicit EventsWidget(QAccessibleClient::Registry *registry, QWidget *parent = nullptr); 0054 0055 void loadSettings(QSettings &settings); 0056 void saveSettings(QSettings &settings); 0057 0058 void addLog(const QAccessibleClient::AccessibleObject &object, EventType eventType, const QString &text = QString()); 0059 0060 Q_SIGNALS: 0061 void anchorClicked(const QUrl &); 0062 0063 public Q_SLOTS: 0064 void checkStateChanged(); 0065 private Q_SLOTS: 0066 void installUpdateHandler(); 0067 void clearLog(); 0068 void processPending(); 0069 void eventActivated(const QModelIndex &index); 0070 void accessibleFilterChanged(); 0071 void roleFilterChanged(); 0072 private: 0073 QAccessibleClient::Registry *m_registry; 0074 Ui::EventViewWidget m_ui; 0075 EventsModel *m_model; 0076 EventsProxyModel *m_proxyModel; 0077 QTimer m_pendingTimer; 0078 QVector< QList<QStandardItem*> > m_pendingLogs; 0079 0080 // This is to avoid sending updates for the events view. 0081 // The reason is that we end up in endless loops with other accessible tools such as accerciser. 0082 // No normal application should have to do this. 0083 static void customUpdateHandler(QAccessibleEvent *event); 0084 static QAccessible::UpdateHandler m_originalAccessibilityUpdateHandler; 0085 static QObject *m_textEditForAccessibilityUpdateHandler; 0086 }; 0087 0088 Q_DECLARE_METATYPE(EventsWidget::EventType) 0089 Q_DECLARE_METATYPE(EventsWidget::EventTypes) 0090 0091 #endif