QBoxSet Class | Qt Charts 6.1.2

- Qt 6.1
- Qt Charts
- C++ Classes
- QBoxSet
- Qt Charts | Commercial or GPLv3

# QBoxSet Class

The QBoxSet class represents one item in a box-and-whiskers chart. More...

Header: | #include <QBoxSet>
Instantiated By: | BoxSet
Inherits: | QObject

- List of all members, including inherited members

## Public Types

enum | ValuePositions { LowerExtreme, LowerQuartile, Median, UpperQuartile, UpperExtreme }

## Properties

- brush : QBrush
- pen : QPen

## Public Functions

| QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label = QString(), QObject *parent = nullptr)
| QBoxSet(const QString label = QString(), QObject *parent = nullptr)
virtual | ~QBoxSet()
void | append(const qreal value)
void | append(const QList<qreal> &values)
qreal | at(const int index) const
QBrush | brush() const
void | clear()
int | count() const
QString | label() const
QPen | pen() const
void | setBrush(const QBrush &brush)
void | setLabel(const QString label)
void | setPen(const QPen &pen)
void | setValue(const int index, const qreal value)
QBoxSet & | operator<<(const qreal &value)
qreal | operator[](const int index) const

## Signals

void | brushChanged()
void | cleared()
void | clicked()
void | doubleClicked()
void | hovered(bool status)
void | penChanged()
void | pressed()
void | released()
void | valueChanged(int index)
void | valuesChanged()

## Detailed Description

A box-and-whiskers item is a graphical representation of a range and three median values that is constructed from five different values. There are two ways to specify the values. The first one is by using a constructor or stream operator (<<). The values have to be specified in the following order: lower extreme, lower quartile, median, upper quartile, and upper extreme.

The second way is to create an empty QBoxSet instance and specify the values using the setValue() method.

See the box-and-whiskers chart example to learn how to create a box-and-whiskers chart.

See also QBoxPlotSeries.

## Member Type Documentation

### enum QBoxSet::ValuePositions

This enum type defines the values of a box-and-whiskers item:

Constant | Value | Description
--- | --- | ---
`QBoxSet::LowerExtreme` | `0` | The smallest value of the box-and-whiskers item.
`QBoxSet::LowerQuartile` | `1` | The median value of the lower half of the box-and-whiskers item.
`QBoxSet::Median` | `2` | The median value of the box-and-whiskers item.
`QBoxSet::UpperQuartile` | `3` | The median value of the upper half of the box-and-whiskers item.
`QBoxSet::UpperExtreme` | `4` | The largest value of the box-and-whiskers item.

## Property Documentation

### brush : QBrush

This property holds the brush used fill the box of the box-and-whiskers item.

Access functions:

QBrush | brush() const
void | setBrush(const QBrush &brush)

Notifier signal:

void | brushChanged()

### pen : QPen

This property holds the pen used to draw the lines of the box-and-whiskers item.

Access functions:

QPen | pen() const
void | setPen(const QPen &pen)

Notifier signal:

void | penChanged()

## Member Function Documentation

### QBoxSet::QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label = QString(), QObject *parent = nullptr)

Constructs a box-and-whiskers item with the following ordered values: le specifies the lower extreme, lq the lower quartile, m the median, uq the upper quartile, and ue the upper quartile. Optionally, the label and parent can be specified.

### QBoxSet::QBoxSet(const QString label = QString(), QObject *parent = nullptr)

Constructs a box-and-whiskers item with the optional label label and parent parent.

### `[signal]` void QBoxSet::brushChanged()

This signal is emitted when the brush of the box-and-whiskers item changes.

Note: Notifier signal for property brush.

See also brush.

### `[signal]` void QBoxSet::cleared()

This signal is emitted when all the values of the box-and-whiskers item are set to 0.

### `[signal]` void QBoxSet::clicked()

This signal is emitted when the user clicks a box-and-whiskers item in the chart.

### `[signal]` void QBoxSet::doubleClicked()

This signal is emitted when the user double-clicks a box-and-whiskers item.

### `[signal]` void QBoxSet::hovered(bool status)

This signal is emitted when a mouse is hovered over a box-and-whiskers item in a chart. When the mouse moves over the item, status turns `true`, and when the mouse moves away again, it turns `false`.

### `[signal]` void QBoxSet::penChanged()

This signal is emitted when the pen of the box-and-whiskers item changes.

Note: Notifier signal for property pen.

See also pen.

### `[signal]` void QBoxSet::pressed()

This signal is emitted when the user clicks a box-and-whiskers item in the chart and holds down the mouse button.

### `[signal]` void QBoxSet::released()

This signal is emitted when the user releases the mouse press on a box-and-whiskers item.

### `[signal]` void QBoxSet::valueChanged(int index)

This signal is emitted when the value of the box-and-whiskers item specified by index is modified.

See also at().

### `[signal]` void QBoxSet::valuesChanged()

This signal is emitted when multiple values of the box-and-whiskers item change.

See also append().

### `[virtual]` QBoxSet::~QBoxSet()

Destroys the a box-and-whiskers item.

### void QBoxSet::append(const qreal value)

Appends the new value specified by value to the end of the box-and-whiskers item.

### void QBoxSet::append(const QList<qreal> &values)

Appends a list of real values specified by values to the end of the box-and-whiskers item.

See also append().

### qreal QBoxSet::at(const int index) const

Returns the value of the box-and-whiskers item specified by index. The index can be specified by using ValuePositions enumeration values. If the index is out of bounds, 0.0 is returned.

### QBrush QBoxSet::brush() const

Returns the brush used to fill the box-and-whiskers item.

Note: Getter function for property brush.

See also setBrush().

### void QBoxSet::clear()

Sets all the values of the box-and-whiskers item to 0.

### int QBoxSet::count() const

Returns the number of values appended to the box-and-whiskers item.

### QString QBoxSet::label() const

Returns the label of the category of the box-and-whiskers item.

See also setLabel().

### QPen QBoxSet::pen() const

Returns the pen used to draw the box-and-whiskers item.

Note: Getter function for property pen.

See also setPen().

### void QBoxSet::setBrush(const QBrush &brush)

Sets the brush used to fill the box-and-whiskers item to brush.

Note: Setter function for property brush.

See also brush().

### void QBoxSet::setLabel(const QString label)

Sets the label specified by label for the category of the box-and-whiskers item.

See also label().

### void QBoxSet::setPen(const QPen &pen)

Sets the pen used to draw the box-and-whiskers item to pen.

Note: Setter function for property pen.

See also pen().

### void QBoxSet::setValue(const int index, const qreal value)

Sets the value specified by value in the position specified by index. The index can be specified by using the ValuePositions enumeration values.

### QBoxSet &QBoxSet::operator<<(const qreal &value)

A convenience operator for appending the real value specified by value to the end of the box-and-whiskers item.

See also append().

### qreal QBoxSet::operator[](const int index) const

Returns the value of the box-and-whiskers item specified by index. The index can be specified by using ValuePositions enumeration values. If the index is out of bounds, 0.0 is returned.