From 5beb56a09363197e23a630d3fd2f71899d7f00a0 Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 13 Oct 2013 06:37:16 +0200 Subject: Fix renaming mapping items for pics With some GNOME themes the edit trigger for SmTreeModel is borked. The current name is mixed with the new one, and one can't recognize anything. Use a QInputDialog instead. --- mappingtreewidget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'mappingtreewidget.cpp') diff --git a/mappingtreewidget.cpp b/mappingtreewidget.cpp index 1bb093f..873afd2 100644 --- a/mappingtreewidget.cpp +++ b/mappingtreewidget.cpp @@ -226,8 +226,14 @@ void MappingTreeWidget::typeChanged(QString type){ void MappingTreeWidget::editChild(){ QModelIndex sel = selected(); - if(sel.isValid()){ - mTree->edit(sel); + QString question = QString("Rename %1").arg(sel.data(MappingTreeModel::NameRole).toString()); + bool ok = false; + QString newName = QInputDialog::getText(mTree, tr("Rename"), question, QLineEdit::Normal, sel.data(MappingTreeModel::NameRole).toString(), &ok); + if(ok){ + QModelIndex real = mProxy->mapToSource(sel); + if(real.isValid()){ + mModel->renameChild(real, newName); + } } } -- cgit v1.2.3-70-g09d2