File tree 1 file changed +13
-0
lines changed
arho_feature_template/core
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -91,13 +91,26 @@ def __init__(self) -> None:
91
91
self .template_dock .library_selection .currentIndexChanged .connect (
92
92
lambda : self .set_active_library (self .template_dock .library_selection .currentText ())
93
93
)
94
+ # Update template list when search text changes
95
+ self .template_dock .search_box .valueChanged .connect (self .on_template_search_text_changed )
94
96
95
97
# Activate map tool when template selection changes
96
98
self .template_model .itemChanged .connect (self .on_item_changed )
97
99
98
100
self .digitize_map_tool = TemplateGeometryDigitizeMapTool (iface .mapCanvas (), iface .cadDockWidget ())
99
101
self .digitize_map_tool .digitizingCompleted .connect (self .ask_for_feature_attributes )
100
102
103
+ def on_template_search_text_changed (self , search_text : str ):
104
+ for row in range (self .template_model .rowCount ()):
105
+ item = self .template_model .item (row )
106
+
107
+ # If the search text is in the item's text, show the row
108
+ if search_text in item .text ().lower ():
109
+ self .template_dock .template_list .setRowHidden (row , False )
110
+ else :
111
+ # Otherwise, hide the row
112
+ self .template_dock .template_list .setRowHidden (row , True )
113
+
101
114
def on_item_changed (self , item : TemplateItem ) -> None :
102
115
if item .checkState () == Qt .Checked :
103
116
self ._uncheck_others (item )
You can’t perform that action at this time.
0 commit comments