[QObject] potentially fixed bugui/issues/7
This commit is contained in:
parent
ab1d9f0594
commit
aa25f22053
6 changed files with 18 additions and 13 deletions
2
Hardware/3rdparty/bugui
vendored
2
Hardware/3rdparty/bugui
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 995dc6e2b40dae91b0782dba7f9ce712fec10b53
|
||||
Subproject commit 9e937d4c88c835428ec30373f8a866854555b3ee
|
|
@ -118,6 +118,3 @@ void Controller::on_right(bool pressed)
|
|||
}
|
||||
|
||||
} // namespace hardware
|
||||
|
||||
#include <wobjectimpl.h>
|
||||
W_OBJECT_IMPL(Hardware::Controller)
|
||||
|
|
|
@ -12,10 +12,7 @@ namespace Hardware
|
|||
{
|
||||
class SCORE_ADDON_HARDWARE_EXPORT Controller final
|
||||
: public bugui::controller<Controller>
|
||||
, public QObject
|
||||
{
|
||||
W_OBJECT(Controller)
|
||||
|
||||
public:
|
||||
explicit Controller(const score::DocumentContext& document,
|
||||
Scenario::IntervalModel& interval,
|
||||
|
|
|
@ -27,8 +27,7 @@ DocumentPlugin::DocumentPlugin(const score::DocumentContext& doc, QObject* paren
|
|||
, ctrlr{nullptr}
|
||||
{
|
||||
auto& set = m_context.app.settings<Settings::Model>();
|
||||
QString d = set.getDevice();
|
||||
if (d != "None") create(d);
|
||||
create(set.getDevice());
|
||||
|
||||
con(set,
|
||||
&Settings::Model::DeviceChanged,
|
||||
|
@ -47,6 +46,7 @@ void DocumentPlugin::on_documentClosing()
|
|||
void DocumentPlugin::create(const QString& device_name)
|
||||
{
|
||||
if (ctrlr) cleanup();
|
||||
if (device_name == "None") return;
|
||||
|
||||
auto& doc = m_context.document.model().modelDelegate();
|
||||
auto scenar = safe_cast<Scenario::ScenarioDocumentModel*>(&doc);
|
||||
|
|
|
@ -15,7 +15,8 @@ ScenarioWidget::ScenarioWidget(Scenario::ProcessModel* scenario,
|
|||
|
||||
connect(model,
|
||||
&Scenario::ProcessModel::intervalMoved,
|
||||
[this] { update(); });
|
||||
this,
|
||||
&ScenarioWidget::on_interval_changed);
|
||||
|
||||
for(Scenario::IntervalModel& i : model->intervals)
|
||||
add_widget<IntervalWidget>(i, this);
|
||||
|
@ -27,6 +28,14 @@ ScenarioWidget::ScenarioWidget(Scenario::ProcessModel* scenario,
|
|||
add_widget<TimeSyncWidget>(t, this);
|
||||
}
|
||||
|
||||
ScenarioWidget::~ScenarioWidget()
|
||||
{
|
||||
disconnect(model,
|
||||
&Scenario::ProcessModel::intervalMoved,
|
||||
this,
|
||||
&ScenarioWidget::on_interval_changed);
|
||||
}
|
||||
|
||||
int ScenarioWidget::x() const
|
||||
{
|
||||
return bugui::base_widget::parent->x();
|
||||
|
@ -67,7 +76,7 @@ void ScenarioWidget::on_interval_removed(const Scenario::IntervalModel& interval
|
|||
update();
|
||||
}
|
||||
|
||||
void ScenarioWidget::on_interval_changed(const Scenario::IntervalModel&)
|
||||
void ScenarioWidget::on_interval_changed(const Scenario::IntervalModel*)
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ namespace Hardware
|
|||
{
|
||||
class ScenarioWidget final
|
||||
: public bugui::container_widget
|
||||
, public QObject
|
||||
, public Nano::Observer
|
||||
, public QObject
|
||||
{
|
||||
W_OBJECT(ScenarioWidget)
|
||||
|
||||
|
@ -19,6 +19,8 @@ public:
|
|||
explicit ScenarioWidget(Scenario::ProcessModel* scenario,
|
||||
bugui::container_widget* parent);
|
||||
|
||||
~ScenarioWidget() override;
|
||||
|
||||
int x() const override;
|
||||
int y() const override;
|
||||
int width() const override;
|
||||
|
@ -29,7 +31,7 @@ public:
|
|||
private:
|
||||
void on_interval_added(Scenario::IntervalModel& interval);
|
||||
void on_interval_removed(const Scenario::IntervalModel& interval);
|
||||
void on_interval_changed(const Scenario::IntervalModel&);
|
||||
void on_interval_changed(const Scenario::IntervalModel*);
|
||||
|
||||
void on_time_sync_added(Scenario::TimeSyncModel& timeSync);
|
||||
void on_time_sync_removed(const Scenario::TimeSyncModel& timeSync);
|
||||
|
|
Loading…
Add table
Reference in a new issue