Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Add button when theme item name is empty #86044

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Dec 11, 2023

Theme editor has Add button that does nothing if name is empty. This PR disables it when not available.

godot.windows.editor.dev.x86_64_Jy8wt5m37x.mp4

@YuriSizov YuriSizov modified the milestones: 4.x, 4.3 Dec 18, 2023
@@ -2850,6 +2853,11 @@ void ThemeTypeEditor::_add_default_type_items() {
ur->commit_action();
}

void ThemeTypeEditor::_update_add_button(const String &p_text, LineEdit *p_for_edit) {
Button *button = Object::cast_to<Button>(p_for_edit->get_meta("button"));
button->set_disabled(p_text.strip_edges().is_empty());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this logic of strip_edges().is_empty() is used relatively often it makes me wonder if it'd be worth it to add a convenience function that just checks if a string is non-empty after that operation, in this case if it has any codepoints > 32, will see about it later

@YuriSizov YuriSizov merged commit 2552821 into godotengine:master Dec 18, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@KoBeWi KoBeWi deleted the can't_add_if_can't_add branch December 18, 2023 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants