summaryrefslogtreecommitdiffstats
path: root/tools/shared
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-01-08 10:53:28 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-01-08 10:53:28 (GMT)
commit2e62227f950aac8205f2b67e4d7d046836b2c799 (patch)
tree87e91115d86896949f69e8c8d993ba795422ef3b /tools/shared
parent9b0502aa6abf6bb9c07f205bccdf2d9c65027bde (diff)
parent118e7a807d0764dee97612589fe5d7072d271e1e (diff)
downloadQt-2e62227f950aac8205f2b67e4d7d046836b2c799.zip
Qt-2e62227f950aac8205f2b67e4d7d046836b2c799.tar.gz
Qt-2e62227f950aac8205f2b67e4d7d046836b2c799.tar.bz2
Merge branch '4.6'
Conflicts: src/corelib/io/qfsfileengine.cpp src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/opengl.pro
Diffstat (limited to 'tools/shared')
-rw-r--r--tools/shared/qtpropertybrowser/qteditorfactory.cpp3
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp21
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h3
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertymanager.cpp45
4 files changed, 53 insertions, 19 deletions
diff --git a/tools/shared/qtpropertybrowser/qteditorfactory.cpp b/tools/shared/qtpropertybrowser/qteditorfactory.cpp
index 17c5be8..ed74439 100644
--- a/tools/shared/qtpropertybrowser/qteditorfactory.cpp
+++ b/tools/shared/qtpropertybrowser/qteditorfactory.cpp
@@ -1158,6 +1158,7 @@ QWidget *QtDateEditFactory::createEditor(QtDatePropertyManager *manager, QtPrope
QWidget *parent)
{
QDateEdit *editor = d_ptr->createEditor(property, parent);
+ editor->setDisplayFormat(QtPropertyBrowserUtils::dateFormat());
editor->setCalendarPopup(true);
editor->setDateRange(manager->minimum(property), manager->maximum(property));
editor->setDate(manager->value(property));
@@ -1272,6 +1273,7 @@ QWidget *QtTimeEditFactory::createEditor(QtTimePropertyManager *manager, QtPrope
QWidget *parent)
{
QTimeEdit *editor = d_ptr->createEditor(property, parent);
+ editor->setDisplayFormat(QtPropertyBrowserUtils::timeFormat());
editor->setTime(manager->value(property));
connect(editor, SIGNAL(timeChanged(QTime)),
@@ -1385,6 +1387,7 @@ QWidget *QtDateTimeEditFactory::createEditor(QtDateTimePropertyManager *manager,
QtProperty *property, QWidget *parent)
{
QDateTimeEdit *editor = d_ptr->createEditor(property, parent);
+ editor->setDisplayFormat(QtPropertyBrowserUtils::dateTimeFormat());
editor->setDateTime(manager->value(property));
connect(editor, SIGNAL(dateTimeChanged(QDateTime)),
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),
diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
index 09d29ae..358f9f4 100644
--- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
+++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
@@ -94,6 +94,9 @@ public:
static QPixmap fontValuePixmap(const QFont &f);
static QIcon fontValueIcon(const QFont &f);
static QString fontValueText(const QFont &f);
+ static QString dateFormat();
+ static QString timeFormat();
+ static QString dateTimeFormat();
};
class QtBoolEdit : public QWidget {
diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
index a26dcda..fbad0ca 100644
--- a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
+++ b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
@@ -1553,6 +1553,7 @@ class QtDatePropertyManagerPrivate
QtDatePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtDatePropertyManager)
public:
+ explicit QtDatePropertyManagerPrivate(QtDatePropertyManager *q);
struct Data
{
@@ -1573,6 +1574,12 @@ public:
QMap<const QtProperty *, Data> m_values;
};
+QtDatePropertyManagerPrivate::QtDatePropertyManagerPrivate(QtDatePropertyManager *q) :
+ q_ptr(q),
+ m_format(QtPropertyBrowserUtils::dateFormat())
+{
+}
+
/*!
\class QtDatePropertyManager
\internal
@@ -1622,12 +1629,8 @@ public:
Creates a manager with the given \a parent.
*/
QtDatePropertyManager::QtDatePropertyManager(QObject *parent)
- : QtAbstractPropertyManager(parent), d_ptr(new QtDatePropertyManagerPrivate)
+ : QtAbstractPropertyManager(parent), d_ptr(new QtDatePropertyManagerPrivate(this))
{
- d_ptr->q_ptr = this;
-
- QLocale loc;
- d_ptr->m_format = loc.dateFormat(QLocale::ShortFormat);
}
/*!
@@ -1786,13 +1789,20 @@ class QtTimePropertyManagerPrivate
QtTimePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtTimePropertyManager)
public:
+ explicit QtTimePropertyManagerPrivate(QtTimePropertyManager *q);
- QString m_format;
+ const QString m_format;
typedef QMap<const QtProperty *, QTime> PropertyValueMap;
PropertyValueMap m_values;
};
+QtTimePropertyManagerPrivate::QtTimePropertyManagerPrivate(QtTimePropertyManager *q) :
+ q_ptr(q),
+ m_format(QtPropertyBrowserUtils::timeFormat())
+{
+}
+
/*!
\class QtTimePropertyManager
\internal
@@ -1825,12 +1835,8 @@ public:
Creates a manager with the given \a parent.
*/
QtTimePropertyManager::QtTimePropertyManager(QObject *parent)
- : QtAbstractPropertyManager(parent), d_ptr(new QtTimePropertyManagerPrivate)
+ : QtAbstractPropertyManager(parent), d_ptr(new QtTimePropertyManagerPrivate(this))
{
- d_ptr->q_ptr = this;
-
- QLocale loc;
- d_ptr->m_format = loc.timeFormat(QLocale::ShortFormat);
}
/*!
@@ -1903,13 +1909,20 @@ class QtDateTimePropertyManagerPrivate
QtDateTimePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtDateTimePropertyManager)
public:
+ explicit QtDateTimePropertyManagerPrivate(QtDateTimePropertyManager *q);
- QString m_format;
+ const QString m_format;
typedef QMap<const QtProperty *, QDateTime> PropertyValueMap;
PropertyValueMap m_values;
};
+QtDateTimePropertyManagerPrivate::QtDateTimePropertyManagerPrivate(QtDateTimePropertyManager *q) :
+ q_ptr(q),
+ m_format(QtPropertyBrowserUtils::dateTimeFormat())
+{
+}
+
/*! \class QtDateTimePropertyManager
\internal
\inmodule QtDesigner
@@ -1938,14 +1951,8 @@ public:
Creates a manager with the given \a parent.
*/
QtDateTimePropertyManager::QtDateTimePropertyManager(QObject *parent)
- : QtAbstractPropertyManager(parent), d_ptr(new QtDateTimePropertyManagerPrivate)
+ : QtAbstractPropertyManager(parent), d_ptr(new QtDateTimePropertyManagerPrivate(this))
{
- d_ptr->q_ptr = this;
-
- QLocale loc;
- d_ptr->m_format = loc.dateFormat(QLocale::ShortFormat);
- d_ptr->m_format += QLatin1Char(' ');
- d_ptr->m_format += loc.timeFormat(QLocale::ShortFormat);
}
/*!