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. --- smglobals.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'smglobals.cpp') diff --git a/smglobals.cpp b/smglobals.cpp index 5f26725..0cd0714 100644 --- a/smglobals.cpp +++ b/smglobals.cpp @@ -26,6 +26,7 @@ #include "filestreemodel.h" #include "mappingtablemodel.h" #include "seriesmetadatamodel.h" +#include "mappingtreemodel.h" #include "pictureviewer.h" SmGlobals *SmGlobals::mInstance = 0; @@ -86,7 +87,13 @@ QAbstractItemModel *SmGlobals::model(const QString &which){ SeriesMetadataModel *model = new SeriesMetadataModel(headers); mModels.insert(which, model); } - } + }else if(which == "MappingTree"){ + if(!mModels.contains("MappingTree")){ + QStringList headers = QStringList() << tr("Name") << tr("Id") << tr("Date"); + MappingTreeModel *model = new MappingTreeModel(headers); + mModels.insert(which, model); + } + } return mModels.contains(which) ? mModels.value(which) : 0; } -- cgit v1.2.3-70-g09d2