summaryrefslogtreecommitdiffstats
path: root/mappingtreewidget.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-08-21 16:59:04 +0200
committerArno <am@disconnect.de>2013-08-21 16:59:04 +0200
commitd9ed1e53b7ea0c994972f4628a4dbb431fdf9fde (patch)
tree609df5caae9dd9cb6d29c228f3d408053297e69c /mappingtreewidget.cpp
parent0f3219e77f65a4c3d67f34034e67775a32d2aacb (diff)
downloadSheMov-d9ed1e53b7ea0c994972f4628a4dbb431fdf9fde.tar.gz
SheMov-d9ed1e53b7ea0c994972f4628a4dbb431fdf9fde.tar.bz2
SheMov-d9ed1e53b7ea0c994972f4628a4dbb431fdf9fde.zip
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/
Diffstat (limited to 'mappingtreewidget.cpp')
-rw-r--r--mappingtreewidget.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/mappingtreewidget.cpp b/mappingtreewidget.cpp
index 8522f8b..1bb093f 100644
--- a/mappingtreewidget.cpp
+++ b/mappingtreewidget.cpp
@@ -6,20 +6,20 @@
*/
#include <QSortFilterProxyModel>
-#include <QtWidgets/QComboBox>
-#include <QtWidgets/QPushButton>
-#include <QtWidgets/QLineEdit>
-#include <QtWidgets/QVBoxLayout>
-#include <QtWidgets/QHBoxLayout>
-#include <QtWidgets/QInputDialog>
-#include <QtWidgets/QCheckBox>
-#include <QtWidgets/QLabel>
+#include <QComboBox>
+#include <QPushButton>
+#include <QLineEdit>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QInputDialog>
+#include <QCheckBox>
+#include <QLabel>
#include <QStringListModel>
-#include <QtWidgets/QMessageBox>
+#include <QMessageBox>
#include <QSettings>
#include <QHideEvent>
-#include <QtWidgets/QAction>
-#include <QtWidgets/QMenu>
+#include <QAction>
+#include <QMenu>
#include <QSqlError>
#include <QApplication>
@@ -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!"));
}
}