Newer
Older
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTIDWIDGETS_SELECTFUNCTIONDIALOG_H_
#define MANTIDWIDGETS_SELECTFUNCTIONDIALOG_H_
//--------------------------------------------------
// Includes
//--------------------------------------------------
namespace Ui {
class SelectFunctionDialog;
namespace MantidQt {
namespace MantidWidgets {
/**
* Select a function type out of a list of available ones.
*/
class EXPORT_OPT_MANTIDQT_COMMON SelectFunctionDialog : public QDialog {
/// Default constructor
SelectFunctionDialog(QWidget *parent = nullptr);
/// Constructor overload with categories to restrict to
SelectFunctionDialog(QWidget *parent,
const std::vector<std::string> &restrictions);
~SelectFunctionDialog() override;
/// Return selected function
QString getFunction() const;
/// Clear the text in the search box
void clearSearchBoxText() const;
protected:
/// Ui elements form
Ui::SelectFunctionDialog *m_form;
private:
/// Construct QTreeWidget with categories and functions
void
constructFunctionTree(const std::map<std::string, std::vector<std::string>>
&categoryFunctionsMap,
const std::vector<std::string> &restrictions);
private slots:
void searchBoxChanged(const QString &text);
void functionDoubleClicked(QTreeWidgetItem *item);
void acceptFunction();
void rejectFunction();
} // namespace MantidWidgets
} // namespace MantidQt
#endif // MANTIDWIDGETS_SELECTFUNCTIONDIALOG_H_