-
-
Notifications
You must be signed in to change notification settings - Fork 23.6k
Add custom StyleBox to TreeItem
#112371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom StyleBox to TreeItem
#112371
Conversation
ecfe782 to
b7f628b
Compare
YeldhamDev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and while this doesn't allow to fully match the way that the classic theme does it (covering the drop-arrows), it's not a deal breaker.
b7f628b to
b30b11b
Compare
|
Added to the docs that the custom stylebox is drawn on top of the background color. Also,
The logic for matching the rects exactly has been implemented (it was basically a copypaste). Screenshots updated. Like I said in the description however, I want to keep this feature implementation and the update on the theme separate. |
|
PR that actually implements the style in the Action Map editor mentioned above. |
|
Thanks! |
|
|
||
| void TreeItem::set_custom_stylebox(int p_column, const Ref<StyleBox> &p_stylebox) { | ||
| ERR_FAIL_INDEX(p_column, cells.size()); | ||
| cells.write[p_column].custom_stylebox = p_stylebox; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be checking whether the new stylebox is different, but seems like such checks are not done consistently in TreeItem anyway.
Allows setting a custom
StyleBoxinTreeItemcells in a similar way you would set a custom BG color, text or icon:Draw order should be:
This could have the potential to deprecate the custom BG color, but I'm leaving it as it is as they can coexist.
Weird demonstration I made for testing, with 4 different

StyleBoxes (start, middle, end, full, and all cell types in each row):This should allow implementing #112360 and reimplementing #112233 without having to do workarounds (not part of this PR):
