WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. | Zuble QML Types | Zuble C++ Classes | Zuble Overview |
Zuble
0.1
Zuble Framework C++/QML extension API
|
This two dimensional table model is used to store and manipulate data. More...
#include <ZTableModel.h>
Public Slots | |
void | moveModelToThread (QThread *targetThread) |
void | invalidateModel () |
Resets the model. More... | |
Signals | |
void | tableModified (int dataRole, int rowNumber) |
Sent when a table cell has been modified. More... | |
void | tableModelReset () |
Sent when the table model has been reset. More... | |
Public Member Functions | |
ZTableModel (QObject *parent=0) | |
int | getUserRole () |
Returns the value of Qt::UserRole. ie: the first role number available for user defined roles. More... | |
int | getRoleCount () const |
Returns the number of roles defined for this model. More... | |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
QAbstractTableModel override. More... | |
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
QAbstractTableModel override. More... | |
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
QAbstractTableModel override. More... | |
virtual QHash< int, QByteArray > | roleNames () const |
QAbstractTableModel override. More... | |
Q_INVOKABLE void | dumpModelData () const |
dumps diagnostic information about the model to the debug output. More... | |
Q_INVOKABLE void | putValue (int role, int row, const QVariant &value) |
Sets the value of the specified cell in the data set. More... | |
Q_INVOKABLE void | putValue (int role, int row, int column, const QVariant &value) |
Sets the value of the specified cell in the data set. More... | |
Q_INVOKABLE QVariant | getValue (int role, int row) |
Obtains the value of the specified data cell. More... | |
Q_INVOKABLE QVariant | getValue (int role, int row, int column) |
Obtains the value of the specified data cell. More... | |
Q_INVOKABLE QVariant | getTableColumnRows (QList< int > roles, int startRow, int col, int rowCount) |
Obtain data values for a set of rows from a single model column. More... | |
Q_INVOKABLE void | putTableColumnRows (QVariant rows, int startRow, int col) |
Replaces the current value for a set of rows for a single model column. More... | |
Q_INVOKABLE void | sendTableColumnRows (QVariant rows, int startRow, int col) |
Asynchronously replaces the current value for a set of rows for a single model column. More... | |
Q_INVOKABLE void | appendRow (QVariant data) |
Q_INVOKABLE void | appendRows (QVariant data) |
Q_INVOKABLE void | appendRow (ZRoleRow roleRow) |
Q_INVOKABLE int | appendRowIndex (ZRoleRow roleRow) |
Q_INVOKABLE void | appendRows (ZRoleRowList roleRowList) |
Q_INVOKABLE void | prependRow (QVariant data) |
Q_INVOKABLE void | prependRows (QVariant data) |
Q_INVOKABLE void | prependRow (ZRoleRow roleRow) |
Q_INVOKABLE void | prependRows (ZRoleRowList roleRowList) |
Q_INVOKABLE void | removeRow (int row) |
Q_INVOKABLE void | removeRows (int row, int count) |
Q_INVOKABLE void | truncate (int rowCount, bool removeFromFront=false) |
Q_INVOKABLE bool | copyColumn (int fromColumn, int toColumn) |
Q_INVOKABLE void | appendCells (QVariant data, bool truncateModel=false) |
Asynchronously converts an array of cell data into one or more rows of model data and appends it to the model. More... | |
Q_INVOKABLE void | prependCells (QVariant data, bool truncateModel=false) |
Asynchronously converts an array of cell data into one or more rows of model data and prepends it to the model. More... | |
Q_INVOKABLE int | modelRowCount () const |
Returns the number of rows in the data set. This method may block the current thread. More... | |
Q_INVOKABLE void | setColumnCount (int count) |
Sets the number of columns the table will contain. This method may block the current thread. More... | |
Q_INVOKABLE int | modelColumnCount () const |
Returns the number of columns in the data set. This method may block the current thread. More... | |
Q_INVOKABLE bool | addRole (int roleNumber) |
Adds the specified role to the data model. This method may block the current thread. More... | |
Q_INVOKABLE bool | addRole (int roleNumber, const QString &roleName) |
Adds the specified role to the data model. This method may block the current thread. More... | |
Q_INVOKABLE QList< int > | roles () const |
Determines which roles are in the data set. This method may block the current thread. More... | |
Q_INVOKABLE QVariantMap | roleMap () const |
Determines which roles are in the data set. This method may block the current thread. More... | |
Q_INVOKABLE void | clearRoles () |
Removes all roles, role names and data from the model. More... | |
Q_INVOKABLE void | clearData () |
Removes all data from the model. Roles and role names remain intact. More... | |
Q_INVOKABLE int | findNextItemRow (int startRow, const QString &text, int column=0, bool caseSensitive=true, bool forwardDirection=true, bool keySearch=false) const |
Searches for the specified text from startIndex. More... | |
Q_INVOKABLE void | appendMissingRow (ZRoleRow roleRow, const QString &keyText, int keyColumn=0) |
Appends the specified row if no rows contain the specified text in the specified column. Otherwise does nothing. More... | |
Q_INVOKABLE void | appendMissingRow (QVariant roleRow, const QString &keyText, int keyColumn=0) |
Appends the specified row if no rows contain the specified text in the specified column. Otherwise does nothing. More... | |
Q_INVOKABLE bool | writeData (QVariant jsonData) |
Writes data from the specified JSON object into the data table. Previous data in the table is discarded. More... | |
Q_INVOKABLE QVariant | readData () const |
Returns a JSON object containing a copy of the table data. Data in the table is unaffected. Data is formatted as for ZTableModel::writeData(QVariant jsonData) More... | |
Q_INVOKABLE void | putJsonData (QJsonObject data) |
Writes data from the specified JSON object into the data table. Previous contents of the data table are lost. More... | |
Q_INVOKABLE QJsonObject | getJsonData () const |
Copies data from the table model into a newly created JSON object and returns it. More... | |
Q_INVOKABLE void | sync () |
Blocks thread until model's event queue has been processed. More... | |
Static Public Member Functions | |
static void | registerType () |
Registers ZTableModel as a QML type. More... | |
Protected Member Functions | |
void | insertTableColumnRows (QVariant rows, int startRow, int col, bool asynchronous) |
Q_INVOKABLE void | mergeCells (QVariant data, bool front=true, bool truncateModel=true) |
Converts an array of cell data into one or more rows of model data and either appends or prepends it to the model. More... | |
ZRoleRow | coalesceCellRow (const ZDataRow cells, int startIndex, int columnCount, const QList< int > roles, int &nextIndex) |
ZRoleRowList | coalesceCellRows (const ZDataRow cells, int columnCount, const QList< int > roles) |
Static Protected Member Functions | |
static void | registerLogCategory () |
Protected Attributes | |
ZblDataModel | m_model |
int | m_defaultRole |
The role used for data access methods that don't specify a role. More... | |
Properties | |
int | userRole |
Returns the value of Qt::UserRole to javascript client code. ie: the first role number available for user defined roles. More... | |
int | roleCount |
Returns the number of roles defined for this model. More... | |
Friends | |
class | ZblLogManager |
This two dimensional table model is used to store and manipulate data.
Data models provide a means of transferring data between Zuble threads and QML views. Data is typically transferred from background to foreground threads for display purposes, however the models can support transferring data between any thread.
When transferring data between threads create the data model in the data consumer thread and then pass a reference to the model to the data producer thread.
This table is backed by an N-dimensional data storage engine. Set the column count > 1 and use getValue(int role, int row, int column), appendCells(), and prependCells() to access third dimension.
Definition at line 96 of file ZTableModel.h.
|
explicit |
Definition at line 41 of file ZTableModel.cpp.
bool Zbl::ZTableModel::addRole | ( | int | roleNumber | ) |
Adds the specified role to the data model. This method may block the current thread.
This method must be called before adding rows to the table. It will fail if called when the table contains data.
roleNumber | The role number to add. |
Definition at line 946 of file ZTableModel.cpp.
Referenced by addRole(), Zbl::ZblLogManager::createLogBufferModel(), Zbl::ZblLogReclinkData::createMapModel(), Zbl::ZblLogManager::createRuleModel(), Zbl::ZblLogManager::getLogRules(), Zbl::ZLogMap::getReader(), Zbl::ZblLogSearch::getSearchRolesName(), Zbl::ZsqlQuery::getTableModel(), Zbl::ZLogBookmark::logMapType(), and Zbl::ZLogViewport::ZLogViewport().
bool Zbl::ZTableModel::addRole | ( | int | roleNumber, |
const QString & | roleName | ||
) |
Adds the specified role to the data model. This method may block the current thread.
This method must be called before adding rows to the table. It will fail if called when the table contains data.
roleNumber | The role number to add. |
roleName | Name of the role to add. |
Definition at line 968 of file ZTableModel.cpp.
void Zbl::ZTableModel::appendCells | ( | QVariant | data, |
bool | truncateModel = false |
||
) |
Asynchronously converts an array of cell data into one or more rows of model data and appends it to the model.
Data cells are assigned to roles in ascending order from smallest to largest role number. The cell array must contain an integral number of cells such that no row is incomplete. (ie cell count must be modulo role count)
data | A QVariant containing a ZDataRow object (QList<QVariant>). Javascript can pass an Array object. (ie. multiple roles/cell) |
truncateModel | true to remove an equal number of rows from the opposite side of the model, false to leave model intact |
Definition at line 736 of file ZTableModel.cpp.
Referenced by Zbl::ZLogReader::appendSearchModel(), Zbl::ZLogMap::getReader(), Zbl::ZblLogReclinkData::onSearchRowMatched(), Zbl::ZblLogWorker::outputLogMessage(), Zbl::ZblLogAgent::outputLogMessage(), Zbl::ZblLogSearch::populateLinkModel(), and Zbl::ZblLogReader::storeViewportData().
void Zbl::ZTableModel::appendMissingRow | ( | ZRoleRow | roleRow, |
const QString & | keyText, | ||
int | keyColumn = 0 |
||
) |
Appends the specified row if no rows contain the specified text in the specified column. Otherwise does nothing.
roleRow | data row to append if text not found |
keyText | the text to search for |
column | the column to search (default = 0) |
Definition at line 417 of file ZTableModel.cpp.
Referenced by appendMissingRow(), and Zbl::ZblLogManager::appendRuleModelCategory().
void Zbl::ZTableModel::appendMissingRow | ( | QVariant | roleRow, |
const QString & | keyText, | ||
int | keyColumn = 0 |
||
) |
Appends the specified row if no rows contain the specified text in the specified column. Otherwise does nothing.
roleRow | data row to append if text not found |
keyText | the text to search for |
column | the column to search (default = 0) |
Definition at line 385 of file ZTableModel.cpp.
void Zbl::ZTableModel::appendRow | ( | QVariant | data | ) |
Definition at line 251 of file ZTableModel.cpp.
Referenced by appendMissingRow(), appendRow(), mergeCells(), and putJsonData().
void Zbl::ZTableModel::appendRow | ( | ZRoleRow | roleRow | ) |
Definition at line 307 of file ZTableModel.cpp.
int Zbl::ZTableModel::appendRowIndex | ( | ZRoleRow | roleRow | ) |
Definition at line 332 of file ZTableModel.cpp.
void Zbl::ZTableModel::appendRows | ( | QVariant | data | ) |
Definition at line 280 of file ZTableModel.cpp.
Referenced by appendRows(), Zbl::ZsqlQuery::getTableModel(), and mergeCells().
void Zbl::ZTableModel::appendRows | ( | ZRoleRowList | roleRowList | ) |
Definition at line 360 of file ZTableModel.cpp.
void Zbl::ZTableModel::clearData | ( | ) |
Removes all data from the model. Roles and role names remain intact.
Definition at line 139 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogReader::loadViewport(), and Zbl::ZLogReader::purgeSearchModel().
void Zbl::ZTableModel::clearRoles | ( | ) |
Removes all roles, role names and data from the model.
Definition at line 128 of file ZTableModel.cpp.
Referenced by Zbl::ZLogMap::getReader(), putJsonData(), and Zbl::ZTableFile::readFile().
|
protected |
Definition at line 669 of file ZTableModel.cpp.
Referenced by coalesceCellRows(), and mergeCells().
|
protected |
Definition at line 706 of file ZTableModel.cpp.
Referenced by mergeCells().
|
virtual |
QAbstractTableModel override.
Definition at line 81 of file ZTableModel.cpp.
Referenced by coalesceCellRow(), coalesceCellRows(), and data().
bool Zbl::ZTableModel::copyColumn | ( | int | fromColumn, |
int | toColumn | ||
) |
Definition at line 642 of file ZTableModel.cpp.
|
virtual |
QAbstractTableModel override.
Definition at line 93 of file ZTableModel.cpp.
void Zbl::ZTableModel::dumpModelData | ( | ) | const |
dumps diagnostic information about the model to the debug output.
Definition at line 150 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogManager::populateRegisteredRules().
int Zbl::ZTableModel::findNextItemRow | ( | int | startRow, |
const QString & | text, | ||
int | column = 0 , |
||
bool | caseSensitive = true , |
||
bool | forwardDirection = true , |
||
bool | keySearch = false |
||
) | const |
Searches for the specified text from startIndex.
startRow | index of the first row to search |
text | the text to search for |
caseSEnsitive | true for case sensitive search, false for case insensitive (default = true) |
forwardDirection | true to search forward, false to search backward (default = true) |
column | the column to search (default = 0) |
keySearch | when true column text must match exactly, when false any part of column can match (default = false) |
Definition at line 1204 of file ZTableModel.cpp.
QJsonObject Zbl::ZTableModel::getJsonData | ( | ) | const |
Copies data from the table model into a newly created JSON object and returns it.
Definition at line 1345 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogManager::saveFilterRules(), and Zbl::ZTableFile::writeFile().
int Zbl::ZTableModel::getRoleCount | ( | ) | const |
Returns the number of roles defined for this model.
Definition at line 991 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogManager::createLogBufferModel().
QVariant Zbl::ZTableModel::getTableColumnRows | ( | QList< int > | roles, |
int | startRow, | ||
int | col, | ||
int | rowCount | ||
) |
Obtain data values for a set of rows from a single model column.
Only data for the model roles specified in the roles parameter will be returned. Data is returned in a zTableRowList structure, which is a list of maps, each of which contains a data value for each role that was requested to be returned.
roles | A list of model role values determines which model roles will be returned |
startRow | The first model row to return |
col | The model column to return |
rowCount | The number of rows to return |
Definition at line 1123 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogScanner::scanModelColumnRows().
int Zbl::ZTableModel::getUserRole | ( | ) |
Returns the value of Qt::UserRole. ie: the first role number available for user defined roles.
Definition at line 58 of file ZTableModel.cpp.
QVariant Zbl::ZTableModel::getValue | ( | int | role, |
int | row | ||
) |
Obtains the value of the specified data cell.
role | the role whose value to return |
row | the cell's zero-based row number |
Definition at line 1070 of file ZTableModel.cpp.
Referenced by Zbl::ZLogViewport::getCurrentLocation(), Zbl::ZblLogReclinkData::getData(), Zbl::ZLogViewport::getNextPageLocation(), Zbl::ZblLogManager::getQtLogRulesForRow(), Zbl::ZLogMap::getReader(), Zbl::ZLogViewport::getRecordModelRow(), Zbl::ZLogViewport::getRecordSeekPos(), getValue(), Zbl::ZblLogBkSearch::onLoadComplete(), Zbl::ZLogViewport::onRowMatched(), Zbl::ZLogViewport::onUpdateBookmarks(), Zbl::ZblLogManager::onZubleSettingsModified(), Zbl::ZLogReader::purgeSearchModel(), and Zbl::ZLogReader::removeSearchModel().
QVariant Zbl::ZTableModel::getValue | ( | int | role, |
int | row, | ||
int | column | ||
) |
Obtains the value of the specified data cell.
This method allows access to the third dimension of the data model that backs ZTableModel. Use ZTableModel::setColumnCount() to set the number of columns in the third dimension.
role | the role whose value to return |
row | the cell's zero-based row number |
column | the cell's zero-based column number |
Definition at line 1096 of file ZTableModel.cpp.
|
protected |
Definition at line 1180 of file ZTableModel.cpp.
Referenced by putTableColumnRows(), and sendTableColumnRows().
|
slot |
Resets the model.
Definition at line 1447 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogSearch::onLinkTextComplete(), and Zbl::ZLogViewport::onMarkupCompleted().
|
protected |
Converts an array of cell data into one or more rows of model data and either appends or prepends it to the model.
data | A QVariant containing a ZDataRow object (QList<QVariant>). Javascript can pass an Array object. |
front | true to prepend rows, false to append rows |
truncateModel | true to remove an equal number of rows from the opposite side of the model, false to leave model intact |
Definition at line 776 of file ZTableModel.cpp.
Referenced by appendCells(), and prependCells().
int Zbl::ZTableModel::modelColumnCount | ( | ) | const |
Returns the number of columns in the data set. This method may block the current thread.
Note that the QAbstractTableModel interface allows access to only column zero. Additional columns are accessed through ZTableModel's custom interface.
Definition at line 889 of file ZTableModel.cpp.
Referenced by Zbl::ZLogViewport::loadRecords(), and Zbl::ZLogViewport::move().
int Zbl::ZTableModel::modelRowCount | ( | ) | const |
Returns the number of rows in the data set. This method may block the current thread.
Definition at line 867 of file ZTableModel.cpp.
Referenced by Zbl::ZLogMap::getReader(), Zbl::ZLogViewport::getRecordModelRow(), Zbl::ZLogViewport::getRecordSeekPos(), Zbl::ZblLogBkSearch::onLoadComplete(), Zbl::ZLogViewport::onUpdateBookmarks(), Zbl::ZLogReader::purgeSearchModel(), Zbl::ZLogReader::removeSearchModel(), and Zbl::ZblLogScanner::scanModelColumnRows().
|
slot |
Definition at line 1422 of file ZTableModel.cpp.
void Zbl::ZTableModel::prependCells | ( | QVariant | data, |
bool | truncateModel = false |
||
) |
Asynchronously converts an array of cell data into one or more rows of model data and prepends it to the model.
data | A QVariant containing a ZRoleRow object (QList<QVariant>). Javascript can pass an Array object. (ie. multiple roles/cell) |
truncateModel | true to remove an equal number of rows from the opposite side of the model, false to leave model intact |
Definition at line 757 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogReader::parseAndStoreViewportData().
void Zbl::ZTableModel::prependRow | ( | QVariant | data | ) |
Definition at line 456 of file ZTableModel.cpp.
Referenced by mergeCells(), and prependRow().
void Zbl::ZTableModel::prependRow | ( | ZRoleRow | roleRow | ) |
Definition at line 512 of file ZTableModel.cpp.
void Zbl::ZTableModel::prependRows | ( | QVariant | data | ) |
Definition at line 485 of file ZTableModel.cpp.
Referenced by mergeCells(), and prependRows().
void Zbl::ZTableModel::prependRows | ( | ZRoleRowList | roleRowList | ) |
Definition at line 537 of file ZTableModel.cpp.
void Zbl::ZTableModel::putJsonData | ( | QJsonObject | data | ) |
Writes data from the specified JSON object into the data table. Previous contents of the data table are lost.
The JSON object should be formatted to contain the following keys:
Example:
{"roles": { "4":"col-0-role-name", "5":"col-1-role-name", "10":"col-2-role-name" } "data-rows": [ ["row-0-col-0-value","row-0-col-1-value","row-0-col-2-value"] ["row-1-col-0-value","row-1-col-1-value","row-1-col-2-value"] ]}
The zero-based column number is the index into the roles array for that column. (ie: roles[0] locates the first column, roles[2] locates the last column)
data | a JSON object with the specified format. |
Zbl::ZblException |
Definition at line 1240 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogManager::loadFilterRules(), and Zbl::ZTableFile::readFile().
void Zbl::ZTableModel::putTableColumnRows | ( | QVariant | rows, |
int | startRow, | ||
int | col | ||
) |
Replaces the current value for a set of rows for a single model column.
This method will block if this object is not in the same thread as the caller. Only data for the model roles contained in the rows parameter is replaced. Values for roles not contained in the rows parameter are not modified by this method.
rows | A QVaraint containing a zTableRowList structure containing the row data to be replaced |
startRow | The row number of the first row to be replaced |
col | The column number of the row to be replaced |
Definition at line 1154 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogScanner::scanModelColumnRows().
void Zbl::ZTableModel::putValue | ( | int | role, |
int | row, | ||
const QVariant & | value | ||
) |
Sets the value of the specified cell in the data set.
Definition at line 172 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogSearch::onLinkTextComplete(), Zbl::ZLogViewport::onRowMatched(), and Zbl::ZLogViewport::onUpdateBookmarks().
void Zbl::ZTableModel::putValue | ( | int | role, |
int | row, | ||
int | column, | ||
const QVariant & | value | ||
) |
Sets the value of the specified cell in the data set.
Definition at line 210 of file ZTableModel.cpp.
Q_INVOKABLE QVariant Zbl::ZTableModel::readData | ( | ) | const |
Returns a JSON object containing a copy of the table data. Data in the table is unaffected. Data is formatted as for ZTableModel::writeData(QVariant jsonData)
|
staticprotected |
Definition at line 47 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogManager::zInit().
|
static |
Registers ZTableModel as a QML type.
Definition at line 52 of file ZTableModel.cpp.
Referenced by Zbl::Zblcore::registerTypes().
void Zbl::ZTableModel::removeRow | ( | int | row | ) |
Definition at line 566 of file ZTableModel.cpp.
Referenced by Zbl::ZLogReader::removeSearchModel().
void Zbl::ZTableModel::removeRows | ( | int | row, |
int | count | ||
) |
Definition at line 571 of file ZTableModel.cpp.
Referenced by removeRow(), and truncate().
QVariantMap Zbl::ZTableModel::roleMap | ( | ) | const |
Determines which roles are in the data set. This method may block the current thread.
Definition at line 1033 of file ZTableModel.cpp.
|
virtual |
QAbstractTableModel override.
Definition at line 119 of file ZTableModel.cpp.
Referenced by dumpModelData(), getJsonData(), and roleMap().
QList< int > Zbl::ZTableModel::roles | ( | ) | const |
Determines which roles are in the data set. This method may block the current thread.
Definition at line 1012 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogManager::createRuleModel(), getJsonData(), and mergeCells().
|
virtual |
QAbstractTableModel override.
Definition at line 65 of file ZTableModel.cpp.
Referenced by coalesceCellRows(), data(), getJsonData(), Zbl::ZLogViewport::getNextPageLocation(), mergeCells(), Zbl::ZLogViewport::move(), putJsonData(), Zbl::ZblLogManager::setQtLogRulesFromModel(), and truncate().
void Zbl::ZTableModel::sendTableColumnRows | ( | QVariant | rows, |
int | startRow, | ||
int | col | ||
) |
Asynchronously replaces the current value for a set of rows for a single model column.
This method is the same as putTableColumnRows() except that this method returns immediately and performs the model update some time in the future. Note that readers of the model will continue to see old model data for the specified cells until the asynchronous update occurrs.
Only data for the model roles contained in the rows parameter is replaced. Values for roles not contained in the rows parameter are not modified by this method.
rows | A QVaraint containing a zTableRowList structure containing the row data to be replaced |
startRow | The row number of the first row to be replaced |
col | The column number of the row to be replaced |
Definition at line 1167 of file ZTableModel.cpp.
void Zbl::ZTableModel::setColumnCount | ( | int | count | ) |
Sets the number of columns the table will contain. This method may block the current thread.
Although the table model allows only 2 dimensions (row X role) to be accessed through the QAbstractTableModel interface the ZTableModel class provides an additional axis of data storage (row X role X column) that is accessible through ZTableModel's custom interface.
This method must be called before adding rows to the table. It will fail if called when the table contains data.
count | The number of columns to allocate for the data model. |
Definition at line 927 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogManager::createLogBufferModel(), Zbl::ZblLogReclinkData::createMapModel(), Zbl::ZblLogManager::createRuleModel(), Zbl::ZLogMap::getReader(), Zbl::ZsqlQuery::getTableModel(), and Zbl::ZLogViewport::ZLogViewport().
void Zbl::ZTableModel::sync | ( | ) |
Blocks thread until model's event queue has been processed.
This method should be called by background threads after updating the data model to ensure updates have completed before using model.
Definition at line 910 of file ZTableModel.cpp.
Referenced by Zbl::ZblLogReader::move(), and Zbl::ZblLogManager::saveFilterRules().
|
signal |
Sent when the table model has been reset.
|
signal |
Sent when a table cell has been modified.
dataRole | The role number that was modified |
rowNumber | The row that was modified |
Referenced by Zbl::ZblLogManager::createRuleModel(), and putValue().
void Zbl::ZTableModel::truncate | ( | int | rowCount, |
bool | removeFromFront = false |
||
) |
Definition at line 604 of file ZTableModel.cpp.
Referenced by mergeCells(), Zbl::ZblLogManager::timerEvent(), and Zbl::ZLogViewport::timerEvent().
Q_INVOKABLE bool Zbl::ZTableModel::writeData | ( | QVariant | jsonData | ) |
Writes data from the specified JSON object into the data table. Previous data in the table is discarded.
The JSON object should be formatted to contain the following keys:
Column names will become role names in the data model. Example:
{"column-names": [ "col-1","col-2","col-3"] "column-headers": [ "header-1","header-2","header-3"] "data": [ ["value-1","value-2","value-3"] ["value-4","value-5","value-6"] ]}
jsonData | a JSON object constructed with the specified format |
|
friend |
Definition at line 100 of file ZTableModel.h.
|
protected |
The role used for data access methods that don't specify a role.
Definition at line 661 of file ZTableModel.h.
|
protected |
Definition at line 655 of file ZTableModel.h.
Referenced by addRole(), appendMissingRow(), appendRow(), appendRowIndex(), appendRows(), clearData(), clearRoles(), columnCount(), copyColumn(), data(), dumpModelData(), findNextItemRow(), getJsonData(), getRoleCount(), getTableColumnRows(), getValue(), insertTableColumnRows(), mergeCells(), modelColumnCount(), modelRowCount(), prependRow(), prependRows(), putJsonData(), putValue(), removeRows(), roleNames(), roles(), rowCount(), setColumnCount(), and truncate().
|
read |
Returns the number of roles defined for this model.
Definition at line 125 of file ZTableModel.h.
Referenced by coalesceCellRow(), coalesceCellRows(), getJsonData(), mergeCells(), and putJsonData().
|
read |
Returns the value of Qt::UserRole to javascript client code. ie: the first role number available for user defined roles.
Definition at line 119 of file ZTableModel.h.
Zuble documentation copyright © 2019 Bob Dinitto. 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. Zuble is a derivative work of Qt version 5. 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.