File indexing completed on 2024-05-12 04:33:22

0001 /*
0002  * SPDX-FileCopyrightText: 2007-2011 Kare Sars <kare.sars@iki .fi>
0003  * SPDX-FileCopyrightText: 2014 Gregor Mitsch : port to KDE5 frameworks
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006  */
0007 
0008 #ifndef LABELED_ENTRY_H
0009 #define LABELED_ENTRY_H
0010 
0011 #include "ksaneoptionwidget.h"
0012 
0013 /**
0014  *@author Kåre Särs
0015  */
0016 
0017 class QPushButton;
0018 class QLineEdit;
0019 
0020 namespace KSaneIface
0021 {
0022 
0023 /**
0024  * A text entry field with a set and reset button
0025  */
0026 class LabeledEntry : public KSaneOptionWidget
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031 
0032     /**
0033      * Create the entry.
0034      *
0035      * \param parent parent widget
0036      * \param text is the text describing the entry.
0037      */
0038     LabeledEntry(QWidget *parent, const QString &text);
0039     LabeledEntry(QWidget *parent, KSaneCore::Option *option);
0040     ~LabeledEntry() override;
0041     void setText(const QString &text);
0042 
0043 private Q_SLOTS:
0044 
0045     void setClicked();
0046     void resetClicked();
0047     void setValue(const QVariant &value);
0048 
0049 Q_SIGNALS:
0050 
0051     void entryEdited(const QString &text);
0052 
0053 private:
0054     void initEntry();
0055 
0056     QLineEdit *m_entry;
0057     QPushButton *m_set;
0058     QPushButton *m_reset;
0059     QString m_eText;
0060 };
0061 
0062 }  // NameSpace KSaneIface
0063 
0064 #endif // LABELED_ENTRY_H