UI: Try limiting 'x' icon to search buttons
Reusing PROP_TEXTEDIT_UPDATE instead of adding a new property flag just for search strings. Currently it's only used for search strings anyway so seems fine for now. Fixes T50336.
This commit is contained in:
@@ -119,12 +119,10 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
|
||||
else
|
||||
but = uiDefButR_prop(block, UI_BTYPE_TEXT, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
|
||||
|
||||
PropertySubType subtype = RNA_property_subtype(prop);
|
||||
if (!(ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME) || (block->flag & UI_BLOCK_LIST_ITEM))) {
|
||||
UI_but_flag_enable(but, UI_BUT_VALUE_CLEAR);
|
||||
}
|
||||
if (RNA_property_flag(prop) & PROP_TEXTEDIT_UPDATE) {
|
||||
UI_but_flag_enable(but, UI_BUT_TEXTEDIT_UPDATE);
|
||||
/* TEXTEDIT_UPDATE is usally used for search buttons. For these we also want
|
||||
* the 'x' icon to clear search string, so setting VALUE_CLEAR flag, too. */
|
||||
UI_but_flag_enable(but, UI_BUT_TEXTEDIT_UPDATE | UI_BUT_VALUE_CLEAR);
|
||||
}
|
||||
break;
|
||||
case PROP_POINTER:
|
||||
|
||||
Reference in New Issue
Block a user