Magnum::Ui::ValidatedInput class

Validated input.

A version of Input that validates input against passed std::regex. Connects to the valueChanged() signal and sets style to either Style::Default or Style::Warning based on whether the value matches the regular expression or not.

Base classes

class Input
Input widget.

Public static functions

static auto allValid(std::initializer_list<std::reference_wrapper<const ValidatedInput>> inputs) -> bool
If values of all inputs are valid.

Constructors, destructors, conversion operators

ValidatedInput(Plane& plane, const Anchor& anchor, const std::regex& validator, std::string value, std::size_t maxValueSize, Style style = Style::Default) explicit
Constructor.
ValidatedInput(Plane& plane, const Anchor& anchor, std::regex&& validator, std::string value, std::size_t maxValueSize, Style style = Style::Default) deleted explicit
ValidatedInput(Plane& plane, const Anchor& anchor, const std::regex& validator, std::size_t maxValueSize, Style style = Style::Default) explicit
ValidatedInput(Plane& plane, const Anchor& anchor, std::regex&& validator, std::size_t maxValueSize, Style style = Style::Default) deleted explicit

Public functions

auto isValid() const -> bool
If the value is valid.

Function documentation

static bool Magnum::Ui::ValidatedInput::allValid(std::initializer_list<std::reference_wrapper<const ValidatedInput>> inputs)

If values of all inputs are valid.

Convenience alternative to calling isValid() in a loop. Returns false if one of the passed input values is not valid, true otherwise. In particular, returns true also for an empty list.

Magnum::Ui::ValidatedInput::ValidatedInput(Plane& plane, const Anchor& anchor, const std::regex& validator, std::string value, std::size_t maxValueSize, Style style = Style::Default) explicit

Constructor.

Parameters
plane Plane this widget is a part of
anchor Positioning anchor
validator Validator regex
value Initial input value
maxValueSize Max input text size
style Widget style

The caller is expected to keep validator in scope for the whole instance lifetime.

Magnum::Ui::ValidatedInput::ValidatedInput(Plane& plane, const Anchor& anchor, std::regex&& validator, std::string value, std::size_t maxValueSize, Style style = Style::Default) explicit deleted

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Ui::ValidatedInput::ValidatedInput(Plane& plane, const Anchor& anchor, const std::regex& validator, std::size_t maxValueSize, Style style = Style::Default) explicit

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Ui::ValidatedInput::ValidatedInput(Plane& plane, const Anchor& anchor, std::regex&& validator, std::size_t maxValueSize, Style style = Style::Default) explicit deleted

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool Magnum::Ui::ValidatedInput::isValid() const

If the value is valid.