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