WIP Исправление. Производительность

This commit is contained in:
sasha80
2026-01-26 14:14:54 +03:00
parent 36999bf3c1
commit 484ca3f320
8 changed files with 31 additions and 17 deletions

View File

@@ -5,6 +5,10 @@ func _enter_tree() -> void:
ProjectSettings.connect('settings_changed', apply_colors)
func _exit_tree() -> void:
ProjectSettings.disconnect('settings_changed', apply_colors)
func apply_colors():
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
var style = get_theme_stylebox('normal').duplicate()

View File

@@ -5,6 +5,10 @@ func _enter_tree() -> void:
ProjectSettings.connect('settings_changed', apply_colors)
func _exit_tree() -> void:
ProjectSettings.disconnect('settings_changed', apply_colors)
func apply_colors():
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
var style = get_theme_stylebox('read_only').duplicate()

View File

@@ -7,6 +7,10 @@ func _enter_tree() -> void:
ProjectSettings.connect('settings_changed', on_setting_changed)
func _exit_tree() -> void:
ProjectSettings.disconnect('settings_changed', on_setting_changed)
func on_setting_changed():
var cb = $CheckButton
checkbutton_material = cb.material

View File

@@ -7,6 +7,10 @@ func _enter_tree() -> void:
ProjectSettings.connect('settings_changed', on_setting_changed)
func _exit_tree() -> void:
ProjectSettings.disconnect('settings_changed', apply_colors)
func on_setting_changed():
var cb = $CheckButton
checkbutton_material = cb.material

View File

@@ -392,6 +392,8 @@ func add_row(row_types: Array) -> void:
_assert(node.get('name') is StringName, 'экземпляр не имеет поля \"name\"')
var node_key: String = NODE_KEY_FORMAT % [i_row, i_col]
node.name = node_key
if node.has_method('apply_colors'):
node.apply_colors()
add_child(node)
if allow_set_size:
node.custom_minimum_size.x = columns_min_size[i_col]
@@ -400,7 +402,6 @@ func add_row(row_types: Array) -> void:
var conn = Callable(self, '_on_focus_entered').bind(node)
node.connect('focus_entered', conn)
set_node_meta(i_col, i_row, 'callable_focus_entered', conn)
call_deferred("apply_theme")
func _set_size_x_defered(node: Control, val: Vector2):
@@ -411,7 +412,6 @@ func _set_size_x_defered(node: Control, val: Vector2):
func _on_focus_entered(node):
var indexes = get_key_indexes(node.name)
emit_signal('row_pressed', indexes[1])
ProjectSettings.connect('settings_changed', apply_theme)
##
@@ -521,7 +521,6 @@ func rehash():
next_index(i_slct)
nodes.clear()
nodes.merge(nodes_copy)
call_deferred('apply_theme')
## Удаляет все строки таблицы
@@ -717,9 +716,3 @@ func get_row_rect(i_row: int, rect: Array, key_format: String = NODE_KEY_FORMAT)
rect[1] = cell0.position.y + scroll_adj.y
rect[2] = (cell1.position.x - cell0.position.x) + cell1.size.x
rect[3] = cell0.size.y
func apply_theme():
for node in nodes.values():
if node is LineEdit and node.has_method('apply_colors'):
node.apply_colors()

View File

@@ -1,8 +1,9 @@
extends LineEdit
func _enter_tree() -> void:
ProjectSettings.connect('settings_changed', apply_colors)
# Вызывается
func _enter_tree() -> void: ProjectSettings.connect('settings_changed', apply_colors)
func _exit_tree() -> void: ProjectSettings.disconnect('settings_changed', apply_colors)
func _ready() -> void: print_debug()
func apply_colors():

View File

@@ -3,6 +3,10 @@ extends ColorPickerButton
func _enter_tree() -> void:
ProjectSettings.connect('settings_changed', apply_colors)
func _exit_tree() -> void:
ProjectSettings.disconnect('settings_changed', apply_colors)
func apply_colors():