File indexing completed on 2024-04-14 03:56:08

0001 /*
0002     SPDX-FileCopyrightText: 2014 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef KPLURALHANDLINGSPINBOX_H
0008 #define KPLURALHANDLINGSPINBOX_H
0009 
0010 #include <ktextwidgets_export.h>
0011 
0012 #include <KLocalizedString>
0013 
0014 #include <QSpinBox>
0015 
0016 #include <memory>
0017 
0018 /**
0019  * @class KPluralHandlingSpinBox kpluralhandlingspinbox.h <KPluralHandlingSpinBox>
0020  *
0021  * @brief A QSpinBox with plural handling for the suffix.
0022  *
0023  * @author Laurent Montel <montel@kde.org>
0024  *
0025  * @since 5.0
0026  */
0027 class KTEXTWIDGETS_EXPORT KPluralHandlingSpinBox : public QSpinBox
0028 {
0029     Q_OBJECT
0030 public:
0031     /**
0032      * Default constructor
0033      */
0034 
0035     explicit KPluralHandlingSpinBox(QWidget *parent = nullptr);
0036     ~KPluralHandlingSpinBox() override;
0037 
0038     /**
0039      * Sets the suffix to @p suffix.
0040      * Use this to add a plural-aware suffix, e.g. by using ki18np("singular", "plural").
0041      */
0042     void setSuffix(const KLocalizedString &suffix);
0043 
0044 private:
0045     friend class KPluralHandlingSpinBoxPrivate;
0046     std::unique_ptr<class KPluralHandlingSpinBoxPrivate> const d;
0047 
0048     Q_DISABLE_COPY(KPluralHandlingSpinBox)
0049 };
0050 
0051 #endif // KPLURALHANDLINGSPINBOX_H