[propertypairoutputaction] fix: enabled/visible atributes were not handled

Dieser Commit ist enthalten in:
Reinder Feenstra 2025-10-05 19:16:52 +02:00
Ursprung 1febe9ef18
Commit ec885d70d8

Datei anzeigen

@ -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