Changeset View
Changeset View
Standalone View
Standalone View
src/editors/sizefedit.cpp
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project | ||
---|---|---|---|---|---|
2 | Copyright (C) 2008-2015 Jarosław Staniek <staniek@kde.org> | 2 | Copyright (C) 2008-2017 Jarosław Staniek <staniek@kde.org> | ||
3 | 3 | | |||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public | ||
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. | ||
8 | 8 | | |||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Library General Public License for more details. | 12 | Library General Public License for more details. | ||
13 | 13 | | |||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "sizefedit.h" | 20 | #include "sizefedit.h" | ||
21 | #include "KPropertyUtils_p.h" | ||||
21 | 22 | | |||
22 | #include <QSize> | 23 | #include <QSize> | ||
23 | 24 | | |||
24 | KPropertySizeFDelegate::KPropertySizeFDelegate() | 25 | KPropertySizeFDelegate::KPropertySizeFDelegate() | ||
25 | { | 26 | { | ||
26 | } | 27 | } | ||
27 | 28 | | |||
29 | QString KPropertySizeFDelegate::propertyValueToString(const KProperty *property, | ||||
30 | const QLocale &locale) const | ||||
31 | { | ||||
32 | const KPropertyUtilsPrivate::ValueOptionsHandler options(*property); | ||||
33 | return options.valueWithPrefixAndSuffix(valueToString(property->value(), locale), locale); | ||||
34 | } | ||||
35 | | ||||
28 | QString KPropertySizeFDelegate::valueToString(const QVariant& value, const QLocale &locale) const | 36 | QString KPropertySizeFDelegate::valueToString(const QVariant& value, const QLocale &locale) const | ||
29 | { | 37 | { | ||
30 | const QSizeF s(value.toSizeF()); | 38 | const QSizeF s(value.toSizeF()); | ||
31 | if (s.isNull()) { | 39 | if (s.isNull()) { | ||
32 | if (locale.language() == QLocale::C) { | 40 | if (locale.language() == QLocale::C) { | ||
33 | return QString(); | 41 | return QString(); | ||
34 | } | 42 | } | ||
35 | return QObject::tr("None", "Null value"); | 43 | return QObject::tr("None", "Null value"); | ||
Show All 39 Lines |