浏览代码

Fix text buf does not clear when calling the method set_item_text in PopupMenu

风青山 3 年之前
父节点
当前提交
f789c17690
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      scene/gui/popup_menu.cpp

+ 4 - 0
scene/gui/popup_menu.cpp

@@ -1003,8 +1003,12 @@ void PopupMenu::set_item_text(int p_idx, const String &p_text) {
 		p_idx += get_item_count();
 	}
 	ERR_FAIL_INDEX(p_idx, items.size());
+	if (items[p_idx].text == p_text) {
+		return;
+	}
 	items.write[p_idx].text = p_text;
 	items.write[p_idx].xl_text = atr(p_text);
+	items.write[p_idx].dirty = true;
 	_shape_item(p_idx);
 
 	control->update();