mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 11:10:23 +02:00
Qt: bugfix for dialogs filter in QT_NATIVE_DIALOGS mode.fixes #13767
git-svn-id: trunk@20079 -
This commit is contained in:
parent
7d94012801
commit
c521333873
@ -174,7 +174,7 @@ class function TQtWSFileDialog.GetQtFilterString(const AFileDialog: TFileDialog;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
TmpFilter, strExtensions: string;
|
TmpFilter, strExtensions, DialogFilter: string;
|
||||||
ParserState, Position, i: Integer;
|
ParserState, Position, i: Integer;
|
||||||
List: TStrings;
|
List: TStrings;
|
||||||
begin
|
begin
|
||||||
@ -209,6 +209,7 @@ begin
|
|||||||
ParserState := 0;
|
ParserState := 0;
|
||||||
Position := 1;
|
Position := 1;
|
||||||
TmpFilter := AFileDialog.Filter;
|
TmpFilter := AFileDialog.Filter;
|
||||||
|
DialogFilter := AFileDialog.Filter;
|
||||||
ASelectedFilter := '';
|
ASelectedFilter := '';
|
||||||
{$ifdef USE_QT_45}
|
{$ifdef USE_QT_45}
|
||||||
{we must remove all brackets since qt-45 doesn't like brackets
|
{we must remove all brackets since qt-45 doesn't like brackets
|
||||||
@ -216,26 +217,26 @@ begin
|
|||||||
becomes invalid after filters processing.}
|
becomes invalid after filters processing.}
|
||||||
TmpFilter := StringReplace(TmpFilter,'(','',[rfReplaceAll]);
|
TmpFilter := StringReplace(TmpFilter,'(','',[rfReplaceAll]);
|
||||||
TmpFilter := StringReplace(TmpFilter,')','',[rfReplaceAll]);
|
TmpFilter := StringReplace(TmpFilter,')','',[rfReplaceAll]);
|
||||||
AFileDialog.Filter := TmpFilter;
|
DialogFilter := TmpFilter;
|
||||||
{$endif}
|
{$endif}
|
||||||
TmpFilter := '';
|
TmpFilter := '';
|
||||||
|
|
||||||
List := TStringList.Create;
|
List := TStringList.Create;
|
||||||
try
|
try
|
||||||
for i := 1 to Length(AFileDialog.Filter) do
|
for i := 1 to Length(DialogFilter) do
|
||||||
begin
|
begin
|
||||||
if Copy(AFileDialog.Filter, i, 1) = '|' then
|
if Copy(DialogFilter, i, 1) = '|' then
|
||||||
begin
|
begin
|
||||||
ParserState := ParserState + 1;
|
ParserState := ParserState + 1;
|
||||||
|
|
||||||
if ParserState = 1 then
|
if ParserState = 1 then
|
||||||
begin
|
begin
|
||||||
List.Add(Copy(AFileDialog.Filter, Position, i - Position));
|
List.Add(Copy(DialogFilter, Position, i - Position));
|
||||||
TmpFilter := TmpFilter + Copy(AFileDialog.Filter, Position, i - Position);
|
TmpFilter := TmpFilter + Copy(DialogFilter, Position, i - Position);
|
||||||
end else
|
end else
|
||||||
if ParserState = 2 then
|
if ParserState = 2 then
|
||||||
begin
|
begin
|
||||||
strExtensions := GetExtensionString(AFileDialog.Filter, Position, i - Position);
|
strExtensions := GetExtensionString(DialogFilter, Position, i - Position);
|
||||||
|
|
||||||
if Pos(strExtensions, TmpFilter) = 0 then
|
if Pos(strExtensions, TmpFilter) = 0 then
|
||||||
begin
|
begin
|
||||||
@ -249,12 +250,12 @@ begin
|
|||||||
ParserState := 0;
|
ParserState := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if i <> Length(AFileDialog.Filter) then
|
if i <> Length(DialogFilter) then
|
||||||
Position := i + 1;
|
Position := i + 1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
strExtensions := GetExtensionString(AFileDialog.Filter, Position, i + 1 - Position);
|
strExtensions := GetExtensionString(DialogFilter, Position, i + 1 - Position);
|
||||||
|
|
||||||
if Pos(strExtensions, TmpFilter) = 0 then
|
if Pos(strExtensions, TmpFilter) = 0 then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user