72 const int from = filter.indexOf(QLatin1Char(
'('));
73 const int to = filter.lastIndexOf(QLatin1Char(
')')) - 1;
74 if (from >= 0 && from < to) {
75 const QStringView ref = filter.mid(from + 1, to - from);
76 const QList<QStringView> exts = ref.split(QLatin1Char(
' '), Qt::SkipEmptyParts);
79 for (
const QStringView &ref : exts) {
80 extensions += extractExtension(ref);
81 globs += ref.toString();
86void QQuickFileNameFilter::update(
const QString &filter)
88 const QStringList filters = nameFilters();
90 const int oldIndex = m_index;
91 const QString oldName = m_name;
92 const QStringList oldExtensions = m_extensions;
93 const QStringList oldGlobs = m_globs;
95 m_index = filters.indexOf(filter);
96 m_name = extractName(filter);
97 extractExtensionsAndGlobs(filter, m_extensions, m_globs);
99 if (oldIndex != m_index)
100 emit indexChanged(m_index);
101 if (oldName != m_name)
102 emit nameChanged(m_name);
103 if (oldExtensions != m_extensions)
104 emit extensionsChanged(m_extensions);
105 if (oldGlobs != m_globs)
106 emit globsChanged(m_globs);
108 qCDebug(lcFileNameFilter).nospace() <<
"update called on " <<
this <<
" of " << parent()
109 <<
" with filter " << filter <<
" (current filters are " << filters <<
"):"
110 <<
"\n old index=" << oldIndex <<
"new index=" << m_index
111 <<
"\n old name=" << oldName <<
"new name=" << m_name
112 <<
"\n old extensions=" << oldExtensions <<
"new extensions=" << m_extensions
113 <<
"\n old glob=s" << oldGlobs <<
"new globs=" << m_globs;