Changeset View
Changeset View
Standalone View
Standalone View
kcms/colors/filterproxymodel.cpp
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Line(s) | |||||
104 | } | 104 | } | ||
105 | 105 | | |||
106 | bool FilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const | 106 | bool FilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const | ||
107 | { | 107 | { | ||
108 | const QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); | 108 | const QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); | ||
109 | 109 | | |||
110 | if (!m_query.isEmpty()) { | 110 | if (!m_query.isEmpty()) { | ||
111 | if (!idx.data(Qt::DisplayRole).toString().contains(m_query, Qt::CaseInsensitive) | 111 | if (!idx.data(Qt::DisplayRole).toString().contains(m_query, Qt::CaseInsensitive) | ||
112 | && !idx.data(KCMColors::SchemeNameRole).toString().contains(m_query, Qt::CaseInsensitive)) { | 112 | && !idx.data(ColorsModel::SchemeNameRole).toString().contains(m_query, Qt::CaseInsensitive)) { | ||
113 | return false; | 113 | return false; | ||
114 | } | 114 | } | ||
115 | } | 115 | } | ||
116 | 116 | | |||
117 | if (m_filter != KCMColors::AllSchemes) { | 117 | if (m_filter != KCMColors::AllSchemes) { | ||
118 | const QPalette palette = idx.data(KCMColors::PaletteRole).value<QPalette>(); | 118 | const QPalette palette = idx.data(ColorsModel::PaletteRole).value<QPalette>(); | ||
119 | 119 | | |||
120 | const int windowBackgroundGray = qGray(palette.window().color().rgb()); | 120 | const int windowBackgroundGray = qGray(palette.window().color().rgb()); | ||
121 | 121 | | |||
122 | if (m_filter == KCMColors::DarkSchemes) { | 122 | if (m_filter == KCMColors::DarkSchemes) { | ||
123 | return windowBackgroundGray < 192; | 123 | return windowBackgroundGray < 192; | ||
124 | } else if (m_filter == KCMColors::LightSchemes) { | 124 | } else if (m_filter == KCMColors::LightSchemes) { | ||
125 | return windowBackgroundGray >= 192; | 125 | return windowBackgroundGray >= 192; | ||
126 | } | 126 | } | ||
127 | } | 127 | } | ||
128 | 128 | | |||
129 | return true; | 129 | return true; | ||
130 | } | 130 | } |