File indexing completed on 2024-05-12 16:02:29

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Alvin Wong <alvin@alvinhc.com>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #ifndef KIS_POPUP_SELF_ACTIVATING_LINE_EDIT_H
0008 #define KIS_POPUP_SELF_ACTIVATING_LINE_EDIT_H
0009 
0010 #include <QLineEdit>
0011 
0012 #include <kritawidgetutils_export.h>
0013 
0014 
0015 // HACK: This QLineEdit calls `QWidget::activateWindow` on focus if it is
0016 // housed inside a Qt::Popup, in order to work around a bug causing input
0017 // methods to not work in it.
0018 // See https://bugs.kde.org/show_bug.cgi?id=395598
0019 class KRITAWIDGETUTILS_EXPORT KisPopupSelfActivatingLineEdit : public QLineEdit
0020 {
0021     Q_OBJECT
0022     
0023 public:
0024     KisPopupSelfActivatingLineEdit(QWidget *parent = nullptr);
0025     virtual ~KisPopupSelfActivatingLineEdit();
0026 
0027 protected:
0028     void focusInEvent(QFocusEvent *e) override;
0029 };
0030 
0031 #endif // KIS_POPUP_SELF_ACTIVATING_LINE_EDIT_H