~ps-jenkins/dee-qt/latestsnapshot-3.3+14.04.20140116-0ubuntu1

« back to all changes in this revision

Viewing changes to deelistmodel.cpp

  • Committer: Michał Sawicz
  • Date: 2013-01-31 19:01:52 UTC
  • mfrom: (65.1.21 qt4-and-qt5)
  • Revision ID: michal.sawicz@canonical.com-20130131190152-pnlsxjnv92rymaux
build for both qt4 and qt5

rename the libs to libdee-qt{4,5}-3
rename QML bindings to qml{1,2}-dee-3
bump version number
rename the QML module to Dee
version the QML module accordingly
split the QML module out into subdir
split the tests into subdir

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
    DeeModel* m_deeModel;
98
98
    QString m_name;
99
99
    int m_count;
 
100
    QHash<int, QByteArray> m_roleNames;
100
101
};
101
102
 
102
103
DeeListModelPrivate::DeeListModelPrivate(DeeListModel* parent) : m_parent(parent), m_deeModel(NULL), m_count(0)
151
152
    if (synchronized())
152
153
    {
153
154
        createRoles();
 
155
        m_parent->beginResetModel();
154
156
        m_count = dee_model_get_n_rows(m_deeModel);
155
 
        m_parent->reset();
 
157
        m_parent->endResetModel();
156
158
        Q_EMIT m_parent->countChanged();
157
159
    }
158
160
    else
189
191
    for (unsigned int index=0; index<n_columns; index++)
190
192
    {
191
193
        column = QString("column_%1").arg(index);
192
 
        roles[index] = column.toAscii();
 
194
        roles[index] = column.toLocal8Bit();
193
195
    }
194
196
 
 
197
#if WITHQT5==0
 
198
    // In Qt4, roleNames() is non-virtual and non-const, so we still need to
 
199
    // call the old setRoleNames() which doesn't exist any more in Qt5.
195
200
    m_parent->setRoleNames(roles);
 
201
#endif
 
202
    m_roleNames = roles;
196
203
    Q_EMIT m_parent->roleNamesChanged(roles);
197
204
}
198
205
 
202
209
                                           DeeListModel *model)
203
210
{
204
211
    model->d->createRoles();
 
212
    model->beginResetModel();
205
213
    model->d->m_count = dee_model_get_n_rows(model->d->m_deeModel);
206
214
    model->synchronizedChanged(model->synchronized());
207
 
    model->reset();
 
215
    model->endResetModel();
208
216
    Q_EMIT model->countChanged();
209
217
}
210
218
 
329
337
    return d->m_count;
330
338
}
331
339
 
 
340
QHash<int, QByteArray>
 
341
DeeListModel::roleNames() const
 
342
{
 
343
    return d->m_roleNames;
 
344
}
 
345
 
332
346
QVariant
333
347
DeeListModel::data(const QModelIndex &index, int role) const
334
348
{