forked from qt-creator/qt-creator
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
This commit is contained in:
@@ -416,11 +416,13 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
|
|||||||
connect(ui->inputText, SIGNAL(textChanged()), this, SLOT(updateCurrentItem()));
|
connect(ui->inputText, SIGNAL(textChanged()), this, SLOT(updateCurrentItem()));
|
||||||
|
|
||||||
connect(ui->revertButton, SIGNAL(clicked()), this, SLOT(revertCurrentItem()));
|
connect(ui->revertButton, SIGNAL(clicked()), this, SLOT(revertCurrentItem()));
|
||||||
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(add()));
|
|
||||||
connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(removeTool()));
|
connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(removeTool()));
|
||||||
|
|
||||||
QMenu *menu = new QMenu(ui->addButton);
|
QMenu *menu = new QMenu(ui->addButton);
|
||||||
ui->addButton->setMenu(menu);
|
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);
|
QAction *addCategory = new QAction(tr("Add Category"), this);
|
||||||
menu->addAction(addCategory);
|
menu->addAction(addCategory);
|
||||||
connect(addCategory, SIGNAL(triggered()), this, SLOT(addCategory()));
|
connect(addCategory, SIGNAL(triggered()), this, SLOT(addCategory()));
|
||||||
@@ -566,13 +568,11 @@ void ExternalToolConfig::revertCurrentItem()
|
|||||||
showInfoForItem(index);
|
showInfoForItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalToolConfig::add()
|
void ExternalToolConfig::addTool()
|
||||||
{
|
{
|
||||||
QModelIndex currentIndex = ui->toolTree->selectionModel()->currentIndex();
|
QModelIndex currentIndex = ui->toolTree->selectionModel()->currentIndex();
|
||||||
if (!currentIndex.isValid()) {
|
if (!currentIndex.isValid()) // default to Uncategorized
|
||||||
addCategory();
|
currentIndex = m_model->index(0, 0);
|
||||||
return;
|
|
||||||
}
|
|
||||||
QModelIndex index = m_model->addTool(currentIndex);
|
QModelIndex index = m_model->addTool(currentIndex);
|
||||||
ui->toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Clear);
|
ui->toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Clear);
|
||||||
ui->toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent);
|
ui->toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent);
|
||||||
|
@@ -109,7 +109,7 @@ private slots:
|
|||||||
void revertCurrentItem();
|
void revertCurrentItem();
|
||||||
void updateButtons(const QModelIndex &index);
|
void updateButtons(const QModelIndex &index);
|
||||||
void updateCurrentItem();
|
void updateCurrentItem();
|
||||||
void add();
|
void addTool();
|
||||||
void removeTool();
|
void removeTool();
|
||||||
void addCategory();
|
void addCategory();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user