Bypass widget options setup when they are not available #890

This commit is contained in:
eshifri
2021-10-27 09:41:54 +10:00
committed by Peter Feerick
parent 3041185ec3
commit 7aec59f05c
2 changed files with 7 additions and 4 deletions
+5 -3
View File
@@ -124,14 +124,16 @@ SetupWidgetsPageSlot::SetupWidgetsPageSlot(FormGroup * parent, const rect_t & re
menu->addLine(factory->getName(), [=]() {
container->createWidget(slotIndex, factory);
auto widget = container->getWidget(slotIndex);
new WidgetSettings(parent, widget);
if(widget->getOptions() && widget->getOptions()->name)
new WidgetSettings(parent, widget);
});
}
});
if (container->getWidget(slotIndex)) {
menu->addLine(TR_WIDGET_SETTINGS, [=]() {
auto widget = container->getWidget(slotIndex);
auto widget = container->getWidget(slotIndex);
if(widget->getOptions() && widget->getOptions()->name)
menu->addLine(TR_WIDGET_SETTINGS, [=]() {
new WidgetSettings(parent, widget);
});
menu->addLine(STR_REMOVE_WIDGET, [=]() {
+2 -1
View File
@@ -38,7 +38,8 @@ static void openWidgetMenu(Widget * parent)
menu->addLine("Full screen", [=]() {
parent->setFullscreen(true);
});
menu->addLine(TR_WIDGET_SETTINGS, [=]() {
if(parent->getOptions() && parent->getOptions()->name)
menu->addLine(TR_WIDGET_SETTINGS, [=]() {
new WidgetSettings(parent, parent);
});
}