From d9ed1e53b7ea0c994972f4628a4dbb431fdf9fde Mon Sep 17 00:00:00 2001 From: Arno Date: Wed, 21 Aug 2013 16:59:04 +0200 Subject: Fix MappingTreeModel for good * Again: remove the transaction madness besides almost everywhere leaving one instance where it is actually useful. * Hide the buttons to add and delete mapping types. Haven't thought that through complete. What should be deleted on cascade? Do we really want/ --- mappingtreewidget.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'mappingtreewidget.cpp') diff --git a/mappingtreewidget.cpp b/mappingtreewidget.cpp index 8522f8b..1bb093f 100644 --- a/mappingtreewidget.cpp +++ b/mappingtreewidget.cpp @@ -6,20 +6,20 @@ */ #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include +#include #include #include -#include -#include +#include +#include #include #include @@ -49,10 +49,14 @@ MappingTreeWidget::MappingTreeWidget(QWidget *parent) : QWidget(parent){ mTypeBox = new QComboBox; mTypeBox->setModel(mTypesModel); connect(mTypeBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(typeChanged(QString))); + /* Hide buttons, this doesn't really work, + * but keep them for future use :) */ mAddType = new QPushButton(tr("Add &type")); connect(mAddType, SIGNAL(clicked()), this, SLOT(addType())); + mAddType->setHidden(true); mDeleteType = new QPushButton(tr("Delete type")); connect(mDeleteType, SIGNAL(clicked()), this, SLOT(deleteType())); + mDeleteType->setHidden(true); QHBoxLayout *typesButtonLayout = new QHBoxLayout; typesButtonLayout->addWidget(mDeleteType); typesButtonLayout->addWidget(mAddType); @@ -149,6 +153,8 @@ void MappingTreeWidget::addType(){ if(idxOf != -1){ mTypeBox->setCurrentIndex(idxOf); } + }else{ + QMessageBox::critical(this, tr("Error"), tr("Failed to add type. Most likely it already exists!")); } } -- cgit v1.2.3-70-g09d2