summaryrefslogtreecommitdiffstats
path: root/mappingtreewidget.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2014-06-29 09:41:30 +0200
committerArno <am@disconnect.de>2014-06-29 09:41:30 +0200
commitf295cfb8672d97bb5c804499bdb311a9a0d8039b (patch)
tree77b54514e17d6bb453bd9431707f9f37954c9fc2 /mappingtreewidget.cpp
parentb5bd9cf0b981ee0c87ead9e20c36247932de7818 (diff)
downloadSheMov-f295cfb8672d97bb5c804499bdb311a9a0d8039b.tar.gz
SheMov-f295cfb8672d97bb5c804499bdb311a9a0d8039b.tar.bz2
SheMov-f295cfb8672d97bb5c804499bdb311a9a0d8039b.zip
Major rework of MappingTreeResultView + Model
Well, I hope this fixes the crashes for good. String comparison for looking up the parents really wasn't a prudent thing to do... Use the ParentIds instead.
Diffstat (limited to 'mappingtreewidget.cpp')
-rw-r--r--mappingtreewidget.cpp28
1 files changed, 2 insertions, 26 deletions
diff --git a/mappingtreewidget.cpp b/mappingtreewidget.cpp
index dcf96e1..c2da053 100644
--- a/mappingtreewidget.cpp
+++ b/mappingtreewidget.cpp
@@ -101,9 +101,6 @@ MappingTreeWidget::MappingTreeWidget(QWidget *parent) : QWidget(parent){
mEditChildA = new QAction(tr("Edit..."), this);
connect(mEditChildA, SIGNAL(triggered()), this, SLOT(editChild()));
mTree->addAction(mEditChildA);
- mMoveChildA = new QAction(tr("Move..."), this);
- connect(mMoveChildA, SIGNAL(triggered()), this, SLOT(moveChild()));
- mTree->addAction(mMoveChildA);
//widget layout and tab order
QVBoxLayout *mainLayout = new QVBoxLayout;
@@ -133,11 +130,6 @@ void MappingTreeWidget::addChild(){
if(value.isEmpty()){
return;
}
- if(value.contains(mModel->forbidden())){
- QString msg = QString(tr("Value contains illegal string \"%1\"")).arg(mModel->forbidden());
- QMessageBox::critical(this, tr("Error"), msg);
- return;
- }
QModelIndex parent = mModel->rootIndex();
if(!dlg.createRoot()){
QModelIndex sel = selected();
@@ -213,8 +205,8 @@ void MappingTreeWidget::deleteType(){
}
}
-void MappingTreeWidget::selectPath(const QString &path){
- QModelIndex pathIdx = mModel->indexFromPath(path);
+void MappingTreeWidget::selectPath(const QList<int> &data){
+ QModelIndex pathIdx = mModel->indexFromParentPath(data, true);
if(!pathIdx.isValid()){
return;
}
@@ -259,22 +251,6 @@ void MappingTreeWidget::selectionChanged(){
emit mappingChanged(real.data(MappingTreeModel::MappingIdRole).toInt());
}
-void MappingTreeWidget::moveChild(){
- QString path = QInputDialog::getItem(this, tr("Move item"), tr("Move to:"), mModel->paths(), -1, false);
- if(!path.isEmpty()){
- QModelIndex sel = selected();
- QModelIndex realSource = mProxy->mapToSource(sel);
- QModelIndex dest = mModel->indexFromPath(path);
- if(dest == realSource){
- QMessageBox::critical(this, tr("Error"), tr("Destination cannot be the source!"));
- return;
- }
- if(realSource.isValid() && dest.isValid()){
- mModel->move(realSource, dest);
- }
- }
-}
-
void MappingTreeWidget::filter(){
QString filter = mFilter->text();
mProxy->setFilter(filter);