diff options
Diffstat (limited to 'src/charts/axis/qabstractaxis.cpp')
-rw-r--r-- | src/charts/axis/qabstractaxis.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/charts/axis/qabstractaxis.cpp b/src/charts/axis/qabstractaxis.cpp index 73fa5920..bf7d7dfb 100644 --- a/src/charts/axis/qabstractaxis.cpp +++ b/src/charts/axis/qabstractaxis.cpp @@ -368,6 +368,12 @@ QT_CHARTS_BEGIN_NAMESPACE */ /*! + \fn void QAbstractAxis::labelsEditableChanged(bool editable) + \since 5.13 + This signal is emitted when the labels editability changes. +*/ + +/*! \fn void QAbstractAxis::gridVisibleChanged(bool visible) This signal is emitted when the visibility of the grid lines of the axis changes to \a visible. */ @@ -948,6 +954,39 @@ bool QAbstractAxis::isReverse() const return d_ptr->m_reverse; } +/*! + Sets axis labels editability to \a editable. + + When the labels are editable the user will be able to change the range of the + axis conveniently by editing any of the labels. This feature is only supported + for the QValueAxis and the QDateTimeAxis. + + By default, labels are not editable. + \since 5.13 +*/ +void QAbstractAxis::setLabelsEditable(bool editable) +{ + if (d_ptr->m_labelsEditable != editable) { + // In the case if the axis already added to a chart + // set the labels editability on the axisItem(). + // Otherwise the labels editability will be set in the + // QValueAxisPrivate::initializeGraphics. + if (d_ptr->axisItem() != nullptr) + d_ptr->axisItem()->setLabelsEditable(editable); + d_ptr->m_labelsEditable = editable; + emit labelsEditableChanged(editable); + } +} + +/*! + Returns \c true if axis labels are editable. + \since 5.13 +*/ +bool QAbstractAxis::labelsEditable() const +{ + return d_ptr->m_labelsEditable; +} + void QAbstractAxis::setReverse(bool reverse) { if (d_ptr->m_reverse != reverse && type() != QAbstractAxis::AxisTypeBarCategory) { @@ -972,6 +1011,7 @@ QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q) m_minorGridLineVisible(true), m_minorGridLinePen(QChartPrivate::defaultPen()), m_labelsVisible(true), + m_labelsEditable(false), m_labelsBrush(QChartPrivate::defaultBrush()), m_labelsFont(QChartPrivate::defaultFont()), m_labelsAngle(0), |