QBarSet 类

The QBarSet class represents one set of bars in a bar graph. 更多...

头: #include <QBarSet>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
在 QML: BarSet
继承: QObject

特性

公共函数

QBarSet (const QString & label , QObject * parent = nullptr)
virtual ~QBarSet () override
void append (const QList<qreal> & )
void append (qreal value )
qreal at (qsizetype index ) const
QColor borderColor () const
qreal borderWidth () const
void clear ()
QColor color () const
qsizetype count () const
void deselectAllBars ()
void deselectBar (qsizetype index )
void deselectBars (const QList<qsizetype> & indexes )
void insert (qsizetype index , qreal value )
bool isBarSelected (qsizetype index ) const
QString label () const
QColor labelColor () const
void remove (qsizetype index , qsizetype count = 1)
void replace (qsizetype index , qreal value )
void selectAllBars ()
void selectBar (qsizetype index )
void selectBars (const QList<qsizetype> & indexes )
QList<qsizetype> selectedBars () const
QColor selectedColor () const
void setBarSelected (qsizetype index , bool selected )
void setBorderColor (QColor color )
void setBorderWidth (qreal borderWidth )
void setColor (QColor color )
void setLabel (const QString & label )
void setLabelColor (QColor color )
void setSelectedColor (QColor color )
void setValues (const QVariantList & )
qreal sum () const
void toggleSelection (const QList<qsizetype> & indexes )
QVariantList () const
QBarSet & operator<< (qreal value )
qreal operator[] (qsizetype index ) const

信号

void borderColorChanged (QColor color )
void borderWidthChanged (qreal width )
void colorChanged (QColor color )
void countChanged ()
void labelChanged ()
void labelColorChanged (QColor color )
void selectedBarsChanged (const QList<qsizetype> & indexes )
void selectedColorChanged (QColor color )
void update ()
void updatedBars ()
void valueAdded (qsizetype index , qsizetype count )
void valueChanged (qsizetype index )
void valueRemoved (qsizetype index , qsizetype count )
void valuesAdded (qsizetype index , qsizetype count )
void valuesChanged ()
void valuesRemoved (qsizetype index , qsizetype count )

详细描述

条形集包含每个类别的一个数据值。假定集的第一个值属于第一个类别,第二个值属于第二个类别,依此类推。若集拥有的值少于类别,假定缺少值位于集末尾。对于集中间的缺少值,使用数值 0。0 值集标签不展示。

另请参阅 QBarSeries .

特性文档编制

borderColor : QColor

This property holds the border color of the bar set.

访问函数:

QColor borderColor () const
void setBorderColor (QColor color )

通知程序信号:

void borderColorChanged (QColor color )

borderWidth : qreal

This property holds the width of the border line. By default, the width is -1, meaning the border width is defined by the theme.

访问函数:

qreal borderWidth () const
void setBorderWidth (qreal borderWidth )

通知程序信号:

void borderWidthChanged (qreal width )

color : QColor

This property holds the fill color of the bar set.

访问函数:

QColor color () const
void setColor (QColor color )

通知程序信号:

void colorChanged (QColor color )

[read-only] count : const qsizetype

This property holds the number of values in the bar set.

访问函数:

qsizetype count () const [见下文注意事项]

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

通知程序信号:

void countChanged ()

label : QString

此特性保持条形集的标签。

访问函数:

QString label () const
void setLabel (const QString & label )

通知程序信号:

void labelChanged ()

labelColor : QColor

This property holds the text (label) color of the bar set.

访问函数:

QColor labelColor () const
void setLabelColor (QColor color )

通知程序信号:

void labelColorChanged (QColor color )

[read-only] selectedBars : const QList < qsizetype >

This property holds the indexes of the bars which are currently selected.

访问函数:

QList<qsizetype> selectedBars () const

通知程序信号:

void selectedBarsChanged (const QList<qsizetype> & indexes )

selectedColor : QColor

This property holds the fill color of the selected set.

访问函数:

QColor selectedColor () const
void setSelectedColor (QColor color )

通知程序信号:

void selectedColorChanged (QColor color )

: QVariantList

This property holds the values of the bar set.

You can set a list of either real or point types as values.

If you set a list of real types as values, they directly define the bar set values.

If you set a list of point types as values, the x-coordinate of the point specifies its zero-based index in the bar set. The size of the bar set is the highest x-coordinate value + 1. If a point is missing for any x-coordinate between zero and the highest value, it gets the value zero.

访问函数:

QVariantList () const
void setValues (const QVariantList & )

通知程序信号:

void valuesChanged ()

成员函数文档编制

[explicit] QBarSet:: QBarSet (const QString & label , QObject * parent = nullptr)

构造条形集采用标签 label and the parent parent .

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

Removes the bar set.

[invokable] void QBarSet:: append (const QList < qreal > & )

Appends the list of real values specified by values to the end of the bar set.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 append().

[invokable] void QBarSet:: append ( qreal value )

Appends the new value specified by value to the end of the bar set.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] qreal QBarSet:: at ( qsizetype index ) const

Returns the value specified by index from the bar set. If the index is out of bounds, 0.0 is returned.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

QColor QBarSet:: borderColor () const

Returns the line color for the bar set.

注意: getter 函数对于特性 borderColor。

另请参阅 setBorderColor ().

[invokable] void QBarSet:: clear ()

Removes all values from the set.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

QColor QBarSet:: color () const

Returns the fill color for the bar set.

注意: getter 函数对于特性 color。

另请参阅 setColor ().

[invokable] qsizetype QBarSet:: count () const

Returns the number of values in a bar set.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

注意: getter 函数对于特性 count。

[invokable] void QBarSet:: deselectAllBars ()

