|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77756 - sandbox/icl/libs/xplore/br1/sqlbrowser
From: afojgo_at_[hidden]
Date: 2012-04-04 12:19:20
Author: jofaber
Date: 2012-04-04 12:19:19 EDT (Wed, 04 Apr 2012)
New Revision: 77756
URL: http://svn.boost.org/trac/boost/changeset/77756
Log:
Refresh after edge change.
Text files modified:
sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp | 9 +++++----
sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.cpp | 31 ++++++++++++++++++-------------
sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h | 5 +++--
3 files changed, 26 insertions(+), 19 deletions(-)
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp 2012-04-04 12:19:19 EDT (Wed, 04 Apr 2012)
@@ -118,6 +118,7 @@
QVector<QVariant> data(dag::edge::sizeOf_edge);
pDagModel->fillDummyData(data, idIndex.data().toInt());
pDagModel->appendEdge(data);
+ pDagModel->makeDag();
pDagModel->setupDag();
}
@@ -136,9 +137,9 @@
QSqlQuery curQuery = QSqlQuery(sqlEdit->toPlainText(), connectionWidget->currentDatabase());
- QStringList headers;
+ QStringList headers; //JODO handle headers
headers << tr("Title") << tr("Description");
- DagModel* dagmo = new DagModel(headers); // Dag-Model
+ DagModel* dagmo = new DagModel(); // Dag-Model
QSqlQuery xpQuery = QSqlQuery("", connectionWidget->currentDatabase());
QString dbg_query = QString(sqlEdit->toPlainText());
@@ -205,9 +206,9 @@
QSqlQuery curQuery = QSqlQuery(dagSql, connectionWidget->currentDatabase());
- QStringList headers;
+ QStringList headers; //JODO handle headers
headers << tr("Title") << tr("Description");
- DagModel* dagmo = new DagModel(headers); // Dag-Model
+ DagModel* dagmo = new DagModel(); // Dag-Model
QSqlQuery xpQuery = QSqlQuery("", connectionWidget->currentDatabase());
xpQuery.exec(dagSql);
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.cpp
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.cpp (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.cpp 2012-04-04 12:19:19 EDT (Wed, 04 Apr 2012)
@@ -13,21 +13,13 @@
using namespace boost;
-DagModel::DagModel(const QStringList &headers, //const QString &data,
- QObject *parent)
+DagModel::DagModel(QObject *parent)
: QAbstractItemModel(parent)
{
- QVector<QVariant> rootData;
- foreach (QString header, headers)
- rootData << header;
-
- rootData.resize(dag::node::sizeOf_node);
- rootData[dag::node::posId] = QVariant(0);
- rootData[dag::node::posName] = QVariant("NIL");
- m_rootItem = new DagItem(rootData);
- //setupModelData(data.split(QString("\n")), m_rootItem);
+ m_rootItem = createDagItem();
}
+
/* JODO
DagModel::DagModel(const QStringList &headers, const QString &data,
QObject *parent)
@@ -42,6 +34,17 @@
}
*/
+DagItem* DagModel::createDagItem()
+{
+ QVector<QVariant> rootData;
+ rootData.resize(dag::node::sizeOf_node);
+ rootData[dag::node::posId] = QVariant(0);
+ rootData[dag::node::posName] = QVariant("NIL");
+ return new DagItem(rootData);
+}
+
+
+
DagModel::~DagModel()
{
delete m_rootItem;
@@ -322,6 +325,8 @@
void DagModel::makeDag()
{
+ m_dag.clear();
+
m_nodeAttributes = get(Dag::attribute_tag(), m_dag);
for(tEdgeList::iterator iter = m_edges.begin(); iter != m_edges.end(); iter++)
@@ -447,9 +452,9 @@
{
data[m_parentId] = QVariant(nodeId);
data[m_childId] = QVariant(num_edges());
- data[m_typeId] = QVariant(-9);
+ data[m_typeId] = QVariant(1);
data[m_parentName] = QVariant("Parent Name");
data[m_childName] = QVariant("Child Name");
- data[m_childType] = QVariant(-9);
+ data[m_childType] = QVariant(0);
}
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h 2012-04-04 12:19:19 EDT (Wed, 04 Apr 2012)
@@ -33,8 +33,7 @@
public:
//DagModel(const QStringList &headers, const QString &data,
// QObject *parent = 0);
- DagModel(const QStringList &headers, //const QString &data,
- QObject *parent = 0);
+ DagModel(QObject *parent = 0);
~DagModel();
QVariant data(const QModelIndex &index, int role) const;
@@ -86,6 +85,8 @@
int num_edges()const { return boost::num_edges(m_dag); }
private:
+ DagItem* createDagItem();
+
void setupModelData(const QStringList &lines, DagItem *parent);
DagItem *getItem(const QModelIndex &index) const;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk