Qt Editor: Improve display of object delegate

qteditor
Sven Eberhardt 2016-07-14 00:45:18 -04:00
parent 1151016b56
commit 68358c0f87
2 changed files with 14 additions and 0 deletions

View File

@ -1143,6 +1143,19 @@ QWidget *C4PropertyDelegateObject::CreateEditor(const class C4PropertyDelegateFa
return C4PropertyDelegateEnum::CreateEditor(parent_delegate, parent, option, by_selection);
}
QString C4PropertyDelegateObject::GetDisplayString(const C4Value &v, class C4Object *obj) const
{
C4Object *vobj = v.getObj();
if (vobj)
{
C4RefCntPointer<C4String> s = GetObjectEntryString(vobj);
return QString(s->GetCStr());
}
else
{
return QString(v.GetDataString().getData());
}
}
C4PropertyDelegateBool::C4PropertyDelegateBool(const C4PropertyDelegateFactory *factory, C4PropList *props)
: C4PropertyDelegateEnum(factory, props)

View File

@ -331,6 +331,7 @@ public:
C4PropertyDelegateObject(const C4PropertyDelegateFactory *factory, C4PropList *props);
QWidget *CreateEditor(const class C4PropertyDelegateFactory *parent_delegate, QWidget *parent, const QStyleOptionViewItem &option, bool by_selection) const override;
QString GetDisplayString(const C4Value &v, class C4Object *obj) const override;
};
// true or false