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
实例化: BarSet
继承: QObject
状态: 技术预览

特性

公共函数

QBarSet (const QString label , QObject * parent = nullptr)
virtual ~QBarSet ()
void append (const qreal value )
void append (const QList<qreal> & )
qreal at (const int index ) const
QColor borderColor ()
qreal borderWidth () const
QColor color ()
int count () const
void insert (const int index , const qreal value )
bool isBarSelected (int index ) const
QString label () const
QColor labelColor ()
void remove (const int index , const int count = 1)
void replace (const int index , const qreal value )
QList<int> selectedBars () const
QColor selectedColor () const
void setBorderColor (QColor color )
void setBorderWidth (qreal borderWidth )
void setColor (QColor color )
void setLabel (const QString label )
void setLabelColor (QColor color )
void setSelectedColor (const QColor & color )
void setValues (QVariantList )
qreal sum () const
QVariantList values ()
QBarSet & operator<< (const qreal & value )
qreal operator[] (const int index ) const

公共槽

void deselectAllBars ()
void deselectBar (int index )
void deselectBars (const QList<int> & indexes )
void selectAllBars ()
void selectBar (int index )
void selectBars (const QList<int> & indexes )
void setBarSelected (int index , bool selected )
void toggleSelection (const QList<int> & indexes )

信号

void borderColorChanged (QColor color )
void borderWidthChanged (qreal width )
void colorChanged (QColor color )
void countChanged ()
void labelChanged ()
void labelColorChanged (QColor color )
void selectedBarsChanged (const QList<int> & indexes )
void valueChanged (int index )
void valuesAdded (int index , int count )
void valuesChanged ()
void valuesRemoved (int index , int count )

详细描述

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

另请参阅 QAbstractBarSeries and QBarSeries .

特性文档编制

borderColor : QColor

This property holds the border color of the bar set.

访问函数:

QColor borderColor ()
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 ()
void setColor (QColor color )

通知程序信号:

void colorChanged (QColor color )

[read-only] count : const int

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

访问函数:

int count () const

通知程序信号:

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 ()
void setLabelColor (QColor color )

通知程序信号:

void labelColorChanged (QColor color )

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

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

访问函数:

QList<int> selectedBars () const

通知程序信号:

void selectedBarsChanged (const QList<int> & indexes )

成员函数文档编制

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

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

[virtual noexcept] QBarSet:: ~QBarSet ()

Removes the bar set.

void QBarSet:: append (const qreal value )

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

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

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

另请参阅 append ().

qreal QBarSet:: at (const int index ) const

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

QColor QBarSet:: borderColor ()

Returns the line color for the bar set.

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

另请参阅 setBorderColor ().

[signal] void QBarSet:: borderColorChanged ( QColor color )

This signal is emitted when the border color of the bar set changes to color .

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

QColor QBarSet:: color ()

Returns the fill color for the bar set.

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

另请参阅 setColor ().

[signal] void QBarSet:: colorChanged ( QColor color )

This signal is emitted when the fill color of the bar set changes to color .

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

int QBarSet:: count () const

Returns the number of values in a bar set.

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

[slot] void QBarSet:: deselectAllBars ()

Deselects all bars in the series.

注意: Emits QBarSet::selectedBarsChanged .

另请参阅 setBarSelected ().

[slot] void QBarSet:: deselectBar ( int index )

Deselects the bar at index .

注意: Emits QBarSet::selectedBarsChanged .

另请参阅 setBarSelected ().

[slot] void QBarSet:: deselectBars (const QList < int > & indexes )

Marks multiple bars passed in an indexes list as deselected.

注意: Emits QBarSet::selectedBarsChanged .

另请参阅 setBarSelected ().

void QBarSet:: insert (const int index , const qreal value )

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

另请参阅 remove ().

bool QBarSet:: isBarSelected ( int 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 .

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

QString QBarSet:: label () const

Returns the label of the bar set.

注意: Getter function for property label.

另请参阅 setLabel ().

[signal] void QBarSet:: labelChanged ()

This signal is emitted when the label of the bar set changes.

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

另请参阅 label .

QColor QBarSet:: labelColor ()

Returns the text color for the bar set.

注意: Getter function for property labelColor.

另请参阅 setLabelColor ().

[signal] void QBarSet:: labelColorChanged ( QColor color )

This signal is emitted when the text (label) color of the bar set changes to color .

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

void QBarSet:: remove (const int index , const int count = 1)

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

另请参阅 insert ().

void QBarSet:: replace (const int index , const qreal value )

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

[slot] void QBarSet:: selectAllBars ()

Marks all bars in the series as selected.

注意: Emits QBarSet::selectedBarsChanged .

另请参阅 setBarSelected ().

[slot] void QBarSet:: selectBar ( int index )

Marks the bar at index as selected.

注意: Emits QBarSet::selectedBarsChanged .

另请参阅 setBarSelected ().

[slot] void QBarSet:: selectBars (const QList < int > & indexes )

Marks multiple bars passed in an indexes list as selected.

注意: Emits QBarSet::selectedBarsChanged .

另请参阅 setBarSelected ().

QList < int > QBarSet:: selectedBars () const

Returns a list of bars marked as selected.

注意: Getter function for property selectedBars.

另请参阅 setBarSelected ().

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.

另请参阅 setSelectedColor () 和 color .

[slot] void QBarSet:: setBarSelected ( int 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 .

另请参阅 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 (const QColor & color )

设置 color of the selected bars.

另请参阅 selectedColor .

qreal QBarSet:: sum () const

Returns the sum of all values in the bar set.

[slot] void QBarSet:: toggleSelection (const QList < int > & indexes )

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

注意: Emits QBarSet::selectedBarsChanged .

另请参阅 setBarSelected ().

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

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

另请参阅 at ().

[signal] void QBarSet:: valuesAdded ( int index , int 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:: valuesChanged ()

This signal is emitted when the values of the bar set change.

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

[signal] void QBarSet:: valuesRemoved ( int index , int 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<< (const qreal & value )

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

另请参阅 append ().

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

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