QAbstractAxis 類

QAbstractAxis 類是用於專用軸類的基類。 更多...

頭: #include <QAbstractAxis>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
在 QML: AbstractAxis
繼承: QObject
繼承者:

QBarCategoryAxis , QDateTimeAxis ,和 QValueAxis

公共類型

枚舉類 AxisType { Value, BarCategory, DateTime }

特性

公共函數

virtual ~QAbstractAxis () override
Qt::Alignment alignment () const
void hide ()
bool isGridVisible () const
bool isLineVisible () const
bool isSubGridVisible () const
bool isTitleVisible () const
bool isVisible () const
QQmlComponent * labelDelegate () const
qreal labelsAngle () const
bool labelsVisible () const
void setAlignment (Qt::Alignment alignment )
void setGridVisible (bool visible = true)
void setLabelDelegate (QQmlComponent * newLabelDelegate )
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 setRange (const QVariant & min , const QVariant & max )
void setSubGridVisible (bool visible = true)
void setTextElideMode (Qt::TextElideMode elideMode )
void setTitleColor (QColor color )
void setTitleFont (const QFont & font )
void setTitleText (const QString & title )
void setTitleVisible (bool visible = true)
void setVisible (bool visible = true)
void show ()
Qt::TextElideMode textElideMode () const
QColor titleColor () const
QFont titleFont () const
QString titleText () const
virtual QAbstractAxis::AxisType type () const = 0

信號

void alignmentChanged (Qt::Alignment alignment )
void gridVisibleChanged (bool visible )
void labelDelegateChanged ()
void labelsAngleChanged (qreal angle )
void labelsVisibleChanged (bool visible )
void lineVisibleChanged (bool visible )
void subGridVisibleChanged (bool visible )
void textElideModeChanged (Qt::TextElideMode elideMode )
void titleColorChanged (QColor color )
void titleFontChanged (const QFont & font )
void titleTextChanged (const QString & title )
void titleVisibleChanged (bool visible )
void update ()
void visibleChanged (bool visible )

詳細描述

Each series can be bound to only one horizontal and vertical axis.

The properties and visibility of various axis elements, such as axis line, title, labels, and grid lines, can be individually controlled.

成員類型文檔編製

enum class QAbstractAxis:: AxisType

此枚舉類型指定軸對象的類型。

常量
QAbstractAxis::AxisType::Value 0
QAbstractAxis::AxisType::BarCategory 1
QAbstractAxis::AxisType::DateTime 2

特性文檔編製

[since 6.9] alignment : Qt::Alignment

此特性保持軸的對齊方式。

可以是 Qt::AlignLeft , Qt::AlignRight , Qt::AlignBottom ,或 Qt::AlignTop .

該特性在 Qt 6.9 引入。

訪問函數:

Qt::Alignment alignment () const
void setAlignment (Qt::Alignment alignment )

通知程序信號:

void alignmentChanged (Qt::Alignment alignment )

gridVisible : bool

This property holds the visibility of the grid lines. By default, the value is true .

訪問函數:

bool isGridVisible () const
void setGridVisible (bool visible = true)

通知程序信號:

void gridVisibleChanged (bool visible )

labelDelegate : QQmlComponent *

This property holds a custom QML Component used as a label for the axis. This component should either be a Text component or contain "property string text", so that this property will be assigned the value of the label.

訪問函數:

QQmlComponent * labelDelegate () const
void setLabelDelegate (QQmlComponent * newLabelDelegate )

通知程序信號:

void labelDelegateChanged ()

labelsAngle : qreal

此特性保持軸標簽的角度,以度為單位。

訪問函數:

qreal labelsAngle () const
void setLabelsAngle (qreal angle )

通知程序信號:

void labelsAngleChanged (qreal angle )

labelsVisible : bool

This property holds whether axis labels are visible. By default, the value is true .

訪問函數:

bool labelsVisible () const
void setLabelsVisible (bool visible = true)

通知程序信號:

void labelsVisibleChanged (bool visible )

lineVisible : bool

This property holds the visibility of the axis line. By default, the value is true .

訪問函數:

bool isLineVisible () const
void setLineVisible (bool visible = true)

通知程序信號:

void lineVisibleChanged (bool visible )

subGridVisible : bool

This property holds the visibility of the subgrid lines.

Applies only to axes that support subgrid lines. By default, the value is true .

訪問函數:

bool isSubGridVisible () const
void setSubGridVisible (bool visible = true)

通知程序信號:

void subGridVisibleChanged (bool visible )

[since 6.10] textElideMode : Qt::TextElideMode

Property specifies ellipsis placement for overflowing text.

可以是 Qt::ElideLeft , Qt::ElideRight , Qt::ElideMiddle ,或 Qt::ElideNone . By default, the value is Qt::ElideNone .

此特性在 Qt 6.10 引入。

訪問函數:

Qt::TextElideMode textElideMode () const
void setTextElideMode (Qt::TextElideMode elideMode )

通知程序信號:

void textElideModeChanged (Qt::TextElideMode elideMode )

titleColor : QColor

This property holds the color used to draw the title text.

訪問函數:

QColor titleColor () const
void setTitleColor (QColor color )

通知程序信號:

void titleColorChanged (QColor color )

titleFont : QFont

This property holds the font of the title of the axis.

訪問函數:

QFont titleFont () const
void setTitleFont (const QFont & font )

通知程序信號:

void titleFontChanged (const QFont & font )

titleText : QString

此特性保持軸的標題。

默認為空。軸標題支持 HTML 格式。

訪問函數:

QString titleText () const
void setTitleText (const QString & title )

通知程序信號:

void titleTextChanged (const QString & title )

titleVisible : bool

This property holds the visibility of the axis title.

By default, the value is true .

訪問函數:

bool isTitleVisible () const
void setTitleVisible (bool visible = true)

通知程序信號:

void titleVisibleChanged (bool visible )

visible : bool

This property holds the visibility of the axis. By default, the value is true .

訪問函數:

bool isVisible () const
void setVisible (bool visible = true)

通知程序信號:

void visibleChanged (bool visible )

成員函數文檔編製

[override virtual noexcept] QAbstractAxis:: ~QAbstractAxis ()

Destructs the axis object. When the axis is added to a graph, the graph object takes ownership.

void QAbstractAxis:: hide ()

Makes the axis, labels, and grid lines invisible.

void QAbstractAxis:: setLineVisible ( bool visible = true)

Determines whether the axis line and tick marks are visible .

注意: setter 函數對於特性 lineVisible .

另請參閱 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 ( QColor color )

Sets the color used to draw titles to color .

注意: setter 函數對於特性 titleColor .

另請參閱 titleColor ().

void QAbstractAxis:: setTitleFont (const QFont & font )

Sets the font used to draw titles to font .

注意: setter 函數對於特性 titleFont .

另請參閱 titleFont ().

void QAbstractAxis:: setVisible ( bool visible = true)

Sets the visibility of the axis, labels, and grid lines to visible .

注意: setter 函數對於特性 visible .

另請參閱 isVisible ().

void QAbstractAxis:: show ()

Makes the axis, labels, and grid lines visible.

QColor QAbstractAxis:: titleColor () const

Returns the color used to draw titles.

注意: Getter function for property titleColor.

另請參閱 setTitleColor ().

QFont QAbstractAxis:: titleFont () const

Returns the font used to draw titles.

注意: Getter function for property titleFont.

另請參閱 setTitleFont ().

[pure virtual] QAbstractAxis::AxisType QAbstractAxis:: type () const

返迴軸的類型。

[signal] void QAbstractAxis:: update ()

This signal is emitted when the axis needs to be updated.