From b8e16c3bddb706ecc195e86eaafb89ed90f9bfc3 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 24 Feb 2012 20:35:27 +0100 Subject: Implement MappingTreeWidget This is a rather large commit. It implements MappingTreeWidget using MappingTreeModel unsurprisingly this uncovered some exciting bugs. Fixes the following bugs in MappingTreeModel: * use insertRows() and removeRows() when addings children, because dataChanged() won't do it. * don't use a prepared QSqlQuery when fetching children recursively. This won't work because the query is still active when we invoke ourselves again. Put the query on the stack instead * Keep the model sorted. Also add an entry for a MappingTreeEditor to the File-Menu. --- smtreemodel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'smtreemodel.cpp') diff --git a/smtreemodel.cpp b/smtreemodel.cpp index 86d2b77..98e7e45 100644 --- a/smtreemodel.cpp +++ b/smtreemodel.cpp @@ -40,9 +40,10 @@ int SmTreeModel::columnCount(const QModelIndex &parent) const{ } QModelIndex SmTreeModel::index(int row, int column, const QModelIndex &parent) const{ - if(parent.isValid() && (parent.column() != 0)){ + //this is totally bogus! Why? Tentatively leaving it in for now... + if(parent.isValid() && (parent.column() != 0)){ return QModelIndex(); - } + } SmTreeItem *parentItem = itemAt(parent); SmTreeItem *childItem = parentItem->child(row); if(childItem){ -- cgit v1.2.3-70-g09d2