Deselects all bars in the set.

注意: Emits QBarSet::selectedBarsChanged .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setBarSelected ().

[invokable] void QBarSet:: deselectBar ( qsizetype index )

Deselects the bar at index .

注意: Emits QBarSet::selectedBarsChanged .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setBarSelected ().

[invokable] void QBarSet:: deselectBars (const QList < qsizetype > & indexes )

Marks multiple bars passed in an indexes list as deselected.

注意: Emits QBarSet::selectedBarsChanged .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setBarSelected ().

[invokable] void QBarSet:: insert ( qsizetype index , qreal value )

插入 value in the position specified by index . The values following the inserted value are moved up one position.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 remove ().

[invokable] bool QBarSet:: isBarSelected ( qsizetype index ) const

返回 true if the bar at the given index is among selected bars and false 否则。

注意: Selected bars are drawn using the selected color if it was specified using QBarSet::setSelectedColor .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 selectedBars (), setBarSelected (),和 setSelectedColor ().

QString QBarSet:: label () const

Returns the label of the bar set.

注意: Getter function for property label.

另请参阅 setLabel ().

QColor QBarSet:: labelColor () const

Returns the text color for the bar set.

注意: Getter function for property labelColor.

另请参阅 setLabelColor ().

[invokable] void QBarSet:: remove ( qsizetype index , qsizetype count = 1)

Removes the number of values specified by count from the bar set starting with the value specified by index .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 insert ().

[invokable] void QBarSet:: replace ( qsizetype index , qreal value )

Adds the value specified by value to the bar set at the position specified by index .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QBarSet:: selectAllBars ()

Marks all bars in the set as selected.

注意: Emits QBarSet::selectedBarsChanged .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setBarSelected ().

[invokable] void QBarSet:: selectBar ( qsizetype index )

Marks the bar at index as selected.

注意: Emits QBarSet::selectedBarsChanged .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setBarSelected ().

[invokable] void QBarSet:: selectBars (const QList < qsizetype > & indexes )

Marks multiple bars passed in an indexes list as selected.

注意: Emits QBarSet::selectedBarsChanged .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setBarSelected ().

QList < qsizetype > QBarSet:: selectedBars () const

Returns a list of bars marked as selected.

注意: Getter function for property selectedBars.

另请参阅 setBarSelected ().

[signal] void QBarSet:: selectedBarsChanged (const QList < qsizetype > & indexes )

This signal is emitted when the selected bar changes. indexes is a list selected bar indexes.

注意: 通知程序信号对于特性 selectedBars .

QColor QBarSet:: selectedColor () const

Returns the color of the selected bars.

This is the fill (brush) color of bars marked as selected. If not specified, value of QBarSet::color is used as default.

注意: Getter function for property selectedColor.

另请参阅 setSelectedColor () 和 color .

[invokable] void QBarSet:: setBarSelected ( qsizetype index , bool selected )

Marks the bar at index as either selected or deselected as specified by selected .

注意: Selected bars are drawn using the selected color if it was specified. Emits QBarSet::selectedBarsChanged .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 isBarSelected () 和 setSelectedColor ().

void QBarSet:: setBorderColor ( QColor color )

将条形集的线颜色设为 color .

注意: setter 函数对于特性 borderColor .

另请参阅 borderColor ().

void QBarSet:: setColor ( QColor color )

将条形集的填充颜色设为 color .

注意: setter 函数对于特性 color .

另请参阅 color ().

void QBarSet:: setLabel (const QString & label )

设置 label as the new label for the bar set.

注意: setter 函数对于特性 label .

另请参阅 label ().

void QBarSet:: setLabelColor ( QColor color )

Sets the text color for the bar set to color .

注意: setter 函数对于特性 labelColor .

另请参阅 labelColor ().

void QBarSet:: setSelectedColor ( QColor color )

设置 color of the selected bars.

注意: setter 函数对于特性 selectedColor .

另请参阅 selectedColor .

[invokable] qreal QBarSet:: sum () const

Returns the sum of all values in the bar set.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QBarSet:: toggleSelection (const QList < qsizetype > & indexes )

Changes the selection state of bars at the given indexes to the opposite one.

注意: Emits QBarSet::selectedBarsChanged .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setBarSelected ().

[signal] void QBarSet:: update ()

This signal is emitted when the barset is updated.

[signal] void QBarSet:: updatedBars ()

This signal is emitted when the bars in this set are updated.

[signal] void QBarSet:: valueAdded ( qsizetype index , qsizetype count )

This signal is emitted when new values are added to the bar set. index indicates the position of the first inserted value, and count is the number of inserted values.

[signal] void QBarSet:: valueChanged ( qsizetype index )

This signal is emitted when the value at the position specified by index 被修改。

另请参阅 at ().

[signal] void QBarSet:: valueRemoved ( qsizetype index , qsizetype count )

This signal is emitted when values are removed from the bar set. index indicates the position of the first removed value, and count is the number of removed values.

[signal] void QBarSet:: valuesAdded ( qsizetype index , qsizetype count )

This signal is emitted when new values are added to the bar set. index indicates the position of the first inserted value, and count is the number of inserted values.

另请参阅 append () 和 insert ().

[signal] void QBarSet:: valuesRemoved ( qsizetype index , qsizetype count )

This signal is emitted when values are removed from the bar set. index indicates the position of the first removed value, and count is the number of removed values.

另请参阅 remove ().

QBarSet &QBarSet:: operator<< ( qreal value )

A convenience operator for appending the real value specified by value to the end of the bar set.

另请参阅 append ().

qreal QBarSet:: operator[] ( qsizetype index ) const

Returns the value of the bar set specified by index . If the index is out of bounds, 0.0 is returned.