QAbstractAxis Class
The QAbstractAxis class is a base class used for specialized axis classes. More...
| Header: | #include <QAbstractAxis> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
| qmake: | QT += graphs |
| Instantiated By: | AbstractAxis |
| Inherits: | QObject |
| Inherited By: | |
| Status: | Technical Preview |
- List of all members, including inherited members
- QAbstractAxis is part of Qt Graphs 2D C++ Classes.
Public Types
| enum | AxisType { AxisTypeNoAxis, AxisTypeValue, AxisTypeBarCategory, AxisTypeCategory, AxisTypeDateTime, …, AxisTypeColor } |
| flags | AxisTypes |
Properties
|
|
Public Functions
| virtual | ~QAbstractAxis() |
| Qt::Alignment | alignment() const |
| void | hide() |
| bool | isGridLineVisible() const |
| bool | isLineVisible() const |
| bool | isMinorGridLineVisible() const |
| bool | isTitleVisible() const |
| bool | isVisible() const |
| qreal | labelsAngle() const |
| bool | labelsVisible() const |
| Qt::Orientation | orientation() const |
| void | setGridLineVisible(bool visible = true) |
| void | setLabelsAngle(qreal angle) |
| void | setLabelsVisible(bool visible = true) |
| void | setLineVisible(bool visible = true) |
| void | setMax(const QVariant &max) |
| void | setMin(const QVariant &min) |
| void | setMinorGridLineVisible(bool visible = true) |
| void | setRange(const QVariant &min, const QVariant &max) |
| void | setTitleColor(const QColor &color) |
| void | setTitleFont(const QFont &font) |
| void | setTitleText(const QString &title) |
| void | setTitleVisible(bool visible = true) |
| void | setVisible(bool visible = true) |
| void | show() |
| QColor | titleColor() const |
| QFont | titleFont() const |
| QString | titleText() const |
Signals
| void | gridVisibleChanged(bool visible) |
| void | labelsAngleChanged(qreal angle) |
| void | labelsVisibleChanged(bool visible) |
| void | lineVisibleChanged(bool visible) |
| void | minorGridVisibleChanged(bool visible) |
| void | titleColorChanged(const QColor &color) |
| void | titleFontChanged(const QFont &font) |
| void | titleTextChanged(const QString &title) |
| void | titleVisibleChanged(bool visible) |
| void | visibleChanged(bool visible) |
Detailed Description
Each series can be bound to one or more horizontal and vertical axes, but mixing axis types that would result in different domains is not supported, such as specifying QValueAxis and QLogValueAxis on the same orientation.
The properties and visibility of various axis elements, such as axis line, title, labels, and grid lines, can be individually controlled.
Member Type Documentation
enum QAbstractAxis::AxisType
flags QAbstractAxis::AxisTypes
This enum type specifies the type of the axis object.
| Constant | Value |
|---|---|
QAbstractAxis::AxisTypeNoAxis | 0x0 |
QAbstractAxis::AxisTypeValue | 0x1 |
QAbstractAxis::AxisTypeBarCategory | 0x2 |
QAbstractAxis::AxisTypeCategory | 0x4 |
QAbstractAxis::AxisTypeDateTime | 0x8 |
QAbstractAxis::AxisTypeLogValue | 0x10 |
QAbstractAxis::AxisTypeColor | 0x20 |
The AxisTypes type is a typedef for QFlags<AxisType>. It stores an OR combination of AxisType values.
Property Documentation
[read-only] alignment : const Qt::Alignment
This property holds the alignment of the axis.
Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop.
Access functions:
| Qt::Alignment | alignment() const |
gridVisible : bool
This property holds the visibility of the grid lines.
Access functions:
| bool | isGridLineVisible() const |
| void | setGridLineVisible(bool visible = true) |
Notifier signal:
| void | gridVisibleChanged(bool visible) |
labelsAngle : qreal
This property holds the angle of the axis labels in degrees.
Access functions:
| qreal | labelsAngle() const |
| void | setLabelsAngle(qreal angle) |
Notifier signal:
| void | labelsAngleChanged(qreal angle) |
labelsVisible : bool
This property holds whether axis labels are visible.
Access functions:
| bool | labelsVisible() const |
| void | setLabelsVisible(bool visible = true) |
Notifier signal:
| void | labelsVisibleChanged(bool visible) |
lineVisible : bool
This property holds the visibility of the axis line.
Access functions:
| bool | isLineVisible() const |
| void | setLineVisible(bool visible = true) |
Notifier signal:
| void | lineVisibleChanged(bool visible) |
minorGridVisible : bool
This property holds the visibility of the minor grid lines.
Applies only to axes that support minor grid lines.
Access functions:
| bool | isMinorGridLineVisible() const |
| void | setMinorGridLineVisible(bool visible = true) |
Notifier signal:
| void | minorGridVisibleChanged(bool visible) |
[read-only] orientation : const Qt::Orientation
This property holds the orientation of the axis.
Fixed to either Qt::Horizontal or Qt::Vertical when the axis is added to a chart.
Access functions:
| Qt::Orientation | orientation() const |
titleColor : QColor
This property holds the color used to draw the title text.
Access functions:
| QColor | titleColor() const |
| void | setTitleColor(const QColor &color) |
Notifier signal:
| void | titleColorChanged(const QColor &color) |
titleFont : QFont
This property holds the font of the title of the axis.
Access functions:
| QFont | titleFont() const |
| void | setTitleFont(const QFont &font) |
Notifier signal:
| void | titleFontChanged(const QFont &font) |
titleText : QString
This property holds the title of the axis.
Empty by default. Axis titles support HTML formatting.
Access functions:
| QString | titleText() const |
| void | setTitleText(const QString &title) |
Notifier signal:
| void | titleTextChanged(const QString &title) |
titleVisible : bool
This property holds the visibility of the axis title.
By default, the value is true.
Access functions:
| bool | isTitleVisible() const |
| void | setTitleVisible(bool visible = true) |
Notifier signal:
| void | titleVisibleChanged(bool visible) |
visible : bool
This property holds the visibility of the axis.
Access functions:
| bool | isVisible() const |
| void | setVisible(bool visible = true) |
Notifier signal:
| void | visibleChanged(bool visible) |
Member Function Documentation
[virtual noexcept] QAbstractAxis::~QAbstractAxis()
Destructs the axis object. When the axis is added to a chart, the chart object takes ownership.
void QAbstractAxis::hide()
Makes the axis, labels, and grid lines invisible.
Qt::Orientation QAbstractAxis::orientation() const
Returns the orientation of the axis (vertical or horizontal).
Note: Getter function for property orientation.
void QAbstractAxis::setLineVisible(bool visible = true)
Determines whether the axis line and tick marks are visible.
Note: Setter function for property lineVisible.
See also isLineVisible().
void QAbstractAxis::setMax(const QVariant &max)
Sets the maximum value shown on the axis. Depending on the actual axis type, the max parameter is converted to the appropriate type of value. If the conversion is impossible, the function call does nothing.
void QAbstractAxis::setMin(const QVariant &min)
Sets the minimum value shown on the axis. Depending on the actual axis type, the min parameter is converted to the appropriate type of value. If the conversion is impossible, the function call does nothing.
void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
Sets the range shown on the axis. Depending on the actual axis type, the min and max parameters are converted to appropriate types of values. If the conversion is impossible, the function call does nothing.
void QAbstractAxis::setTitleColor(const QColor &color)
Sets the color used to draw titles to color.
Note: Setter function for property titleColor.
See also titleColor().
void QAbstractAxis::setTitleFont(const QFont &font)
Sets the font used to draw titles to font.
Note: Setter function for property titleFont.
See also titleFont().
void QAbstractAxis::setVisible(bool visible = true)
Sets the visibility of the axis, labels, and grid lines to visible.
Note: Setter function for property visible.
See also isVisible().
void QAbstractAxis::show()
Makes the axis, labels, and grid lines visible.
QColor QAbstractAxis::titleColor() const
Returns the color used to draw titles.
Note: Getter function for property titleColor.
See also setTitleColor().
QFont QAbstractAxis::titleFont() const
Returns the font used to draw titles.
Note: Getter function for property titleFont.
See also setTitleFont().