equal
deleted
inserted
replaced
27 ThemeFilterProxyModel::ThemeFilterProxyModel(QObject *parent) |
27 ThemeFilterProxyModel::ThemeFilterProxyModel(QObject *parent) |
28 : QSortFilterProxyModel(parent) |
28 : QSortFilterProxyModel(parent) |
29 { |
29 { |
30 isFilteringDLC = false; |
30 isFilteringDLC = false; |
31 isFilteringHidden = false; |
31 isFilteringHidden = false; |
|
32 isFilteringBackground = false; |
32 } |
33 } |
33 |
34 |
34 bool ThemeFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const |
35 bool ThemeFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const |
35 { |
36 { |
36 QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); |
37 QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); |
41 QString name = index.data(ThemeModel::ActualNameRole).toString(); |
42 QString name = index.data(ThemeModel::ActualNameRole).toString(); |
42 int in = filterRegExp().indexIn(name); |
43 int in = filterRegExp().indexIn(name); |
43 searchOkay = in != -1; |
44 searchOkay = in != -1; |
44 } |
45 } |
45 |
46 |
46 if(isFilteringDLC || isFilteringHidden) |
47 if(isFilteringDLC || isFilteringHidden || isFilteringBackground) |
47 { |
48 { |
48 bool isDLC = index.data(ThemeModel::IsDlcRole).toBool(); |
49 bool isDLC = index.data(ThemeModel::IsDlcRole).toBool(); |
49 bool isHidden = index.data(ThemeModel::IsHiddenRole).toBool(); |
50 bool isHidden = index.data(ThemeModel::IsHiddenRole).toBool(); |
|
51 bool isBackground = index.data(ThemeModel::IsBackgroundThemeRole).toBool(); |
50 |
52 |
51 return ( ((isFilteringDLC && !isDLC) || !isFilteringDLC) && |
53 return ( ((isFilteringDLC && !isDLC) || !isFilteringDLC) && |
52 ((isFilteringHidden && !isHidden) || !isFilteringHidden) ) && |
54 ((isFilteringHidden && !isHidden) || !isFilteringHidden) && |
|
55 ((isFilteringBackground && !isBackground) || !isFilteringBackground) ) && |
53 searchOkay; |
56 searchOkay; |
54 } |
57 } |
55 else |
58 else |
56 { |
59 { |
57 return searchOkay; |
60 return searchOkay; |
67 void ThemeFilterProxyModel::setFilterHidden(bool enable) |
70 void ThemeFilterProxyModel::setFilterHidden(bool enable) |
68 { |
71 { |
69 isFilteringHidden = enable; |
72 isFilteringHidden = enable; |
70 invalidateFilter(); |
73 invalidateFilter(); |
71 } |
74 } |
|
75 |
|
76 void ThemeFilterProxyModel::setFilterBackground(bool enable) |
|
77 { |
|
78 isFilteringBackground = enable; |
|
79 invalidateFilter(); |
|
80 }; |