File indexing completed on 2025-03-09 04:09:47
0001 /** =========================================================== 0002 * @file 0003 * 0004 * This file is a part of digiKam project 0005 * <a href="https://www.digikam.org">https://www.digikam.org</a> 0006 * 0007 * @date 2008-08-16 0008 * @brief Integer and double num input widget 0009 * re-implemented with a reset button to switch to 0010 * a default value 0011 * 0012 * @author Copyright (C) 2008-2015 by Gilles Caulier 0013 * <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a> 0014 * 0015 * This program is free software; you can redistribute it 0016 * and/or modify it under the terms of the GNU General 0017 * Public License as published by the Free Software Foundation; 0018 * either version 2, or (at your option) 0019 * any later version. 0020 * 0021 * This program is distributed in the hope that it will be useful, 0022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0024 * GNU General Public License for more details. 0025 * 0026 * ============================================================ */ 0027 0028 #ifndef RNUMINPUT_H 0029 #define RNUMINPUT_H 0030 0031 // Qt includes 0032 0033 #include <QWidget> 0034 0035 // Local includes 0036 0037 0038 0039 namespace KDcrawIface 0040 { 0041 0042 class RIntNumInput : public QWidget 0043 { 0044 Q_OBJECT 0045 0046 public: 0047 0048 RIntNumInput(QWidget* const parent=0); 0049 ~RIntNumInput() override; 0050 0051 void setRange(int min, int max, int step); 0052 0053 void setDefaultValue(int d); 0054 int defaultValue() const; 0055 int value() const; 0056 0057 void setSuffix(const QString& suffix); 0058 0059 Q_SIGNALS: 0060 0061 void reset(); 0062 void valueChanged(int); 0063 0064 public Q_SLOTS: 0065 0066 void setValue(int d); 0067 void slotReset(); 0068 0069 private Q_SLOTS: 0070 0071 void slotValueChanged(int); 0072 0073 private: 0074 0075 class Private; 0076 Private* const d; 0077 }; 0078 0079 // --------------------------------------------------------- 0080 0081 class RDoubleNumInput : public QWidget 0082 { 0083 Q_OBJECT 0084 0085 public: 0086 0087 RDoubleNumInput(QWidget* const parent=0); 0088 ~RDoubleNumInput() override; 0089 0090 void setDecimals(int p); 0091 void setRange(double min, double max, double step); 0092 0093 void setDefaultValue(double d); 0094 double defaultValue() const; 0095 double value() const; 0096 0097 void setSuffix(const QString& suffix); 0098 0099 Q_SIGNALS: 0100 0101 void reset(); 0102 void valueChanged(double); 0103 0104 public Q_SLOTS: 0105 0106 void setValue(double d); 0107 void slotReset(); 0108 0109 private Q_SLOTS: 0110 0111 void slotValueChanged(double); 0112 0113 private: 0114 0115 class Private; 0116 Private* const d; 0117 }; 0118 0119 } // namespace KDcrawIface 0120 0121 #endif /* RNUMINPUT_H */