QValue3DAxisFormatter Class

QValue3DAxisFormatter is base class for value axis formatters. More...

Header: #include <QValue3DAxisFormatter>
Since: QtDataVisualization 1.1
Instantiated By: ValueAxis3DFormatter
Inherits: QObject
Inherited By:

QLogValue3DAxisFormatter

Public Functions

QValue3DAxisFormatter(QObject *parent = Q_NULLPTR)
virtual ~QValue3DAxisFormatter()
  • 31 public functions inherited from QObject

Protected Functions

bool allowNegatives() const
bool allowZero() const
QValue3DAxis *axis() const
virtual QValue3DAxisFormatter *createNewInstance() const
QVector<float> &gridPositions() const
QVector<float> &labelPositions() const
QStringList &labelStrings() const
QLocale locale() const
void markDirty(bool labelsChange = false)
virtual void populateCopy(QValue3DAxisFormatter &copy) const
virtual float positionAt(float value) const
virtual void recalculate()
void setAllowNegatives(bool allow)
void setAllowZero(bool allow)
void setLocale(const QLocale &locale)
virtual QString stringForValue(qreal value, const QString &format) const
QVector<float> &subGridPositions() const
virtual float valueAt(float position) const
  • 9 protected functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 2 signals inherited from QObject
  • 11 static public members inherited from QObject

Detailed Description

QValue3DAxisFormatter is base class for value axis formatters.

This class provides formatting rules for a linear QValue3DAxis. Subclass it if you want to implement custom value axes.

The base class has no public API beyond constructors and destructors. It is meant to be only used internally. However, subclasses may implement public properties as needed.

See also QLogValue3DAxisFormatter.

Member Function Documentation

QValue3DAxisFormatter::QValue3DAxisFormatter(QObject *parent = Q_NULLPTR)

Constructs a new QValue3DAxisFormatter instance with an optional parent.

[virtual] QValue3DAxisFormatter::~QValue3DAxisFormatter()

Destroys QValue3DAxisFormatter.

[protected] bool QValue3DAxisFormatter::allowNegatives() const

Returns true if negative values are valid values for parent axis. The default implementation always returns true.

See also setAllowNegatives().

[protected] bool QValue3DAxisFormatter::allowZero() const

Returns true if zero is a valid value for parent axis. The default implementation always returns true.

See also setAllowZero().

[protected] QValue3DAxis *QValue3DAxisFormatter::axis() const

Returns the parent axis. The parent axis must only be accessed in recalculate() method to maintain thread safety in environments using a threaded renderer.

See also recalculate().

[virtual protected] QValue3DAxisFormatter *QValue3DAxisFormatter::createNewInstance() const

Creates a new empty instance of this formatter. Must be reimplemented in a subclass.

Returns the new instance. The renderer uses this method to cache a copy of the the formatter. The ownership of the new copy transfers to the caller.

[protected] QVector<float> &QValue3DAxisFormatter::gridPositions() const

Returns a reference to the array of normalized grid line positions. The default array size is equal to the segment count of the parent axis plus one, but a subclassed implementation of recalculate method may resize the array differently. The values should be between 0.0 (for minimum value) and 1.0 (for maximum value), inclusive.

See also QValue3DAxis::segmentCount and recalculate().

[protected] QVector<float> &QValue3DAxisFormatter::labelPositions() const

Returns a reference to the array of normalized label positions. The default array size is equal to the segment count of the parent axis plus one, but a subclassed implementation of recalculate method may resize the array differently. The values should be between 0.0 (for minimum value) and 1.0 (for maximum value), inclusive. The default behavior is that the label at the index zero corresponds to the minimum value of the axis.

See also QValue3DAxis::segmentCount, QAbstract3DAxis::labels, and recalculate().

[protected] QStringList &QValue3DAxisFormatter::labelStrings() const

Returns a reference to the string list containing formatter label strings. The array size must be equal to the size of the label positions array and the indexes correspond to that array as well.

See also labelPositions().

[protected] QLocale QValue3DAxisFormatter::locale() const

Returns the current locale this formatter is using.

See also setLocale().

[protected] void QValue3DAxisFormatter::markDirty(bool labelsChange = false)

Marks this formatter dirty, prompting the renderer to make a new copy of its cache on the next renderer synchronization. This method should be called by a subclass whenever the formatter is changed in a way that affects the resolved values. Specify true for labelsChange parameter if the change was such that it requires regenerating the parent axis label strings.

[virtual protected] void QValue3DAxisFormatter::populateCopy(QValue3DAxisFormatter &copy) const

Copies all necessary values for resolving positions, values, and strings with this formatter from this formatter to the copy. When reimplementing this method in a subclass, call the the superclass version at some point. The renderer uses this method to cache a copy of the the formatter.

Returns the new copy. The ownership of the new copy transfers to the caller.

[virtual protected] float QValue3DAxisFormatter::positionAt(float value) const

Reimplement this method if the position cannot be resolved by linear interpolation between the parent axis minimum and maximum values.

Returns the normalized position along the axis for the given value. The returned value should be between 0.0 (for minimum value) and 1.0 (for maximum value), inclusive, if the value is within the parent axis range.

See also recalculate() and valueAt().

[virtual protected] void QValue3DAxisFormatter::recalculate()

This method resizes and populates the label and grid line position arrays and the label strings array, as well as calculates any values needed for mapping between value and position. It is allowed to access the parent axis from inside this function.

This method must be reimplemented in a subclass if the default array contents are not suitable.

See gridPositions(), subGridPositions(), labelPositions(), and labelStrings() methods for documentation about the arrays that need to be resized and populated.

See also gridPositions(), subGridPositions(), labelPositions(), labelStrings(), and axis().

[protected] void QValue3DAxisFormatter::setAllowNegatives(bool allow)

Allow the parent axis to have negative values if allow is true.

See also allowNegatives().

[protected] void QValue3DAxisFormatter::setAllowZero(bool allow)

Allow the parent axis to have zero value if allow is true.

See also allowZero().

[protected] void QValue3DAxisFormatter::setLocale(const QLocale &locale)

Sets the locale that this formatter uses. The graph automatically sets the formatter's locale to a graph's locale whenever the parent axis is set as an active axis of the graph, the axis formatter is set to an axis attached to the graph, or the graph's locale changes.

See also locale() and QAbstract3DGraph::locale.

[virtual protected] QString QValue3DAxisFormatter::stringForValue(qreal value, const QString &format) const

This method is used to format a string using the specified value and the specified format. Reimplement this method in a subclass to resolve the formatted string for a given value if the default formatting rules specified for QValue3DAxis::labelFormat property are not sufficient.

Returns the formatted label string using a value and a format.

See also recalculate(), labelStrings(), and QValue3DAxis::labelFormat.

[protected] QVector<float> &QValue3DAxisFormatter::subGridPositions() const

Returns a reference to the array of normalized subgrid line positions. The default array size is equal to segment count of the parent axis times sub-segment count of the parent axis minus one, but a subclassed implementation of recalculate method may resize the array differently. The values should be between 0.0 (for minimum value) and 1.0 (for maximum value), inclusive.

See also QValue3DAxis::segmentCount, QValue3DAxis::subSegmentCount, and recalculate().

[virtual protected] float QValue3DAxisFormatter::valueAt(float position) const

Reimplement this method if the value cannot be resolved by linear interpolation between the parent axis minimum and maximum values.

Returns the value at the normalized position along the axis. The position value should be between 0.0 (for minimum value) and 1.0 (for maximum value), inclusive to obtain values within the parent axis range.

See also recalculate() and positionAt().

© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.