[ScenarioComponent] fix Nano inheritance

This commit is contained in:
thibaud keller 2025-01-11 21:13:44 +00:00
parent c1d7604799
commit ab1d9f0594
7 changed files with 10 additions and 9 deletions

@ -1 +1 @@
Subproject commit 9a0bded62d9632d05fac99988a8c53bb5e42b7a4 Subproject commit 995dc6e2b40dae91b0782dba7f9ce712fec10b53

View file

@ -80,8 +80,7 @@ void EventWidget::on_state_added(Scenario::StateModel& state)
void EventWidget::on_state_removed(const Scenario::StateModel& state) void EventWidget::on_state_removed(const Scenario::StateModel& state)
{ {
if (state.eventId() != model.id()) if (state.eventId() != model.id()) return;
return;
remove_widget([&state] remove_widget([&state]
(const auto& w) (const auto& w)

View file

@ -5,7 +5,8 @@
namespace Hardware namespace Hardware
{ {
struct EventWidget final : ScenarioComponentSpec<Scenario::EventModel, struct EventWidget final : Nano::Observer
, ScenarioComponentSpec<Scenario::EventModel,
bugui::container_widget> bugui::container_widget>
{ {
explicit EventWidget(Scenario::EventModel& event, explicit EventWidget(Scenario::EventModel& event,

View file

@ -32,7 +32,7 @@ protected:
, skin{Process::Style::instance()} , skin{Process::Style::instance()}
{ } { }
ScenarioWidget* scenario; ScenarioWidget* scenario{nullptr};
const Process::Style& skin; const Process::Style& skin;
}; };

View file

@ -11,6 +11,7 @@ namespace Hardware
class ScenarioWidget final class ScenarioWidget final
: public bugui::container_widget : public bugui::container_widget
, public QObject , public QObject
, public Nano::Observer
{ {
W_OBJECT(ScenarioWidget) W_OBJECT(ScenarioWidget)
@ -33,7 +34,7 @@ private:
void on_time_sync_added(Scenario::TimeSyncModel& timeSync); void on_time_sync_added(Scenario::TimeSyncModel& timeSync);
void on_time_sync_removed(const Scenario::TimeSyncModel& timeSync); void on_time_sync_removed(const Scenario::TimeSyncModel& timeSync);
Scenario::ProcessModel* model; Scenario::ProcessModel* model{nullptr};
}; };
} // namespace Hardware } // namespace Hardware

View file

@ -79,8 +79,7 @@ void TimeSyncWidget::on_event_added(Scenario::EventModel& event)
void TimeSyncWidget::on_event_removed(const Scenario::EventModel& event) void TimeSyncWidget::on_event_removed(const Scenario::EventModel& event)
{ {
if (event.timeSync() != model.id()) if (event.timeSync() != model.id()) return;
return;
remove_widget([&event] remove_widget([&event]
(const auto& w) (const auto& w)

View file

@ -6,7 +6,8 @@
namespace Hardware namespace Hardware
{ {
struct TimeSyncWidget final : ScenarioComponentSpec<Scenario::TimeSyncModel, struct TimeSyncWidget final : Nano::Observer
, ScenarioComponentSpec<Scenario::TimeSyncModel,
bugui::container_widget> bugui::container_widget>
{ {
explicit TimeSyncWidget(Scenario::TimeSyncModel& timeSync, explicit TimeSyncWidget(Scenario::TimeSyncModel& timeSync,