summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTero Ahola <tero.ahola@digia.com>2012-09-06 12:35:48 +0300
committerTero Ahola <tero.ahola@digia.com>2012-09-06 14:44:00 +0300
commitdf31e46fa48c59c23918696ef05d39e8e7b17257 (patch)
treeecc0d612e5178304574ef62622933981de70c9d9 /src
parent4e1c0d187ea1c715e15a8db9160e7f090043f70f (diff)
Property for QDateTimeAxis::format and a QML demo for axes
Diffstat (limited to 'src')
-rw-r--r--src/axis/datetimeaxis/qdatetimeaxis.cpp38
-rw-r--r--src/axis/datetimeaxis/qdatetimeaxis.h2
2 files changed, 28 insertions, 12 deletions
diff --git a/src/axis/datetimeaxis/qdatetimeaxis.cpp b/src/axis/datetimeaxis/qdatetimeaxis.cpp
index 60f96b54..78ad8b0d 100644
--- a/src/axis/datetimeaxis/qdatetimeaxis.cpp
+++ b/src/axis/datetimeaxis/qdatetimeaxis.cpp
@@ -72,6 +72,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
/*!
\qmlclass DateTimeAxis QDateTimeAxis
\brief The DateTimeAxis element is used for manipulating chart's axes
+ \inherits AbstractAxis
The labels can be configured by setting an appropriate DateTime format.
Note that any date before 4714 BCE or after about 1.4 million CE may not be accurately stored.
@@ -129,11 +130,31 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty int ValuesAxis::tickCount
+ \qmlproperty int DateTimeAxis::tickCount
The number of tick marks for the axis.
*/
/*!
+ \property QDateTimeAxis::format
+ The format string that is used when creating label for the axis out of a QDateTime object.
+ Check QDateTime documentation for information on how the string should be defined.
+*/
+/*!
+ \qmlproperty string DateTimeAxis::format
+ The format string that is used when creating label for the axis out of a QDateTime object.
+ Check QDateTime documentation for information on how the string should be defined.
+*/
+
+/*!
+ \fn void QDateTimeAxis::formatChanged(QString format)
+ Axis emits signal when \a format of the axis has changed.
+*/
+/*!
+ \qmlsignal DateTimeAxis::onFormatChanged(string format)
+ Axis emits signal when \a format of the axis has changed.
+*/
+
+/*!
Constructs an axis object which is a child of \a parent.
*/
QDateTimeAxis::QDateTimeAxis(QObject *parent) :
@@ -213,22 +234,15 @@ void QDateTimeAxis::setRange(QDateTime min, QDateTime max)
}
}
-/*!
- Sets \a format string that is used when creating label for the axis out of the QDateTime object.
- Check QDateTime documentation for information on how the string should be defined.
- \sa format()
-*/
void QDateTimeAxis::setFormat(QString format)
{
Q_D(QDateTimeAxis);
- d->m_format = format;
+ if (d->m_format != format) {
+ d->m_format = format;
+ emit formatChanged(format);
+ }
}
-/*!
- Returns the format string that is used when creating label for the axis out of the QDateTime object.
- Check QDateTime documentation for information on how the string should be defined.
- \sa setFormat()
-*/
QString QDateTimeAxis::format() const
{
Q_D(const QDateTimeAxis);
diff --git a/src/axis/datetimeaxis/qdatetimeaxis.h b/src/axis/datetimeaxis/qdatetimeaxis.h
index 5b47f080..fbf45579 100644
--- a/src/axis/datetimeaxis/qdatetimeaxis.h
+++ b/src/axis/datetimeaxis/qdatetimeaxis.h
@@ -35,6 +35,7 @@ class QTCOMMERCIALCHART_EXPORT QDateTimeAxis : public QAbstractAxis
Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount)
Q_PROPERTY(QDateTime min READ min WRITE setMin NOTIFY minChanged)
Q_PROPERTY(QDateTime max READ max WRITE setMax NOTIFY maxChanged)
+ Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
public:
explicit QDateTimeAxis(QObject *parent = 0);
@@ -64,6 +65,7 @@ Q_SIGNALS:
void minChanged(QDateTime min);
void maxChanged(QDateTime max);
void rangeChanged(QDateTime min, QDateTime max);
+ void formatChanged(QString format);
private:
Q_DECLARE_PRIVATE(QDateTimeAxis)