-
Notifications
You must be signed in to change notification settings - Fork 142
LVGLProperty
CURTLab edited this page Nov 26, 2019
·
1 revision
LVGLProperty is the base class for all properties and describes properties of individual lvgl widget (e.g. lv_btn_set_state or lv_btn_set_layout). It allows to create Qt widgets for edition within the list model and contains all necessary information for setting, getting and code generation.
There are some predefined properties usefull for individual LVGLWidgets:
LVGLPropertyType<T>
LVGLPropertyEnum
LVGLPropertyBool
LVGLPropertyString
LVGLPropertyCoord
LVGLPropertyInt
LVGLPropertyFont
LVGLPropertyColor
LVGLPropertyAssignTextArea
LVGLPropertyImage
LVGLPropertyList
LVGLPropertyRange
LVGLPropertyScale
class LVGLPropertyButtonToggle : public LVGLPropertyBool
{
public:
QString name() const { return "Toggle"; }
QStringList function(LVGLObject *obj) const {
return QStringList() << QString("lv_btn_set_toggle(%1, %2);").arg(obj->codeName()).arg(QVariant(get(obj)).toString());
}
protected:
bool get(LVGLObject *obj) const { return lv_btn_get_toggle(obj->obj()); }
void set(LVGLObject *obj, bool statue) { lv_btn_set_toggle(obj->obj(), statue); }
};
LVGLButton::LVGLButton()
{
m_properties << new LVGLPropertyButtonToggle;
...
}