mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 20:03:53 +08:00
update mads settings button on show event
This commit is contained in:
@@ -27,13 +27,12 @@ SunnypilotPanel::SunnypilotPanel(SettingsWindowSP *parent) : QFrame(parent) {
|
||||
madsToggle->setConfirmation(true, false);
|
||||
list->addItem(madsToggle);
|
||||
|
||||
SubPanelButton *madsSettingsButton = new SubPanelButton(tr("Customize MADS"));
|
||||
madsSettingsButton = new SubPanelButton(tr("Customize MADS"));
|
||||
madsSettingsButton->setObjectName("mads_btn");
|
||||
connect(madsSettingsButton, &QPushButton::clicked, [=]() {
|
||||
sunnypilotScroller->setLastScrollPosition();
|
||||
main_layout->setCurrentWidget(madsWidget);
|
||||
});
|
||||
madsSettingsButton->setEnabled(madsToggle->isToggled());
|
||||
QObject::connect(madsToggle, &ToggleControl::toggleFlipped, madsSettingsButton, &SubPanelButton::setEnabled);
|
||||
|
||||
madsWidget = new MadsSettings(this);
|
||||
@@ -86,5 +85,7 @@ void SunnypilotPanel::updateToggles(bool _offroad) {
|
||||
toggle->setEnabled(_offroad);
|
||||
}
|
||||
|
||||
madsSettingsButton->setEnabled(madsToggle->isToggled());
|
||||
|
||||
offroad = _offroad;
|
||||
}
|
||||
|
||||
@@ -35,5 +35,6 @@ private:
|
||||
bool offroad;
|
||||
|
||||
ParamControl *madsToggle;
|
||||
SubPanelButton *madsSettingsButton;
|
||||
MadsSettings *madsWidget = nullptr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user