|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77333 - sandbox/icl/libs/xplore/br1/sqlbrowser
From: afojgo_at_[hidden]
Date: 2012-03-14 12:46:46
Author: jofaber
Date: 2012-03-14 12:46:45 EDT (Wed, 14 Mar 2012)
New Revision: 77333
URL: http://svn.boost.org/trac/boost/changeset/77333
Log:
Populating a DAG model from sql. Tweaks.
Text files modified:
sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.cpp | 18 +++++++++++++++---
sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h | 2 ++
2 files changed, 17 insertions(+), 3 deletions(-)
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-03-14 12:46:45 EDT (Wed, 14 Mar 2012)
@@ -320,18 +320,30 @@
QString DagModel::nodeToString(DagItem* node, int depth)const
{
if(node->childCount()==0)
- return tr("(%1)").arg(depth); //Print only structure and depth.
+ return tr("%1(%2)\n").arg(indentation(depth), depth); //Print only structure and depth.
else
{
- QString nodeRepr(tr("["));
+ QString indent = indentation(depth);
+
+ QVariant parentNameV = node->data(m_childName);
+ QString parentName = parentNameV.toString();
+ QString nodeRepr( tr("%1[%2\n").arg(indentation(depth), parentName) ); //, node->data[m_parentName]);
for(int idx=0; idx<node->childCount(); idx++)
nodeRepr += nodeToString(node->child(idx), depth+1);
- nodeRepr += tr("]");
+ nodeRepr += tr("%1]\n").arg(indentation(depth));
return nodeRepr;
}
}
+QString DagModel::indentation(int depth)const
+{
+ QString indent;
+ for(int idx=0; idx < depth; idx++)
+ indent += " ";
+ return indent;
+}
+
void DagModel::fillData(QVector<QVariant>& data, QSqlQuery& query)
{
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-03-14 12:46:45 EDT (Wed, 14 Mar 2012)
@@ -71,6 +71,8 @@
DagItem *getItem(const QModelIndex &index) const;
void fillData(QVector<QVariant>& data, QSqlQuery& query);
+ QString indentation(int depth)const;
+
DagItem *rootItem;
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