From 83db0835fcfde057a18cc3c432704302f5fffb68 Mon Sep 17 00:00:00 2001 From: con Date: Fri, 4 Mar 2011 09:08:12 +0100 Subject: [PATCH] Make it possible to add tools again. Moving from tool button to push button was removing the button's "clicked" feature. I opted for adding a "Add Tool" item to the button's menu, because adding a separate "Add Category" push button grabs huge amount of horizontal space. Task-number: QTCREATORBUG-3913 --- .../coreplugin/dialogs/externaltoolconfig.cpp | 12 ++++++------ src/plugins/coreplugin/dialogs/externaltoolconfig.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index 20a317a75c6..4ae03da172e 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -416,11 +416,13 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) : connect(ui->inputText, SIGNAL(textChanged()), this, SLOT(updateCurrentItem())); connect(ui->revertButton, SIGNAL(clicked()), this, SLOT(revertCurrentItem())); - connect(ui->addButton, SIGNAL(clicked()), this, SLOT(add())); connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(removeTool())); QMenu *menu = new QMenu(ui->addButton); ui->addButton->setMenu(menu); + QAction *addTool = new QAction(tr("Add Tool"), this); + menu->addAction(addTool); + connect(addTool, SIGNAL(triggered()), this, SLOT(addTool())); QAction *addCategory = new QAction(tr("Add Category"), this); menu->addAction(addCategory); connect(addCategory, SIGNAL(triggered()), this, SLOT(addCategory())); @@ -566,13 +568,11 @@ void ExternalToolConfig::revertCurrentItem() showInfoForItem(index); } -void ExternalToolConfig::add() +void ExternalToolConfig::addTool() { QModelIndex currentIndex = ui->toolTree->selectionModel()->currentIndex(); - if (!currentIndex.isValid()) { - addCategory(); - return; - } + if (!currentIndex.isValid()) // default to Uncategorized + currentIndex = m_model->index(0, 0); QModelIndex index = m_model->addTool(currentIndex); ui->toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Clear); ui->toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent); diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.h b/src/plugins/coreplugin/dialogs/externaltoolconfig.h index 13304b18b86..444e4129038 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.h +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.h @@ -109,7 +109,7 @@ private slots: void revertCurrentItem(); void updateButtons(const QModelIndex &index); void updateCurrentItem(); - void add(); + void addTool(); void removeTool(); void addCategory();