diff --git a/client/src/widget/propertypairoutputaction.cpp b/client/src/widget/propertypairoutputaction.cpp index 376c1ed1..62eb23fb 100644 --- a/client/src/widget/propertypairoutputaction.cpp +++ b/client/src/widget/propertypairoutputaction.cpp @@ -3,7 +3,7 @@ * * This file is part of the traintastic source code. * - * Copyright (C) 2024 Reinder Feenstra + * Copyright (C) 2024-2025 Reinder Feenstra * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,11 +33,31 @@ PropertyPairOutputAction::PropertyPairOutputAction(Property& property, QWidget* setFocusPolicy(Qt::StrongFocus); + setEnabled(m_property.getAttributeBool(AttributeName::Enabled, true)); + setVisible(m_property.getAttributeBool(AttributeName::Visible, true)); + connect(&m_property, &Property::valueChanged, this, [this]() { update(rect()); }); + connect(&m_property, &Property::attributeChanged, + [this](AttributeName name, const QVariant& value) + { + switch(name) + { + case AttributeName::Enabled: + setEnabled(value.toBool()); + break; + + case AttributeName::Visible: + setVisible(value.toBool()); + break; + + default: + break; + } + }); } PairOutputAction PropertyPairOutputAction::value() const