mirror of https://github.com/qt/qtbase.git
Merge cf818947fe
into c7b3cb5f2a
This commit is contained in:
commit
c86f0311a9
|
@ -1752,16 +1752,17 @@ void QWindowsXpNativeFileDialog::populateOpenFileName(OPENFILENAME *ofn, HWND ow
|
|||
int totalStringLength = 0;
|
||||
const QList<FilterSpec> specs =
|
||||
filterSpecs(m_options->nameFilters(), m_options->options() & QFileDialogOptions::HideNameFilterDetails, &totalStringLength);
|
||||
const int size = specs.size();
|
||||
auto *ptr = new wchar_t[totalStringLength + 2 * size + 1];
|
||||
ofn->lpstrFilter = ptr;
|
||||
for (const FilterSpec &spec : specs) {
|
||||
ptr += spec.description.toWCharArray(ptr);
|
||||
*ptr++ = 0;
|
||||
ptr += spec.filter.toWCharArray(ptr);
|
||||
*ptr++ = 0;
|
||||
if (const int size = specs.size()) {
|
||||
auto *ptr = new wchar_t[totalStringLength + 2 * size + 1];
|
||||
ofn->lpstrFilter = ptr;
|
||||
for (const FilterSpec &spec : specs) {
|
||||
ptr += spec.description.toWCharArray(ptr);
|
||||
*ptr++ = 0;
|
||||
ptr += spec.filter.toWCharArray(ptr);
|
||||
*ptr++ = 0;
|
||||
}
|
||||
*ptr = 0;
|
||||
}
|
||||
*ptr = 0;
|
||||
const int nameFilterIndex = indexOfNameFilter(m_options->nameFilters(), m_data.selectedNameFilter());
|
||||
if (nameFilterIndex >= 0)
|
||||
ofn->nFilterIndex = nameFilterIndex + 1; // 1..n based.
|
||||
|
|
Loading…
Reference in New Issue