Open Project: Don't show a error dialog for duplicated projects

Instead, switch to edit mode, show sidebar, scroll to project,
and show a tooltip next to the project.

The tooltip is somewhat easy to miss, but this is a clear improvement
in most cases.

Change-Id: Icd27f76e7d434f33e731b6fd56473ff913986a89
Task-number: QTCREATORBUG-8422
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Daniel Teske
2015-08-20 14:47:02 +02:00
parent bce3335365
commit b82311024d
17 changed files with 175 additions and 59 deletions

View File

@@ -48,6 +48,7 @@
#include <utils/navigationtreeview.h>
#include <utils/algorithm.h>
#include <utils/tooltip/tooltip.h>
#include <QDebug>
#include <QSettings>
@@ -480,6 +481,17 @@ void ProjectTreeWidget::sync(Node *node)
setCurrentItem(node);
}
void ProjectTreeWidget::showMessage(Node *node, const QString &message)
{
QModelIndex idx = m_model->indexForNode(node);
m_view->setCurrentIndex(idx);
m_view->scrollTo(idx);
QPoint pos = m_view->mapToGlobal(m_view->visualRect(idx).bottomLeft());
pos -= Utils::ToolTip::offsetFromPosition();
Utils::ToolTip::show(pos, message);
}
void ProjectTreeWidget::showContextMenu(const QPoint &pos)
{
QModelIndex index = m_view->indexAt(pos);
@@ -563,7 +575,7 @@ ProjectTreeWidgetFactory::ProjectTreeWidgetFactory()
{
setDisplayName(tr("Projects"));
setPriority(100);
setId("Projects");
setId(ProjectExplorer::Constants::PROJECTTREE_ID);
setActivationSequence(QKeySequence(UseMacShortcuts ? tr("Meta+X") : tr("Alt+X")));
}