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 | #include <KLocalizedString> |
13 | |
14 | #include <QSpinBox> |
15 | |
16 | #include <memory> |
17 | |
18 | /** |
19 | * @class KPluralHandlingSpinBox kpluralhandlingspinbox.h <KPluralHandlingSpinBox> |
20 | * |
21 | * @brief A QSpinBox with plural handling for the suffix. |
22 | * |
23 | * @author Laurent Montel <montel@kde.org> |
24 | * |
25 | * @since 5.0 |
26 | */ |
27 | class KTEXTWIDGETS_EXPORT KPluralHandlingSpinBox : public QSpinBox |
28 | { |
29 | Q_OBJECT |
30 | public: |
31 | /** |
32 | * Default constructor |
33 | */ |
34 | |
35 | explicit KPluralHandlingSpinBox(QWidget *parent = nullptr); |
36 | ~KPluralHandlingSpinBox() override; |
37 | |
38 | /** |
39 | * Sets the suffix to @p suffix. |
40 | * Use this to add a plural-aware suffix, e.g. by using ki18np("singular", "plural"). |
41 | */ |
42 | void setSuffix(const KLocalizedString &suffix); |
43 | |
44 | private: |
45 | friend class KPluralHandlingSpinBoxPrivate; |
46 | std::unique_ptr<class KPluralHandlingSpinBoxPrivate> const d; |
47 | |
48 | Q_DISABLE_COPY(KPluralHandlingSpinBox) |
49 | }; |
50 | |
51 | #endif // KPLURALHANDLINGSPINBOX_H |
52 | |