File indexing completed on 2025-03-02 04:16:29
0001 /* 0002 * SPDX-FileCopyrightText: 2011 Kare Sars <kare.sars@iki.fi> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef KSANE_OPTION_WIDGET_H 0008 #define KSANE_OPTION_WIDGET_H 0009 0010 // Qt includes 0011 #include <QWidget> 0012 #include <QLabel> 0013 #include <QGridLayout> 0014 0015 #include <KSaneCore/Option> 0016 0017 namespace KSaneIface 0018 { 0019 0020 /** 0021 *@author Kåre Särs 0022 */ 0023 0024 /** 0025 * Base class for option widgets 0026 */ 0027 class KSaneOptionWidget : public QWidget 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 /** 0033 * Create the Widget. 0034 * \param parent parent widget 0035 * \param labelText text. 0036 */ 0037 KSaneOptionWidget(QWidget *parent, const QString &labelText); 0038 0039 KSaneOptionWidget(QWidget *parent, KSaneCore::Option *option); 0040 ~KSaneOptionWidget() override; 0041 0042 void setLabelText(const QString &text); 0043 0044 int labelWidthHint(); 0045 void setLabelWidth(int labelWidth); 0046 0047 protected Q_SLOTS: 0048 void updateVisibility(); 0049 0050 protected: 0051 void initWidget(); 0052 0053 QLabel *m_label; 0054 QGridLayout *m_layout; 0055 KSaneCore::Option *m_option = nullptr; 0056 }; 0057 0058 } // NameSpace KSaneIface 0059 0060 #endif // KSANE_OPTION_WIDGET_H