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 <QRegularExpression>
11#include <qstyleditemdelegate.h>
12#include <string>
13
14namespace {
15const std::string DEFAULT_REGEX = "(0|[1-9][0-9]*)";
16constexpr auto DEFAULT_NUMERICAL_PRECISION = 6;
17} // namespace
18
19namespace MantidQt {
20namespace MantidWidgets {
21
23
25EXPORT_OPT_MANTIDQT_COMMON QString makeQStringNumber(double value, int precision);
26
27class EXPORT_OPT_MANTIDQT_COMMON RegexInputDelegate : public QStyledItemDelegate {
28public:
29 RegexInputDelegate(QWidget *parent = nullptr, const std::string &validator = DEFAULT_REGEX);
30 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const override;
31
32private:
33 QRegularExpression m_validator;
34};
35
36class EXPORT_OPT_MANTIDQT_COMMON NumericInputDelegate : public QStyledItemDelegate {
37public:
38 NumericInputDelegate(QWidget *parent = nullptr, int = DEFAULT_NUMERICAL_PRECISION);
39 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const override;
40 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
41
42private:
44};
45
46} // namespace MantidWidgets
47} // 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...