Replace String comparisons with "", String() to is_empty()
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
This commit is contained in:
parent
31ded7e126
commit
49403cbfa0
226 changed files with 1051 additions and 1034 deletions
|
|
@ -50,7 +50,7 @@ Size2 TabBar::get_minimum_size() const {
|
|||
Ref<Texture2D> tex = tabs[i].icon;
|
||||
if (tex.is_valid()) {
|
||||
ms.height = MAX(ms.height, tex->get_size().height);
|
||||
if (tabs[i].text != "") {
|
||||
if (!tabs[i].text.is_empty()) {
|
||||
ms.width += get_theme_constant(SNAME("hseparation"));
|
||||
}
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ void TabBar::_shape(int p_tab) {
|
|||
tabs.write[p_tab].text_buf->set_direction((TextServer::Direction)tabs[p_tab].text_direction);
|
||||
}
|
||||
|
||||
tabs.write[p_tab].text_buf->add_string(tabs.write[p_tab].xl_text, font, font_size, tabs[p_tab].opentype_features, (tabs[p_tab].language != "") ? tabs[p_tab].language : TranslationServer::get_singleton()->get_tool_locale());
|
||||
tabs.write[p_tab].text_buf->add_string(tabs.write[p_tab].xl_text, font, font_size, tabs[p_tab].opentype_features, !tabs[p_tab].language.is_empty() ? tabs[p_tab].language : TranslationServer::get_singleton()->get_tool_locale());
|
||||
}
|
||||
|
||||
void TabBar::_notification(int p_what) {
|
||||
|
|
@ -385,7 +385,7 @@ void TabBar::_notification(int p_what) {
|
|||
} else {
|
||||
icon->draw(ci, Point2i(w, sb->get_margin(SIDE_TOP) + ((sb_rect.size.y - sb_ms.y) - icon->get_height()) / 2));
|
||||
}
|
||||
if (tabs[i].text != "") {
|
||||
if (!tabs[i].text.is_empty()) {
|
||||
w += icon->get_width() + get_theme_constant(SNAME("hseparation"));
|
||||
}
|
||||
}
|
||||
|
|
@ -980,7 +980,7 @@ int TabBar::get_tab_width(int p_idx) const {
|
|||
Ref<Texture2D> tex = tabs[p_idx].icon;
|
||||
if (tex.is_valid()) {
|
||||
x += tex->get_width();
|
||||
if (tabs[p_idx].text != "") {
|
||||
if (!tabs[p_idx].text.is_empty()) {
|
||||
x += get_theme_constant(SNAME("hseparation"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue