diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/SelectFunctionDialog.h b/qt/widgets/common/inc/MantidQtWidgets/Common/SelectFunctionDialog.h index f4d6faf9e59542da3f4bd5a6b1dd4cbc3e600f2f..9402b621ddb22e8a79d1f8233a4773d7a543ffe2 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/SelectFunctionDialog.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/SelectFunctionDialog.h @@ -13,6 +13,7 @@ #include "DllOption.h" #include <QDialog> +#include <QTreeWidgetItem> #include <map> namespace Ui { @@ -53,6 +54,7 @@ private: private slots: void searchBoxChanged(const QString &text); + void functionDoubleClicked(QTreeWidgetItem *item); void acceptFunction(); void rejectFunction(); }; diff --git a/qt/widgets/common/src/SelectFunctionDialog.cpp b/qt/widgets/common/src/SelectFunctionDialog.cpp index 8afdf9f33a1df804db107a1e8f37f8757efd6b79..3c04342fd8a46a40010e243666088e7cdb9cb5a9 100644 --- a/qt/widgets/common/src/SelectFunctionDialog.cpp +++ b/qt/widgets/common/src/SelectFunctionDialog.cpp @@ -21,6 +21,7 @@ #include <QCompleter> #include <QGridLayout> #include <QGroupBox> +#include <QIcon> #include <QLabel> #include <QPushButton> #include <QVBoxLayout> @@ -43,6 +44,8 @@ SelectFunctionDialog::SelectFunctionDialog(QWidget *parent) SelectFunctionDialog::SelectFunctionDialog( QWidget *parent, const std::vector<std::string> &restrictions) : QDialog(parent), m_form(new Ui::SelectFunctionDialog) { + setModal(true); + setWindowIcon(QIcon(":/images/MantidIcon.ico")); m_form->setupUi(this); m_form->errorMessage->hide(); @@ -76,7 +79,7 @@ SelectFunctionDialog::SelectFunctionDialog( constructFunctionTree(categories, restrictions); connect(m_form->fitTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), - this, SLOT(acceptFunction())); + this, SLOT(functionDoubleClicked(QTreeWidgetItem *))); m_form->fitTree->setToolTip("Select a function type and press OK."); connect(m_form->buttonBox, SIGNAL(accepted()), this, SLOT(acceptFunction())); @@ -202,6 +205,11 @@ void SelectFunctionDialog::searchBoxChanged(const QString &text) { m_form->searchBox->setCurrentIndex(index); } +void SelectFunctionDialog::functionDoubleClicked(QTreeWidgetItem *item) { + if (item->childCount() == 0) + acceptFunction(); +} + void SelectFunctionDialog::acceptFunction() { const auto func = getFunction(); if (func.isEmpty()) {