update mads settings button on show event

This commit is contained in:
Jason Wen
2025-01-04 20:19:46 -05:00
parent b8c0399ab7
commit efa9c321c2
2 changed files with 4 additions and 2 deletions

View File

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

View File

@@ -35,5 +35,6 @@ private:
bool offroad;
ParamControl *madsToggle;
SubPanelButton *madsSettingsButton;
MadsSettings *madsWidget = nullptr;
};