diff options
author | Daniel Teske <daniel.teske@digia.com> | 2012-09-20 11:16:47 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-09-21 15:57:44 +0200 |
commit | a8d0b04f49e9372846daa409e6e111dec49154f6 (patch) | |
tree | 7b3bd621005960d6eb72befead439fc370e4d4ed /src/plugins/projectexplorer/targetsettingspanel.cpp | |
parent | 2f3b010d4b7dd4044886c5d0b186b26715f6e9b7 (diff) | |
download | qt-creator-a8d0b04f49e9372846daa409e6e111dec49154f6.tar.gz |
Show incompatible kits in Add Kit
And implement a tooltip for them
Task-number: QTCREATORBUG-7870
Change-Id: I4975dd24ca2b619ebcbd0393f97311590ed4930f
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/projectexplorer/targetsettingspanel.cpp')
-rw-r--r-- | src/plugins/projectexplorer/targetsettingspanel.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 1d2b7d36cc..b8075e71e0 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -55,6 +55,7 @@ #include <QStackedWidget> #include <QToolTip> #include <QVBoxLayout> +#include <QToolTip> using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; @@ -68,7 +69,8 @@ TargetSettingsPanelWidget::TargetSettingsPanelWidget(Project *project) : m_currentTarget(0), m_project(project), m_selector(0), - m_centralWidget(0) + m_centralWidget(0), + m_lastAction(0) { Q_ASSERT(m_project); @@ -97,6 +99,33 @@ TargetSettingsPanelWidget::~TargetSettingsPanelWidget() { } +bool TargetSettingsPanelWidget::event(QEvent *event) +{ + if (event->type() == QEvent::StatusTip) { + QStatusTipEvent *ev = static_cast<QStatusTipEvent *>(event); + ev->accept(); + + QAction *act = m_addMenu->activeAction(); + if (act != m_lastAction) + QToolTip::showText(QPoint(), QString()); + m_lastAction = act; + if (act) { + QRect actionRect = m_addMenu->actionGeometry(act); + actionRect.translate(m_addMenu->pos()); + QPoint p = QCursor::pos(); + if (!actionRect.contains(p)) + p = actionRect.center(); + p.setY(actionRect.center().y()); + QToolTip::showText(p, ev->tip(), m_addMenu, m_addMenu->actionGeometry(act)); + } else { + QToolTip::showText(QPoint(), QString()); + } + + return true; + } + return QWidget::event(event); +} + void TargetSettingsPanelWidget::setupUi() { QVBoxLayout *viewLayout = new QVBoxLayout(this); @@ -315,11 +344,14 @@ void TargetSettingsPanelWidget::updateTargetAddAndRemoveButtons() foreach (Kit *k, KitManager::instance()->kits()) { if (m_project->target(k)) continue; - if (!m_project->supportsKit(k)) - continue; QAction *action = new QAction(k->displayName(), m_addMenu); action->setData(QVariant::fromValue(k->id())); + QString errorMessage; + if (!m_project->supportsKit(k, &errorMessage)) { + action->setEnabled(false); + action->setStatusTip(errorMessage); + } bool inserted = false; foreach (QAction *existing, m_addMenu->actions()) { |