Windows: Extract the suffix from the simple file filter case
Since the filter can either be something like "*.txt" or "Text Files (*.txt)" then it should have the suffix default to "txt" in both cases. Change-Id: I36a72f5bf0fb12c84db103f91c4fca94d0d933ae Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>bb10
parent
0db793fe41
commit
82b8158022
|
|
@ -1466,18 +1466,21 @@ public:
|
|||
};
|
||||
|
||||
// Return the first suffix from the name filter "Foo files (*.foo;*.bar)" -> "foo".
|
||||
// Also handles the simple name filter case "*.txt" -> "txt"
|
||||
static inline QString suffixFromFilter(const QString &filter)
|
||||
{
|
||||
int suffixPos = filter.indexOf(QLatin1String("(*."));
|
||||
int suffixPos = filter.indexOf(QLatin1String("*."));
|
||||
if (suffixPos < 0)
|
||||
return QString();
|
||||
suffixPos += 3;
|
||||
suffixPos += 2;
|
||||
int endPos = filter.indexOf(QLatin1Char(' '), suffixPos + 1);
|
||||
if (endPos < 0)
|
||||
endPos = filter.indexOf(QLatin1Char(';'), suffixPos + 1);
|
||||
if (endPos < 0)
|
||||
endPos = filter.indexOf(QLatin1Char(')'), suffixPos + 1);
|
||||
return endPos >= 0 ? filter.mid(suffixPos, endPos - suffixPos) : QString();
|
||||
if (endPos < 0)
|
||||
endPos = filter.size();
|
||||
return filter.mid(suffixPos, endPos - suffixPos);
|
||||
}
|
||||
|
||||
void QWindowsNativeSaveFileDialog::setNameFilters(const QStringList &f)
|
||||
|
|
|
|||
Loading…
Reference in New Issue