projectexplorer: improved rename functionality

This commit is contained in:
itsmattkc
2021-09-21 11:57:26 -07:00
parent 75b4e3e257
commit f184e5cd31
+12 -7
View File
@@ -254,14 +254,19 @@ QAbstractItemView *ProjectExplorer::CurrentView() const
void ProjectExplorer::ItemClickedSlot(const QModelIndex &index) void ProjectExplorer::ItemClickedSlot(const QModelIndex &index)
{ {
if (index.isValid()) { if (index.isValid()) {
if (clicked_index_ == index) { if (CurrentView()->selectionModel()->selectedRows().size() == 1) {
// The item has been clicked more than once, start a timer for renaming if (clicked_index_ == index) {
rename_timer_.start(); // The item has been clicked more than once, start a timer for renaming
} else { rename_timer_.start();
// Cache this index for the next click } else {
clicked_index_ = index; // Cache this index for the next click
clicked_index_ = index;
// If the rename timer had started, stop it now // If the rename timer had started, stop it now
rename_timer_.stop();
}
} else {
clicked_index_ = QModelIndex();
rename_timer_.stop(); rename_timer_.stop();
} }
} else { } else {