QBarDataProxy Class

Base proxy class for Q3DBars. More...

Header: #include <QBarDataProxy>
Since: QtDataVisualization 1.0
Instantiated By: BarDataProxy
Inherits: QAbstractDataProxy
Inherited By:

QItemModelBarDataProxy

Properties

Public Functions

QBarDataProxy(QObject *parent = Q_NULLPTR)
virtual ~QBarDataProxy()
int addRow(QBarDataRow *row)
int addRow(QBarDataRow *row, const QString &label)
int addRows(const QBarDataArray &rows)
int addRows(const QBarDataArray &rows, const QStringList &labels)
const QBarDataArray *array() const
QStringList columnLabels() const
void insertRow(int rowIndex, QBarDataRow *row)
void insertRow(int rowIndex, QBarDataRow *row, const QString &label)
void insertRows(int rowIndex, const QBarDataArray &rows)
void insertRows(int rowIndex, const QBarDataArray &rows, const QStringList &labels)
const QBarDataItem *itemAt(int rowIndex, int columnIndex) const
const QBarDataItem *itemAt(const QPoint &position) const
void removeRows(int rowIndex, int removeCount, bool removeLabels = true)
void resetArray()
void resetArray(QBarDataArray *newArray)
void resetArray(QBarDataArray *newArray, const QStringList &rowLabels, const QStringList &columnLabels)
const QBarDataRow *rowAt(int rowIndex) const
int rowCount() const
QStringList rowLabels() const
QBar3DSeries *series() const
void setColumnLabels(const QStringList &labels)
void setItem(int rowIndex, int columnIndex, const QBarDataItem &item)
void setItem(const QPoint &position, const QBarDataItem &item)
void setRow(int rowIndex, QBarDataRow *row)
void setRow(int rowIndex, QBarDataRow *row, const QString &label)
void setRowLabels(const QStringList &labels)
void setRows(int rowIndex, const QBarDataArray &rows)
void setRows(int rowIndex, const QBarDataArray &rows, const QStringList &labels)

Signals

void arrayReset()
void columnLabelsChanged()
void itemChanged(int rowIndex, int columnIndex)
void rowCountChanged(int count)
void rowLabelsChanged()
void rowsAdded(int startIndex, int count)
void rowsChanged(int startIndex, int count)
void rowsInserted(int startIndex, int count)
void rowsRemoved(int startIndex, int count)
void seriesChanged(QBar3DSeries *series)
typedef QBarDataArray
typedef QBarDataRow

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

Base proxy class for Q3DBars.

QBarDataProxy handles adding, inserting, changing and removing rows of data.

The data array is a list of vectors (rows) of QBarDataItem instances. Each row can contain different amount of items or even be null.

QBarDataProxy takes ownership of all QBarDataRows passed to it, whether directly or in a QBarDataArray container. If you use QBarDataRow pointers to directly modify data after adding the array to the proxy, you must also emit proper signal to make the graph update.

QBarDataProxy optionally keeps track of row and column labels, which QCategory3DAxis can utilize to show axis labels. The row and column labels are stored in separate array from the data and row manipulation methods provide an alternate versions that don't affect the row labels. This enables the option of having row labels that relate to the position of the data in the array rather than the data itself.

See also Qt Data Visualization Data Handling.

Property Documentation

columnLabels : QStringList

Optional column labels for the array. Indexes in this array match column indexes in rows. If the list is shorter than the longest row, all columns will not get labels.

Access functions:

QStringList columnLabels() const
void setColumnLabels(const QStringList &labels)

Notifier signal:

void columnLabelsChanged()

rowCount : const int

Row count in the array.

Access functions:

int rowCount() const

Notifier signal:

void rowCountChanged(int count)

rowLabels : QStringList

Optional row labels for the array. Indexes in this array match row indexes in data array. If the list is shorter than row count, all rows will not get labels.

Access functions:

QStringList rowLabels() const
void setRowLabels(const QStringList &labels)

Notifier signal:

void rowLabelsChanged()

series : QBar3DSeries * const

The series this proxy is attached to.

Access functions:

QBar3DSeries *series() const

Notifier signal:

void seriesChanged(QBar3DSeries *series)

Member Function Documentation

QBarDataProxy::QBarDataProxy(QObject *parent = Q_NULLPTR)

Constructs QBarDataProxy with the given parent.

[virtual] QBarDataProxy::~QBarDataProxy()

Destroys QBarDataProxy.

int QBarDataProxy::addRow(QBarDataRow *row)

Adds a new row to the end of array. Existing row labels are not affected.

Returns index of the added row.

int QBarDataProxy::addRow(QBarDataRow *row, const QString &label)

Adds a new row with the label to the end of array.

Returns index of the added row.

int QBarDataProxy::addRows(const QBarDataArray &rows)

Adds new rows to the end of array. Existing row labels are not affected.

Returns index of the first added row.

int QBarDataProxy::addRows(const QBarDataArray &rows, const QStringList &labels)

Adds new rows with labels to the end of array.

Returns index of the first added row.

const QBarDataArray *QBarDataProxy::array() const

Returns pointer to the data array.

[signal] void QBarDataProxy::arrayReset()

Emitted when data array is reset. If you change the whole array contents without calling resetArray(), you need to emit this signal yourself or the graph won't get updated.

void QBarDataProxy::insertRow(int rowIndex, QBarDataRow *row)

Inserts a new row into rowIndex. If rowIndex is equal to array size, rows are added to end of the array. Any existing row labels are not affected.

