diff --git a/src/plugins/qt4projectmanager/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp
index 34d57883f66213088c873fa31f633d35fe938b1b..6c5c4c4a9ccc7021ffbbc089e3a5c4f3e990eece 100644
--- a/src/plugins/qt4projectmanager/qtoptionspage.cpp
+++ b/src/plugins/qt4projectmanager/qtoptionspage.cpp
@@ -370,6 +370,21 @@ int QtOptionsPageWidget::indexForTreeItem(QTreeWidgetItem *item) const
     return -1;
 }
 
+QTreeWidgetItem *QtOptionsPageWidget::treeItemForIndex(int index) const
+{
+    int uniqueId = m_versions.at(index)->uniqueId();
+    for (int i = 0; i < m_ui->qtdirList->topLevelItemCount(); ++i) {
+        QTreeWidgetItem *toplevelItem = m_ui->qtdirList->topLevelItem(i);
+        for (int j = 0; j < toplevelItem->childCount(); ++j) {
+            QTreeWidgetItem *item = toplevelItem->child(j);
+            if (item->data(0, Qt::UserRole).toInt() == uniqueId) {
+                return item;
+            }
+        }
+    }
+    return 0;
+}
+
 void QtOptionsPageWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old)
 {
     if (old) {
@@ -454,11 +469,11 @@ void QtOptionsPageWidget::fixQtVersionName(int index)
     if (index < 0)
         return;
     int count = m_versions.count();
+    QString name = m_versions.at(index)->name();
     for (int i = 0; i < count; ++i) {
         if (i != index) {
             if (m_versions.at(i)->name() == m_versions.at(index)->name()) {
                 // Same name, find new name
-                QString name = m_versions.at(index)->name();
                 QRegExp regexp("^(.*)\\((\\d)\\)$");
                 if (regexp.exactMatch(name)) {
                     // Alreay in Name (#) format
@@ -468,7 +483,7 @@ void QtOptionsPageWidget::fixQtVersionName(int index)
                 }
                 // set new name
                 m_versions[index]->setName(name);
-                m_ui->qtdirList->topLevelItem(index)->setText(0, name);
+                treeItemForIndex(index)->setText(0, name);
                 m_ui->defaultCombo->setItemText(index, name);
 
                 // Now check again...
diff --git a/src/plugins/qt4projectmanager/qtoptionspage.h b/src/plugins/qt4projectmanager/qtoptionspage.h
index a78b80460e06d14972ed11c153af702596b2d123..57275795fe6ac1e9f7fe47cc4b765869d06ba592 100644
--- a/src/plugins/qt4projectmanager/qtoptionspage.h
+++ b/src/plugins/qt4projectmanager/qtoptionspage.h
@@ -61,6 +61,7 @@ private:
     void fixQtVersionName(int index);
     int indexForWidget(QWidget *debuggingHelperWidget) const;
     int indexForTreeItem(QTreeWidgetItem *item) const;
+    QTreeWidgetItem *treeItemForIndex(int index) const;
 
     Internal::Ui::QtVersionManager *m_ui;
     QList<QtVersion *> m_versions;