diff options
Diffstat (limited to 'mappingtreewidget.cpp')
-rw-r--r-- | mappingtreewidget.cpp | 28 |
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); |