Note: Row labels array will be out of sync with row array after this call, if there were labeled rows beyond the inserted row.

void QBarDataProxy::insertRow(int rowIndex, QBarDataRow *row, const QString &label)

Inserts a new row with the label into rowIndex. If rowIndex is equal to array size, rows are added to end of the array.

void QBarDataProxy::insertRows(int rowIndex, const QBarDataArray &rows)

Inserts new rows into rowIndex. If rowIndex is equal to array size, rows are added to end of the array. Any existing row labels are not affected.

Note: Row labels array will be out of sync with row array after this call, if there were labeled rows beyond the inserted rows.

void QBarDataProxy::insertRows(int rowIndex, const QBarDataArray &rows, const QStringList &labels)

Inserts new rows with labels into rowIndex. If rowIndex is equal to array size, rows are added to end of the array.

const QBarDataItem *QBarDataProxy::itemAt(int rowIndex, int columnIndex) const

Returns pointer to the item at rowIndex, columnIndex. It is guaranteed to be valid only until the next call that modifies data.

const QBarDataItem *QBarDataProxy::itemAt(const QPoint &position) const

Returns pointer to the item at position. The X-value of position indicates the row and the Y-value indicates the column. The item is guaranteed to be valid only until the next call that modifies data.

[signal] void QBarDataProxy::itemChanged(int rowIndex, int columnIndex)

Emitted when an item has changed. Provides rowIndex and columnIndex of changed item. If you change an item directly in the array without calling setItem(), you need to emit this signal yourself or the graph won't get updated.

void QBarDataProxy::removeRows(int rowIndex, int removeCount, bool removeLabels = true)

Removes removeCount rows staring at rowIndex. Attempting to remove rows past the end of the array does nothing. If removeLabels is true, corresponding row labels are also removed. Otherwise the row labels are not affected.

Note: If removeLabels is false, the row labels array will be out of sync with the row array if there are labeled rows beyond the removed rows.

void QBarDataProxy::resetArray()

Clears the existing array and row and column labels.

void QBarDataProxy::resetArray(QBarDataArray *newArray)

Takes ownership of the newArray. Clears the existing array if the newArray is different from the existing array. If it's the same array, this just triggers arrayReset() signal. Passing null array deletes the old array and creates a new empty array. Row and column labels are not affected.

void QBarDataProxy::resetArray(QBarDataArray *newArray, const QStringList &rowLabels, const QStringList &columnLabels)

Takes ownership of the newArray. Clears the existing array if the newArray is different from the existing array. If it's the same array, this just triggers arrayReset() signal. Passing a null array deletes the old array and creates a new empty array. The rowLabels and columnLabels lists specify the new labels for rows and columns.

const QBarDataRow *QBarDataProxy::rowAt(int rowIndex) const

Returns pointer to the row at rowIndex. It is guaranteed to be valid only until the next call that modifies data.

[signal] void QBarDataProxy::rowsAdded(int startIndex, int count)

Emitted when rows have been added. Provides startIndex and count of rows added. If you add rows directly to the array without calling addRow() or addRows(), you need to emit this signal yourself or the graph won't get updated.

[signal] void QBarDataProxy::rowsChanged(int startIndex, int count)

Emitted when rows have changed. Provides startIndex and count of changed rows. If you change rows directly in the array without calling setRow() or setRows(), you need to emit this signal yourself or the graph won't get updated.

[signal] void QBarDataProxy::rowsInserted(int startIndex, int count)

Emitted when rows have been inserted. Provides startIndex and count of inserted rows. If you insert rows directly into the array without calling insertRow() or insertRows(), you need to emit this signal yourself or the graph won't get updated.

[signal] void QBarDataProxy::rowsRemoved(int startIndex, int count)

Emitted when rows have been removed. Provides startIndex and count of rows removed. Index is the current array size if rows were removed from the end of the array. If you remove rows directly from the array without calling removeRows(), you need to emit this signal yourself or the graph won't get updated.

void QBarDataProxy::setItem(int rowIndex, int columnIndex, const QBarDataItem &item)

Changes a single item at rowIndex, columnIndex to the item.

void QBarDataProxy::setItem(const QPoint &position, const QBarDataItem &item)

Changes a single item at position to the item. The X-value of position indicates the row and the Y-value indicates the column.

void QBarDataProxy::setRow(int rowIndex, QBarDataRow *row)

Changes existing rows by replacing a row at rowIndex with a new row. The row can be the same as the existing row already stored at the rowIndex. Existing row labels are not affected.

void QBarDataProxy::setRow(int rowIndex, QBarDataRow *row, const QString &label)

Changes existing rows by replacing a row at rowIndex with row. The row can be the same as the existing row already stored at the rowIndex. Changes the row label to the label.

void QBarDataProxy::setRows(int rowIndex, const QBarDataArray &rows)

Changes existing rows by replacing a rows starting at rowIndex with rows. Existing row labels are not affected. The rows in the rows array can be the same as the existing rows already stored at the rowIndex.

void QBarDataProxy::setRows(int rowIndex, const QBarDataArray &rows, const QStringList &labels)

Changes existing rows by replacing a rows starting at rowIndex with rows. The row labels are changed to labels. The rows in the rows array can be the same as the existing rows already stored at the rowIndex.

Related Non-Members

typedef QtDataVisualization::QBarDataArray

A list of pointers to QBarDataRows.

typedef QtDataVisualization::QBarDataRow

A vector of QBarDataItems.

© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.