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
ZblLogReclinkData.cpp
Go to the documentation of this file.
1 #include "ZblLogReclinkData.h"
2 #include "ZTableModel.h"
3 #include "ZLogMap.h"
4 
5 namespace Zbl
6 {
7 
9 
10 
12  : QObject(parent), m_model(0)
13 {
14  zDebug() << "Constructing ZblLogReclinkData object";
15 
16  m_model = new ZTableModel(this);
17 
18  createMapModel();
19 }
20 
21 
23 {
24  zDebug() << "Destroying ZblLogReclinkData object";
25 }
26 
27 
29 {
30 
31  //m_model->clearRoles();
32 
34 
35  m_model->addRole(ZLogMap::FirstID, "rec_id");
37  m_model->addRole(ZLogMap::MessageText, "message_text");
38 
39 }
40 
42  qint64 recordID,
43  qint64 seekPosition,
44  QList<int> modelRoles)
45 {
46  ZDataRow cellBuf;
47 
48 
49  zDebug() << "onSearchRowMatched - ID=" << recordID
50  << ", seekPos = " << seekPosition
51  << ", roles = " << modelRoles;
52 
53  cellBuf.append(recordID);
54  cellBuf.append(seekPosition);
55  cellBuf.append("hello world");
56 
57 
58  //cellBuf.append(messageText);
59 
60  //zDebug() << "inserting log record link: " << cellBuf;
61 
62  m_model->appendCells(cellBuf);
63 }
64 
65 
67 {
68  return m_model;
69 }
70 
71 
72 
74 {
75  return m_model;
76 }
77 
78 QVariant ZblLogReclinkData::getData(int index, int role)
79 {
80  return m_model->getValue(role, index, 0);
81 }
82 
83 QVariant ZblLogReclinkData::getData(int index, const QString& roleName)
84 {
85  return QVariant("no");
86 }
87 
88 
89 
90 
91 
92 } // Zbl
ZTableModel * m_model
The log map data model used for map node display.
QVariant getData(int index, int role)
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 t...
void onSearchRowMatched(qint64 recordID, qint64 seekPosition, QList< int > modelRoles)
Called when the search engine has found a target record in the log file.
ZBL_DECLARE_LOGGED_OBJECT bool createMapModel()
Q_INVOKABLE QVariant getValue(int role, int row)
Obtains the value of the specified data cell.
Definition: ZAndGate.cpp:6
ZTableModel * zModel()
Obtains the table model in which log record link data is stored.
#define ZBL_DEFINE_LOGGED_OBJECT(class_name)
Definition: zglobal.h:99
Explicitly shared data object encapsulates a list of log record links.
This two dimensional table model is used to store and manipulate data.
Definition: ZTableModel.h:96
#define zDebug()
Definition: zglobal.h:113
Q_INVOKABLE void setColumnCount(int count)
Sets the number of columns the table will contain. This method may block the current thread...
QObject * model()
Obtains a sorted proxy model in which log record link data is stored.
Q_INVOKABLE bool addRole(int roleNumber)
Adds the specified role to the data model. This method may block the current thread.
QList< QVariant > ZDataRow
Represents a single row (or column for column headers) of data cell values for a single role...
Definition: ZTableModel.h:57