ProjectTree: Refactor editCurrentItem()

Change-Id: Id848b608e256b95e9704d61d1926d05625106ecc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Alexander Akulich
2018-03-07 13:09:28 +03:00
committed by Alexandr Akulich
parent 97ede133a9
commit 783b310ee6

View File

@@ -411,8 +411,11 @@ void ProjectTreeWidget::collapseAll()
void ProjectTreeWidget::editCurrentItem() void ProjectTreeWidget::editCurrentItem()
{ {
m_delayedRename.clear(); m_delayedRename.clear();
if (m_view->selectionModel()->currentIndex().isValid()) const QModelIndex currentIndex = m_view->selectionModel()->currentIndex();
m_view->edit(m_view->selectionModel()->currentIndex()); if (!currentIndex.isValid())
return;
m_view->edit(currentIndex);
} }
void ProjectTreeWidget::renamed(const FileName &oldPath, const FileName &newPath) void ProjectTreeWidget::renamed(const FileName &oldPath, const FileName &newPath)