QDateTimeEdit: remove homebrew 'reverse' algorithm
Use std::reverse Change-Id: Ia922f3e05e100587f0e7bc91bb1a95679bc03896 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
3a33ee78c9
commit
f217894152
@ -52,6 +52,8 @@
|
||||
#include <qset.h>
|
||||
#include <qstyle.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_DATETIMEEDIT
|
||||
|
||||
//#define QDATETIMEEDIT_QDTEDEBUG
|
||||
@ -861,14 +863,6 @@ QString QDateTimeEdit::displayFormat() const
|
||||
return isRightToLeft() ? d->unreversedFormat : d->displayFormat;
|
||||
}
|
||||
|
||||
template<typename C> static inline C reverse(const C &l)
|
||||
{
|
||||
C ret;
|
||||
for (int i=l.size() - 1; i>=0; --i)
|
||||
ret.append(l.at(i));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void QDateTimeEdit::setDisplayFormat(const QString &format)
|
||||
{
|
||||
Q_D(QDateTimeEdit);
|
||||
@ -882,8 +876,8 @@ void QDateTimeEdit::setDisplayFormat(const QString &format)
|
||||
d->displayFormat += d->sectionNode(i).format();
|
||||
}
|
||||
d->displayFormat += d->separators.at(0);
|
||||
d->separators = reverse(d->separators);
|
||||
d->sectionNodes = reverse(d->sectionNodes);
|
||||
std::reverse(d->separators.begin(), d->separators.end());
|
||||
std::reverse(d->sectionNodes.begin(), d->sectionNodes.end());
|
||||
}
|
||||
|
||||
d->formatExplicitlySet = true;
|
||||
|
Loading…
Reference in New Issue
Block a user