| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2014 Laurent Montel <montel@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KPLURALHANDLINGSPINBOX_H |
| 8 | #define KPLURALHANDLINGSPINBOX_H |
| 9 | |
| 10 | #include <ktextwidgets_export.h> |
| 11 | |
| 12 | #if KTEXTWIDGETS_ENABLE_DEPRECATED_SINCE(6, 6) |
| 13 | #include <KLocalizedString> |
| 14 | |
| 15 | #include <QSpinBox> |
| 16 | |
| 17 | #include <memory> |
| 18 | |
| 19 | /*! |
| 20 | * \class KPluralHandlingSpinBox |
| 21 | * \inmodule KTextWidgets |
| 22 | * |
| 23 | * \brief A QSpinBox with plural handling for the suffix. |
| 24 | * |
| 25 | * \since 5.0 |
| 26 | * \deprecated[6.6] |
| 27 | * Use KLocalization::setupSpinBoxFormatString() from KF6::I18n instead, |
| 28 | * which is more powerful and does not require inheriting from a specific QSpinBox subclass. |
| 29 | */ |
| 30 | KTEXTWIDGETS_DEPRECATED_VERSION(6, 6, "use KLocalization::setupSpinBoxFormatString() from KF6::I18n instead" ) |
| 31 | class KTEXTWIDGETS_EXPORT KPluralHandlingSpinBox : public QSpinBox |
| 32 | { |
| 33 | Q_OBJECT |
| 34 | public: |
| 35 | /*! |
| 36 | * Default constructor |
| 37 | */ |
| 38 | explicit KPluralHandlingSpinBox(QWidget *parent = nullptr); |
| 39 | ~KPluralHandlingSpinBox() override; |
| 40 | |
| 41 | /*! |
| 42 | * Sets the suffix to \a suffix. |
| 43 | * Use this to add a plural-aware suffix, e.g. by using ki18np("singular", "plural"). |
| 44 | */ |
| 45 | void setSuffix(const KLocalizedString &suffix); |
| 46 | |
| 47 | private: |
| 48 | friend class KPluralHandlingSpinBoxPrivate; |
| 49 | std::unique_ptr<class KPluralHandlingSpinBoxPrivate> const d; |
| 50 | |
| 51 | Q_DISABLE_COPY(KPluralHandlingSpinBox) |
| 52 | }; |
| 53 | #endif |
| 54 | |
| 55 | #endif // KPLURALHANDLINGSPINBOX_H |
| 56 | |