File indexing completed on 2024-05-12 05:53:36
0001 /* 0002 SPDX-FileCopyrightText: 2006-2008 Robert Knight <robertknight@gmail.com> 0003 SPDX-FileCopyrightText: 1997, 1998 Lars Doelle <lars.doelle@on-line.de> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef COMPOSITEWIDGET_H 0009 #define COMPOSITEWIDGET_H 0010 0011 #include <QWidget> 0012 0013 namespace Konsole 0014 { 0015 // Watches compositeWidget and all its focusable children, 0016 // and emits focusChanged() signal when either compositeWidget's 0017 // or a child's focus changed. 0018 // Limitation: children added after the object was created 0019 // will not be registered. 0020 class CompositeWidgetFocusWatcher : public QObject 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 explicit CompositeWidgetFocusWatcher(QWidget *compositeWidget); 0026 bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE; 0027 0028 Q_SIGNALS: 0029 void compositeFocusChanged(bool focused); 0030 0031 private: 0032 void registerWidgetAndChildren(QWidget *widget); 0033 }; 0034 0035 } // namespace Konsole 0036 0037 #endif // COMPOSITEWIDGET_H