Skip to content
Snippets Groups Projects
Commit 265c164c authored by Alice Russell's avatar Alice Russell
Browse files

Re #27587 Make suggested changes

-Change behaviour of double click so error does not appear if clicking on the category
-SelectFunctionDialog changed to be modal
parent 69920a35
No related branches found
No related tags found
No related merge requests found
......@@ -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();
};
......
......@@ -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()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment