on xenial help sign in
properly invalidate the whole model
8394f1eMichael Zanetti
plugins/Unity/Launcher/appdrawermodel.cpp−4
@@ -43,10 +43,6 @@ int AppDrawerModel::rowCount(const QModelIndex &parent) const
43
43
44QVariant AppDrawerModel::data(const QModelIndex &index, int role) const
44QVariant AppDrawerModel::data(const QModelIndex &index, int role) const
45{
45{
46− if (!index.isValid() || m_list.count() <= index.row()) {
47− return QVariant();
48− }
49−
50 switch (role) {
46 switch (role) {
51 case RoleAppId:
47 case RoleAppId:
52 return m_list.at(index.row())->appId();
48 return m_list.at(index.row())->appId();
plugins/Utils/appdrawerproxymodel.cpp+2−2
@@ -43,8 +43,8 @@ void AppDrawerProxyModel::setSource(QAbstractItemModel *source)
43 m_source = source;
43 m_source = source;
44 setSourceModel(m_source);
44 setSourceModel(m_source);
45 setSortRole(m_sortBy == SortByAToZ ? AppDrawerModelInterface::RoleName : AppDrawerModelInterface::RoleUsage);
45 setSortRole(m_sortBy == SortByAToZ ? AppDrawerModelInterface::RoleName : AppDrawerModelInterface::RoleUsage);
46− connect(m_source, &QAbstractItemModel::rowsRemoved, this, &AppDrawerProxyModel::invalidateFilter);
46+ connect(m_source, &QAbstractItemModel::rowsRemoved, this, &AppDrawerProxyModel::invalidate);
47− connect(m_source, &QAbstractItemModel::rowsInserted, this, &AppDrawerProxyModel::invalidateFilter);
47+ connect(m_source, &QAbstractItemModel::rowsInserted, this, &AppDrawerProxyModel::invalidate);
48 Q_EMIT sourceChanged();
48 Q_EMIT sourceChanged();
49 }
49 }
50}
50}
qml/Launcher/Drawer.qml+3
@@ -238,6 +238,7 @@ FocusScope {
238 source: sortProxyModel
238 source: sortProxyModel
239 group: AppDrawerProxyModel.GroupByAll
239 group: AppDrawerProxyModel.GroupByAll
240 sortBy: AppDrawerProxyModel.SortByUsage
240 sortBy: AppDrawerProxyModel.SortByUsage
241+ dynamicSortFilter: false
241 }
242 }
242
243
243 delegate: UbuntuShape {
244 delegate: UbuntuShape {
@@ -287,6 +288,7 @@ FocusScope {
287 source: sortProxyModel
288 source: sortProxyModel
288 sortBy: AppDrawerProxyModel.SortByAToZ
289 sortBy: AppDrawerProxyModel.SortByAToZ
289 group: AppDrawerProxyModel.GroupByAToZ
290 group: AppDrawerProxyModel.GroupByAToZ
291+ dynamicSortFilter: false
290 }
292 }
291
293
292 delegate: UbuntuShape {
294 delegate: UbuntuShape {
@@ -320,6 +322,7 @@ FocusScope {
320 id: categoryModel
322 id: categoryModel
321 source: sortProxyModel
323 source: sortProxyModel
322 filterLetter: model.letter
324 filterLetter: model.letter
325+ dynamicSortFilter: false
323 }
326 }
324 delegateWidth: units.gu(8)
327 delegateWidth: units.gu(8)
325 delegateHeight: units.gu(10)
328 delegateHeight: units.gu(10)