#ifndef QSTRINGLISTMODELQML_H
#define QSTRINGLISTMODELQML_H
#include <QObject>
#include <QStringListModel>
class QStringListModelQML : public QStringListModel
{
Q_OBJECT
public:
Q_PROPERTY(int count READ count NOTIFY countChanged)
// Contrary to normal QStringListModel, this class does not
// allow giving the strings in the model in constructor.
// The reason is that for this model to work also on
// MeeGo/Harmattan, the strings must be set after the
// QML template has been loaded. Otherwise the signal
// handlers in QML have not been registered. The default
// role name used to display the roles is "name", which is
// used both by Symbian and Harmattan Qt Compontents.
QStringListModelQML(const QByteArray &displayRoleName = "name", QObject *parent = 0);
// Overrides QStringListModel's function. Setting this will
// emit stringAdded(QString) for each string in the list. If
// there was non empty string list set to this model before,
// stringsReset() signal is emitted before
// stringAdded(QString) signals.
void setStringList(const QStringList &strings);
QVariant data(const QModelIndex &index, int role) const;
Q_INVOKABLE int rowCount(const QModelIndex &parent) const;
Q_INVOKABLE int columnCount(const QModelIndex & parent = QModelIndex()) const;
int count() const;
Q_INVOKABLE QVariant getSelected(int i) const;
Q_INVOKABLE QVariant data(int index) const;
signals:
void countChanged();
};
#endif // QSTRINGLISTMODELQML_H