summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-07-25 12:52:58 +0200
committerGitHub <noreply@github.com>2021-07-25 12:52:58 +0200
commitff0b5f8fa1be4ccd5b8de1d9d49f8a4b71439f63 (patch)
tree42543cc85d27d2c8692a2ced4bac5c537e402004 /scene/gui
parent2f221e5fd507b176590bda52d08e499629ce7761 (diff)
parentac3322b0af8f23e8e2dac8111200bc69b5604c9f (diff)
Merge pull request #50809 from akien-mga/iterators-const-references
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/code_edit.cpp2
-rw-r--r--scene/gui/control.cpp28
-rw-r--r--scene/gui/file_dialog.cpp2
-rw-r--r--scene/gui/graph_edit.cpp10
-rw-r--r--scene/gui/popup_menu.cpp4
5 files changed, 23 insertions, 23 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 7276c2086e..be5e0bf4e5 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -2288,7 +2288,7 @@ void CodeEdit::_filter_code_completion_candidates() {
TypedArray<Dictionary> completion_options_sources;
completion_options_sources.resize(code_completion_option_sources.size());
int i = 0;
- for (ScriptCodeCompletionOption &E : code_completion_option_sources) {
+ for (const ScriptCodeCompletionOption &E : code_completion_option_sources) {
Dictionary option;
option["kind"] = E.kind;
option["display_text"] = E.display;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 8d8c3986ba..5bff1abf9d 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -343,7 +343,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_icon_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.icon_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -355,7 +355,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_stylebox_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.style_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -367,7 +367,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_font_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.font_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -379,7 +379,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_font_size_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.font_size_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -391,7 +391,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_color_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.color_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -403,7 +403,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
{
List<StringName> names;
theme->get_constant_list(get_class_name(), &names);
- for (StringName &E : names) {
+ for (const StringName &E : names) {
uint32_t usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CHECKABLE;
if (data.constant_override.has(E)) {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
@@ -428,7 +428,7 @@ void Control::_validate_property(PropertyInfo &property) const {
Vector<StringName> unique_names;
String hint_string;
- for (StringName &E : names) {
+ for (const StringName &E : names) {
// Skip duplicate values.
if (unique_names.has(E)) {
continue;
@@ -793,7 +793,7 @@ T Control::get_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner
Window *theme_owner_window = p_theme_owner_window;
while (theme_owner || theme_owner_window) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (theme_owner && theme_owner->data.theme->has_theme_item(p_data_type, p_name, E)) {
return theme_owner->data.theme->get_theme_item(p_data_type, p_name, E);
}
@@ -822,7 +822,7 @@ T Control::get_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner
// Secondly, check the project-defined Theme resource.
if (Theme::get_project_default().is_valid()) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_project_default()->has_theme_item(p_data_type, p_name, E)) {
return Theme::get_project_default()->get_theme_item(p_data_type, p_name, E);
}
@@ -830,7 +830,7 @@ T Control::get_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner
}
// Lastly, fall back on the items defined in the default Theme, if they exist.
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_default()->has_theme_item(p_data_type, p_name, E)) {
return Theme::get_default()->get_theme_item(p_data_type, p_name, E);
}
@@ -848,7 +848,7 @@ bool Control::has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_ow
Window *theme_owner_window = p_theme_owner_window;
while (theme_owner || theme_owner_window) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (theme_owner && theme_owner->data.theme->has_theme_item(p_data_type, p_name, E)) {
return true;
}
@@ -877,7 +877,7 @@ bool Control::has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_ow
// Secondly, check the project-defined Theme resource.
if (Theme::get_project_default().is_valid()) {
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_project_default()->has_theme_item(p_data_type, p_name, E)) {
return true;
}
@@ -885,7 +885,7 @@ bool Control::has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_ow
}
// Lastly, fall back on the items defined in the default Theme, if they exist.
- for (StringName &E : p_theme_types) {
+ for (const StringName &E : p_theme_types) {
if (Theme::get_default()->has_theme_item(p_data_type, p_name, E)) {
return true;
}
@@ -2580,7 +2580,7 @@ void Control::get_argument_options(const StringName &p_function, int p_idx, List
}
sn.sort_custom<StringName::AlphCompare>();
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
r_options->push_back(quote_style + E + quote_style);
}
}
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 67cb6f04a7..2e4204e171 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -552,7 +552,7 @@ void FileDialog::update_file_list() {
bool match = patterns.is_empty();
String match_str;
- for (String &E : patterns) {
+ for (const String &E : patterns) {
if (files.front()->get().matchn(E)) {
match_str = E;
match = true;
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 8ad4d04b7f..1fac2b9129 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -217,7 +217,7 @@ Error GraphEdit::connect_node(const StringName &p_from, int p_from_port, const S
}
bool GraphEdit::is_node_connected(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port) {
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
if (E.from == p_from && E.from_port == p_from_port && E.to == p_to && E.to_port == p_to_port) {
return true;
}
@@ -561,7 +561,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
if (is_in_hot_zone(pos / zoom, click_pos)) {
if (valid_left_disconnect_types.has(gn->get_connection_output_type(j))) {
//check disconnect
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
if (E.from == gn->get_name() && E.from_port == j) {
Node *to = get_node(String(E.to));
if (Object::cast_to<GraphNode>(to)) {
@@ -603,7 +603,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
if (is_in_hot_zone(pos / zoom, click_pos)) {
if (right_disconnects || valid_right_disconnect_types.has(gn->get_connection_input_type(j))) {
//check disconnect
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
if (E.to == gn->get_name() && E.to_port == j) {
Node *fr = get_node(String(E.from));
if (Object::cast_to<GraphNode>(fr)) {
@@ -1001,7 +1001,7 @@ void GraphEdit::_minimap_draw() {
// Draw node connections.
Color activity_color = get_theme_color(SNAME("activity"));
- for (Connection &E : connections) {
+ for (const Connection &E : connections) {
NodePath fromnp(E.from);
Node *from = get_node(fromnp);
@@ -1500,7 +1500,7 @@ Array GraphEdit::_get_connection_list() const {
List<Connection> conns;
get_connection_list(&conns);
Array arr;
- for (Connection &E : conns) {
+ for (const Connection &E : conns) {
Dictionary d;
d["from"] = E.from;
d["from_port"] = E.from_port;
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index ae3db4a983..7790a0970c 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -397,7 +397,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseMotion> m = p_event;
if (m.is_valid()) {
- for (Rect2 &E : autohide_areas) {
+ for (const Rect2 &E : autohide_areas) {
if (!Rect2(Point2(), get_size()).has_point(m->get_position()) && E.has_point(m->get_position())) {
_close_pressed();
return;
@@ -751,7 +751,7 @@ void PopupMenu::_notification(int p_what) {
Point2 mouse_pos = DisplayServer::get_singleton()->mouse_get_position();
mouse_pos -= get_position();
- for (Rect2 &E : autohide_areas) {
+ for (const Rect2 &E : autohide_areas) {
if (!Rect2(Point2(), get_size()).has_point(mouse_pos) && E.has_point(mouse_pos)) {
_close_pressed();
return;