Mantid
Loading...
Searching...
No Matches
TableWidgetValidators.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2024 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8#include "DllOption.h"
9#include <QLineEdit>
10#include <qstyleditemdelegate.h>
11#include <string>
12
13namespace {
14const std::string DEFAULT_REGEX = "(0|[1-9][0-9]*)";
15constexpr auto DEFAULT_NUMERICAL_PRECISION = 6;
16} // namespace
17
18namespace MantidQt {
19namespace MantidWidgets {
20
22
24EXPORT_OPT_MANTIDQT_COMMON QString makeQStringNumber(double value, int precision);
25
26class EXPORT_OPT_MANTIDQT_COMMON RegexInputDelegate : public QStyledItemDelegate {
27public:
28 RegexInputDelegate(QWidget *parent = nullptr, const std::string &validator = DEFAULT_REGEX);
29 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const override;
30
31private:
32 QRegExp m_validator;
33};
34
35class EXPORT_OPT_MANTIDQT_COMMON NumericInputDelegate : public QStyledItemDelegate {
36public:
37 NumericInputDelegate(QWidget *parent = nullptr, int = DEFAULT_NUMERICAL_PRECISION);
38 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const override;
39 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
40
41private:
43};
44
45} // namespace MantidWidgets
46} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition DllOption.h:15
double value
The value of the point.
Definition FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
EXPORT_OPT_MANTIDQT_COMMON QString makeQStringNumber(double value, int precision)
EXPORT_OPT_MANTIDQT_COMMON std::string getRegexValidatorString(const RegexValidatorStrings &validatorMask)
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...