Your GetItemIcon()
function should return a const FSlateBrush*
, not a const FSlateBrush
.
Hello everyone… I got am getting a wierd slate error message when giving a FSlateBrush as an border image. I am using a function to get the value of the FSlateBrush but no matter what I change, the parameters are not matching.
1>C:\Users\Srikant\Documents\Unreal Projects\SurvivalGame\Source\SurvivalGame\Inventory\Slate\Widgets\SItemWidget.cpp(25): error C2664: 'SBorder::FArguments::WidgetArgsType &SBorder::FArguments::BorderImage(const TAttribute<const FSlateBrush *> &)' : cannot convert argument 2 from 'const FSlateBrush (__cdecl SItemWidget::* )(void) const' to 'const FSlateBrush (__cdecl SItemWidget::* )(void) const'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
What does this mean?
.h
const FSlateBrush GetItemIcon() const;
.cpp
SNew(SBorder)
.HAlign(HAlign_Right)
.VAlign(VAlign_Bottom)
.BorderImage(this, &SItemWidget::GetItemIcon) // <- Error at this line
.Padding(FMargin(0,0,4.2,2))
//////////////////////////////////////////////////////////////
const FSlateBrush SItemWidget::GetItemIcon() const
{
}
Worked but why didn’t it show that in the error message?
Dunno. It’s definitely weird. Are you sure the Answerhub formatting didn’t eat the *
?
Yup sure about it… I checked it like 10 times before posting.