mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 19:52:26 +02:00
Qt: qtdialogs - return focus to last active window, fixes #16535
git-svn-id: trunk@25613 -
This commit is contained in:
parent
f31baf8b4e
commit
8f5c37c13b
@ -110,7 +110,7 @@ type
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses qtint;
|
||||
const
|
||||
QtDialogCodeToModalResultMap: array[QDialogDialogCode] of TModalResult =
|
||||
(
|
||||
@ -125,6 +125,9 @@ begin
|
||||
if ACommonDialog.Owner is TWinControl then
|
||||
Result := TQtWidget(TWinControl(ACommonDialog.Owner).Handle).Widget
|
||||
else
|
||||
if (QtWidgetSet.GetActiveWindow <> 0) then
|
||||
Result := TQtWidget(QtWidgetSet.GetActiveWindow).Widget
|
||||
else
|
||||
if Assigned(Application.MainForm) and Application.MainForm.Visible then
|
||||
Result := TQtWidget(Application.MainForm.Handle).Widget
|
||||
else
|
||||
@ -350,6 +353,7 @@ var
|
||||
selectedFilter, saveFileName, saveFilter, saveTitle: WideString;
|
||||
Flags: Cardinal;
|
||||
{$endif}
|
||||
ActiveWin: HWND;
|
||||
begin
|
||||
{------------------------------------------------------------------------------
|
||||
Initialization of variables
|
||||
@ -373,6 +377,7 @@ begin
|
||||
if ACommonDialog is TSelectDirectoryDialog then
|
||||
QtFileDialog.setFileMode(QFileDialogDirectoryOnly);
|
||||
|
||||
ActiveWin := QtWidgetSet.GetActiveWindow;
|
||||
if ACommonDialog is TSaveDialog then
|
||||
begin
|
||||
{$ifdef QT_NATIVE_DIALOGS}
|
||||
@ -482,6 +487,11 @@ begin
|
||||
end;
|
||||
{$endif}
|
||||
end;
|
||||
if ActiveWin <> 0 then
|
||||
begin
|
||||
if QtWidgetSet.IsValidHandle(ActiveWin) then
|
||||
QtWidgetSet.SetActiveWindow(ActiveWin);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TQtWSSelectDirectoryDialog }
|
||||
|
Loading…
Reference in New Issue
Block a user