summaryrefslogtreecommitdiffstats
path: root/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-01-04 13:29:34 (GMT)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-01-04 13:29:34 (GMT)
commit00db09c55f60f160e625c3488784b0965ab636b4 (patch)
treead9976124ad978d0afd5ff2cf2ae8a47dd895b3c /tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
parent5b0945acef6895d4147b81dcda7cdce89c3a981a (diff)
downloadQt-00db09c55f60f160e625c3488784b0965ab636b4.zip
Qt-00db09c55f60f160e625c3488784b0965ab636b4.tar.gz
Qt-00db09c55f60f160e625c3488784b0965ab636b4.tar.bz2
Designer: Enable seconds editing for Q[Date]TimeEdit's properties.
on UNIX, for which QLocale's ShortFormat does not include seconds. Move format creation into browser utilities and use consistently for display and editing. Reviewed-by: Jarek Kobus <jkobus@trolltech.com> Task-number: QTBUG-6965
Diffstat (limited to 'tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp')
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
index 9e0421f..63e4a63 100644
--- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
+++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
@@ -47,6 +47,7 @@
#include <QtGui/QCheckBox>
#include <QtGui/QLineEdit>
#include <QtGui/QMenu>
+#include <QtCore/QLocale>
QT_BEGIN_NAMESPACE
@@ -208,6 +209,26 @@ QString QtPropertyBrowserUtils::fontValueText(const QFont &f)
.arg(f.pointSize());
}
+QString QtPropertyBrowserUtils::dateFormat()
+{
+ QLocale loc;
+ return loc.dateFormat(QLocale::ShortFormat);
+}
+
+QString QtPropertyBrowserUtils::timeFormat()
+{
+ QLocale loc;
+ // ShortFormat is missing seconds on UNIX.
+ return loc.timeFormat(QLocale::LongFormat);
+}
+
+QString QtPropertyBrowserUtils::dateTimeFormat()
+{
+ QString format = dateFormat();
+ format += QLatin1Char(' ');
+ format += timeFormat();
+ return format;
+}
QtBoolEdit::QtBoolEdit(QWidget *parent) :
QWidget(parent),