QList as a property in Qt designer custom widget



  • i have defined a custom widget, basically adding to QLabel. The simple (Qstring and enum ) properties are ok and appear in my Qt designer.

    I am now trying to add a property which is a list.

    So I declare my property as :
    @
    Q_PROPERTY(QList<int> points READ getpoints )
    @

    and I have my private variable QList<int> m_points;

    Still, I cannot see my points property in Q designer propriety editor. And, I don't know what went wrong.

    I've tried to add the DESIGNABLE flag but it does nothing.

    When I try to add the dynamic property points in designer, it tells me "this propriety already exists".

    Is there a way to add a "list" property easily ?

    thanks



  • Hi,

    I have tested QStringList type in the customwidgetplugin example and it works ... it provides a list editor for adding strings; conversions to other types is on you ...

    to be honest I have not found any list property of any type among qt's designable widgets and the doc regarding Q_PROPERTY and QList within QVariant is confusing

    hope this help :)

    Cheers!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.