warning C4996: ‘UWidget::GetEditorIcon’: GetEditorIcon is deprecated. Please define widget icons in your style set in the form ClassIcon.MyWidget, and register your style through FClassIconFinder::(Un)RegisterIconSource Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
What am I supposed to do instead? FClassIconFinder::RegisterIconSource is also deprecated, and I can’t find any examples of what should be done. I’d like to silence this warning.
If you’ve created a slate style and registered it through FSlateStyleRegistry::RegisterSlateStyle, you should just be able to define your icon as a brush in that style under the name “ClassIcon.WidgetType”, and it will get picked up by the editor.
In that case, you’re safe to just delete the implementation of GetEditorIcon, and it will use the default widget icon. You only need to provide your own custom icon if you really want it to show up with a distinct icon in the editor.
If you were to inherit URichTextBlock, you’d get the rich text block icon without having to override anything. Maybe we could figure out why you couldn’t use that directly in the first place?
If you really want to create your own style set to make an editor icon, we can walk you through that, but it seems overkill for a single widget type.
on the one hand, it is overkill for this purpose; on the other hand, anyone looking to add a custom icon is going to find this question. Might as well give them an answer.
As for URichTextBlock, it doesn’t show up in the Experimental tab, and inheriting from it just kicks up a number of compiler errors.