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. --- shemov.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'shemov.cpp') diff --git a/shemov.cpp b/shemov.cpp index 9dbebe1..213e528 100644 --- a/shemov.cpp +++ b/shemov.cpp @@ -53,6 +53,7 @@ #include "mappingtableeditor.h" #include "mappingtablemodel.h" #include "dbanalyzer.h" +#include "mappingtreewidget.h" SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags), mOpenWithGroupFS(0), mOpenWithGroupAV(0) { //application icon @@ -328,6 +329,9 @@ void SheMov::createActions(){ connect(mConsistencyA, SIGNAL(triggered()), this, SLOT(checkConsistency())); mAnalyzerA = new QAction(QIcon(":/higheels.png"), tr("Analyze Db..."), this); connect(mAnalyzerA, SIGNAL(triggered()), this, SLOT(analyzeDb())); + mMappingEditorA = new QAction(tr("Mapping editor..."), this); + connect(mMappingEditorA, SIGNAL(triggered()), this, SLOT(mappingEditor())); + //connnect mQuitA = new QAction(tr("Quit"), this); mQuitA->setShortcut(tr("CTRL+q")); @@ -608,6 +612,7 @@ void SheMov::createMenus(){ fileMenu->addAction(mNewMovieWizardA); fileMenu->addAction(mConsistencyA); fileMenu->addAction(mAnalyzerA); + fileMenu->addAction(mMappingEditorA); //fileMenu->addAction(mShowNoCoverDialogA); fileMenu->addSeparator(); fileMenu->addAction(mQuitA); @@ -1015,3 +1020,12 @@ void SheMov::editMappings(QString table){ MappingTableEditor ed(table, this); ed.exec(); } + +void SheMov::mappingEditor(){ + QDialog dlg(this); + QHBoxLayout *dlgLayout = new QHBoxLayout; + MappingTreeWidget *mtw = new MappingTreeWidget; + dlgLayout->addWidget(mtw); + dlg.setLayout(dlgLayout); + dlg.exec(); +} -- cgit v1.2.3-70-g09d2