Commit 83db0835 authored by con's avatar con
Browse files

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
parent 276f71b1
......@@ -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);
......
......@@ -109,7 +109,7 @@ private slots:
void revertCurrentItem();
void updateButtons(const QModelIndex &index);
void updateCurrentItem();
void add();
void addTool();
void removeTool();
void addCategory();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment