25template <
typename T>
void sortPair(std::pair<T, T> &pair) {
26 if (pair.first > pair.second) {
28 pair.first = pair.second;
33bool doesExistInADS(std::string
const &workspaceName) {
39 return "The group workspace " + group->getName() +
" is empty.";
42 std::find_if(std::cbegin(*group), std::cend(*group), [](
const auto &
workspace) {
return !
workspace; });
43 if (it != std::cend(*group))
44 return "The group workspace " + group->getName() +
" contains an invalid workspace.";
65 if (field->text().trimmed().isEmpty()) {
86 QString text = field->text();
87 QValidator::State fieldState = field->validator()->validate(text, dummyPos);
89 if (fieldState == QValidator::Acceptable) {
109 if (workspaceSelector->currentText() ==
"") {
158 if (range.second == range.first) {
163 if (range.second < range.first) {
164 addErrorMessage(
"The start of " + name +
" must be less than the end.");
182 if (!(rangeA.second < rangeB.first || rangeB.second < rangeA.first)) {
183 QString message = QString(
"The ranges must not overlap: [%1,%2], [%3,%4].")
206 const QString &innerName, std::pair<double, double> inner) {
210 if (inner.first < outer.first || inner.second > outer.second) {
211 addErrorMessage(outerName +
" must completely enclose " + innerName +
".");
233 addErrorMessage(
"The start of a binning range must be less than the end.");
253 addErrorMessage(
"Bin width must allow for even splitting of the range.");
273 std::stringstream msg;
274 msg << name.toStdString() <<
" (" <<
x <<
")"
275 <<
" should not be equal to " <<
y <<
".";
276 QString msgStr = QString::fromStdString(msg.str());
292 if (workspaceName.isEmpty())
295 if (!doesExistInADS(workspaceName.toStdString())) {
323 std::size_t
const &validSize) {
324 if (
workspace->getNumberHistograms() != validSize) {
353 std::size_t
const &validSize) {
354 if (
workspace->x(0).size() != validSize) {
372 if (checkWorkspaceType<WorkspaceGroup>(groupName, inputType,
"WorkspaceGroup", silent)) {
373 if (
auto const group = getADSWorkspace<WorkspaceGroup>(groupName.toStdString())) {
374 if (
auto const error = containsInvalidWorkspace(group)) {
423 if (errorLabel ==
nullptr)
428 QPalette palette = errorLabel->palette();
429 palette.setColor(errorLabel->foregroundRole(), Qt::red);
430 errorLabel->setPalette(palette);
432 errorLabel->setText(
"*");
434 errorLabel->setText(
"");
438 errorLabel->setVisible(!valid);
IPeaksWorkspace_sptr workspace
double lower
lower and upper bounds on the multiplier, if known
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< const WorkspaceGroup > WorkspaceGroup_const_sptr
shared pointer to Mantid::API::WorkspaceGroup, pointer to const version
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::string to_string(const wide_integer< Bits, Signed > &n)