ui: Transition offroad state for Device panel buttons (#584)

This commit is contained in:
Jason Wen
2025-01-17 21:38:29 -05:00
committed by GitHub
parent ac255742b6
commit 1a3f86a542
2 changed files with 8 additions and 0 deletions

View File

@@ -261,6 +261,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
}
});
addItem(translateBtn);
#endif
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
for (auto btn : findChildren<ButtonControl *>()) {
@@ -270,6 +271,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
}
});
#ifndef SUNNYPILOT
// power buttons
QHBoxLayout *power_layout = new QHBoxLayout();
power_layout->setSpacing(30);

View File

@@ -65,6 +65,12 @@ DevicePanelSP::DevicePanelSP(SettingsWindowSP *parent) : DevicePanel(parent) {
addItem(device_grid_layout);
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
for (auto btn : findChildren<PushButtonSP*>()) {
btn->setEnabled(offroad);
}
});
// offroad mode and power buttons
QHBoxLayout *power_layout = new QHBoxLayout();