4#include <State/MessageListSerialization.hpp>
5#include <State/Widgets/AddressValidator.hpp>
7#include <score/model/Skin.hpp>
8#include <score/widgets/ValidationPalette.hpp>
10#include <Explorer/Explorer/DeviceExplorerModel.hpp>
13#include <QGuiApplication>
25template <
class Val
idator_T,
class Parent_T>
35 connect(
this, &QLineEdit::textChanged,
this, &AddressLineEditBase::updatePalette);
41 m_local = std::move(f);
42 updatePalette(this->text());
45 void updatePalette(
const QString& str)
50 if(m_validator.validate(s, i) == QValidator::State::Acceptable)
52 auto addr = State::parseAddressAccessor(s);
53 std::optional<bool> local;
55 local = m_local(addr->address);
60 validity = score::InputValidity::Invalid;
62 else if(m_model && addr)
65 if(!Device::try_getNodeFromAddress(m_model->rootNode(), addr->address))
71 validity = score::InputValidity::Invalid;
77 void dragEnterEvent(QDragEnterEvent* ev)
override
79 static_cast<Parent_T*
>(parent())->dragEnterEvent(ev);
81 void dropEvent(QDropEvent* ev)
override
83 static_cast<Parent_T*
>(parent())->dropEvent(ev);
86 Validator_T m_validator;
91template <
typename Parent_T>
99template <
typename Parent_T>
Definition NodeBasedItemModel.hpp:23
Definition AddressLineEdit.hpp:102
The AddressLineEdit class.
Definition AddressLineEdit.hpp:27
void setLocalCheck(std::function< std::optional< bool >(const State::Address &)> f)
Whether a local device address is published; nullopt for other devices.
Definition AddressLineEdit.hpp:39
Definition AddressLineEdit.hpp:94
Definition AddressValidator.hpp:28
The AddressValidator class.
Definition AddressValidator.hpp:18
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1115
void setInputValidity(QWidget &w, InputValidity v)
Tint a widget to flag what it holds, and keep the tint skin-aware.
Definition ValidationPalette.cpp:36
@ Valid
No tint: the widget inherits the application palette.
@ Unknown
Well-formed but does not resolve to anything.
The Address struct.
Definition Address.hpp:81