Reply
Thread Tools
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#1
Hi,

I'd like to use QML SectionScroller with a QList<QObject*> based model.
My ListView's section configuration is:

Code:
section.criteria: ViewSection.FirstCharacter
section.property: "form0"
Where form0 property is valid and displayed in the view delegate

When the SectionScroller is inserted to the QML code, I'm getting an error:

Code:
.../com/nokia/meego/SectionScroller.qml:319: Error: cannot assign [undefined] to QString
What am I doing wrong? I'd prefer to avoid QAbstractListModel, as I think it'd be an overkill right there - the elements are like this:

Code:
class IrregularVerb : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString form0 READ getForm0 NOTIFY formChanged)
    Q_PROPERTY(QString form1 READ getForm1 NOTIFY formChanged)
    Q_PROPERTY(QString form2 READ getForm2 NOTIFY formChanged)
// internal stuff there
};
Thanks
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here

Last edited by marmistrz; 2013-02-02 at 19:10.
 
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#2
Updated the opening post
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here
 
Posts: 435 | Thanked: 769 times | Joined on Apr 2010
#3
You need a QAbstractListModel with the following implementations to be able to use section scrollers or fast scroll:

//the number of total items property...
Q_PROPERTY(int count READ rowCount)

//... and its read method implementation
Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const;

//a get method
Q_INVOKABLE Element* get(int index)




If you think it's an overkill, you may set a class which emits the items in your list and a qml listmodel to capture them. If the items are a lot, hovewer, it will slow down a lot your UI thread.

In my opinion a correct QAbstractListModel is far better, it gives you more features and you can expand it at needs.
__________________
My Fremantle projects: InternetRadioPlayer, QRadio, InternetRadioWidget, AutoRemoveSms, PSAutoLock, TodoListWidget, MediaPlayerWidget
My Harmattan projects: InternetRadioPlayer, QMLRadio, SigmaPlayer, WidgetCanvas, NotesExporter, 3DTris, NoStopPlayer, NotesImporter
 

The Following User Says Thank You to gionni88 For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 07:24.