Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F37954722
pluralhandlingspinbox.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
pluralhandlingspinbox.cpp
View Options
/*
SPDX-FileCopyrightText: 2014 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
This is a copy of KPluralHandlingSpinBox from KTextWidgets.
*/
#include
"pluralhandlingspinbox.h"
class
PluralHandlingSpinBoxPrivate
{
public
:
PluralHandlingSpinBoxPrivate
(
QSpinBox
*
q
)
:
q
(
q
)
{
QObject
::
connect
(
q
,
&
QSpinBox
::
valueChanged
,
q
,
[
this
](
int
value
)
{
updateSuffix
(
value
);
});
}
void
updateSuffix
(
int
value
)
{
if
(
!
pluralSuffix
.
isEmpty
())
{
KLocalizedString
s
=
pluralSuffix
;
q
->
setSuffix
(
s
.
subs
(
value
).
toString
());
}
}
QSpinBox
*
const
q
;
KLocalizedString
pluralSuffix
;
};
PluralHandlingSpinBox
::
PluralHandlingSpinBox
(
QWidget
*
parent
)
:
QSpinBox
(
parent
)
,
d
(
new
PluralHandlingSpinBoxPrivate
(
this
))
{
}
PluralHandlingSpinBox
::~
PluralHandlingSpinBox
()
=
default
;
void
PluralHandlingSpinBox
::
setSuffix
(
const
KLocalizedString
&
suffix
)
{
d
->
pluralSuffix
=
suffix
;
if
(
suffix
.
isEmpty
())
{
QSpinBox
::
setSuffix
(
QString
());
}
else
{
d
->
updateSuffix
(
value
());
}
}
#include
"moc_pluralhandlingspinbox.cpp"
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Thu, Mar 19, 6:01 PM (15 h, 32 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d9/14/c04033c275ce278d99d293ee7afb
Attached To
rKLEOPATRA Kleopatra
Event Timeline
Log In to Comment