File indexing completed on 2024-04-28 09:47:05

0001 /*
0002  *  SPDX-FileCopyrightText: 2002-2003 Jesper K. Pedersen <blackie@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-only
0005  **/
0006 #ifndef __selectablelineedit
0007 #define __selectablelineedit
0008 
0009 #include <QLineEdit>
0010 
0011 class RegExpWidget;
0012 
0013 /**
0014    A specialized QLineEdit for use in @ref TextWidget.
0015 
0016    This widget has two main features:
0017    @li when the @ref TextWidget which contains it is selected, then the
0018         line edit is grayed like the rest of the widgets.
0019    @li When the widget does not have the focus, it is resized to only be
0020         large enough to contain the text written in it.
0021 
0022    @internal
0023 */
0024 class SelectableLineEdit : public QLineEdit
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     explicit SelectableLineEdit(RegExpWidget *owner, QWidget *parent = nullptr, const QString &name = QString());
0030     void setSelected(bool selected);
0031     QSize sizeHint() const override;
0032 
0033 protected Q_SLOTS:
0034     void slotKeyPressed();
0035 
0036 Q_SIGNALS:
0037     void parentPleaseUpdate();
0038 
0039 private:
0040     RegExpWidget *_owner = nullptr;
0041 };
0042 
0043 #endif