Merge pull request #113178 from AR-DEV-1/tree-create-item-doc-fix
Update the documentation for `Tree.create_item(), Tree.set_columns() & Tree.clear()` & add error messages.
This commit is contained in:
commit
8551f7b319
2 changed files with 6 additions and 3 deletions
|
|
@ -40,6 +40,7 @@
|
|||
<return type="void" />
|
||||
<description>
|
||||
Clears the tree. This removes all items.
|
||||
Prints an error and does not allow clearing the tree if called during mouse selection.
|
||||
</description>
|
||||
</method>
|
||||
<method name="create_item">
|
||||
|
|
@ -50,6 +51,7 @@
|
|||
Creates an item in the tree and adds it as a child of [param parent], which can be either a valid [TreeItem] or [code]null[/code].
|
||||
If [param parent] is [code]null[/code], the root item will be the parent, or the new item will be the root itself if the tree is empty.
|
||||
The new item will be the [param index]-th child of parent, or it will be the last child if there are not enough siblings.
|
||||
Prints an error and returns [code]null[/code] if called during mouse selection, or if the [param parent] does not belong to this tree.
|
||||
</description>
|
||||
</method>
|
||||
<method name="deselect_all">
|
||||
|
|
@ -365,6 +367,7 @@
|
|||
</member>
|
||||
<member name="columns" type="int" setter="set_columns" getter="get_columns" default="1">
|
||||
The number of columns.
|
||||
Prints an error and does not allow setting the columns during mouse selection.
|
||||
</member>
|
||||
<member name="drop_mode_flags" type="int" setter="set_drop_mode_flags" getter="get_drop_mode_flags" default="0">
|
||||
The drop mode as an OR combination of flags. See [enum DropModeFlags] constants. Once dropping is done, reverts to [constant DROP_MODE_DISABLED]. Setting this during [method Control._can_drop_data] is recommended.
|
||||
|
|
|
|||
|
|
@ -5328,7 +5328,7 @@ Size2 Tree::get_minimum_size() const {
|
|||
}
|
||||
|
||||
TreeItem *Tree::create_item(TreeItem *p_parent, int p_index) {
|
||||
ERR_FAIL_COND_V(blocked > 0, nullptr);
|
||||
ERR_FAIL_COND_V_MSG(blocked > 0, nullptr, "The tree cannot create items during mouse selection events.");
|
||||
|
||||
TreeItem *ti = nullptr;
|
||||
|
||||
|
|
@ -5492,7 +5492,7 @@ bool Tree::is_anything_selected() {
|
|||
}
|
||||
|
||||
void Tree::clear() {
|
||||
ERR_FAIL_COND(blocked > 0);
|
||||
ERR_FAIL_COND_MSG(blocked > 0, "The tree cannot be cleared during mouse selection events.");
|
||||
|
||||
if (pressing_for_editor) {
|
||||
if (range_drag_enabled) {
|
||||
|
|
@ -5769,7 +5769,7 @@ void Tree::propagate_set_columns(TreeItem *p_item) {
|
|||
|
||||
void Tree::set_columns(int p_columns) {
|
||||
ERR_FAIL_COND(p_columns < 1);
|
||||
ERR_FAIL_COND(blocked > 0);
|
||||
ERR_FAIL_COND_MSG(blocked > 0, "The number of columns cannot be changed during mouse selection events.");
|
||||
|
||||
if (columns.size() > p_columns) {
|
||||
for (int i = p_columns; i < columns.size(); i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue