mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-18 01:08:20 +02:00
Qt: fixed TQtWidgetSet.SetFocus(), it should activate parent form if we call setfocus for control which is on inactive form.
git-svn-id: trunk@27614 -
This commit is contained in:
parent
68863ce1c3
commit
ae23055240
@ -219,6 +219,7 @@ type
|
|||||||
function getHeight: Integer;
|
function getHeight: Integer;
|
||||||
function getUpdatesEnabled: Boolean;
|
function getUpdatesEnabled: Boolean;
|
||||||
function getWidth: Integer;
|
function getWidth: Integer;
|
||||||
|
function getWindow: TQtWidget;
|
||||||
function getWindowState: QtWindowStates;
|
function getWindowState: QtWindowStates;
|
||||||
procedure grabMouse; virtual;
|
procedure grabMouse; virtual;
|
||||||
function hasFocus: Boolean; virtual;
|
function hasFocus: Boolean; virtual;
|
||||||
@ -491,6 +492,7 @@ type
|
|||||||
|
|
||||||
TQtMainWindow = class(TQtWidget)
|
TQtMainWindow = class(TQtWidget)
|
||||||
private
|
private
|
||||||
|
FBlocked: Boolean;
|
||||||
LayoutWidget: QBoxLayoutH;
|
LayoutWidget: QBoxLayoutH;
|
||||||
FCWEventHook: QObject_hookH;
|
FCWEventHook: QObject_hookH;
|
||||||
FShowOnTaskBar: Boolean;
|
FShowOnTaskBar: Boolean;
|
||||||
@ -524,6 +526,7 @@ type
|
|||||||
procedure slotWindowStateChange; cdecl;
|
procedure slotWindowStateChange; cdecl;
|
||||||
procedure setShowInTaskBar(AValue: Boolean);
|
procedure setShowInTaskBar(AValue: Boolean);
|
||||||
procedure setPopupParent(APopupMode: TPopupMode; NewParent: QWidgetH);
|
procedure setPopupParent(APopupMode: TPopupMode; NewParent: QWidgetH);
|
||||||
|
property Blocked: Boolean read FBlocked write FBlocked;
|
||||||
property ShowOnTaskBar: Boolean read FShowOnTaskBar;
|
property ShowOnTaskBar: Boolean read FShowOnTaskBar;
|
||||||
public
|
public
|
||||||
procedure AttachEvents; override;
|
procedure AttachEvents; override;
|
||||||
@ -3498,6 +3501,16 @@ begin
|
|||||||
Result := QWidget_width(Widget);
|
Result := QWidget_width(Widget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidget.getWindow: TQtWidget;
|
||||||
|
var
|
||||||
|
W: QWidgetH;
|
||||||
|
begin
|
||||||
|
Result := nil;
|
||||||
|
W := QWidget_window(Widget);
|
||||||
|
if W <> nil then
|
||||||
|
Result := TQtWidget(HwndFromWidgetH(W));
|
||||||
|
end;
|
||||||
|
|
||||||
function TQtWidget.getWindowState: QtWindowStates;
|
function TQtWidget.getWindowState: QtWindowStates;
|
||||||
begin
|
begin
|
||||||
Result := QWidget_windowState(Widget);
|
Result := QWidget_windowState(Widget);
|
||||||
@ -4581,6 +4594,7 @@ begin
|
|||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('TQtMainWindow.CreateWidget Name: ', LCLObject.Name);
|
WriteLn('TQtMainWindow.CreateWidget Name: ', LCLObject.Name);
|
||||||
{$endif}
|
{$endif}
|
||||||
|
FBlocked := False;
|
||||||
FShowOnTaskBar := False;
|
FShowOnTaskBar := False;
|
||||||
QtFormBorderStyle := Ord(bsSizeable);
|
QtFormBorderStyle := Ord(bsSizeable);
|
||||||
QtFormStyle := Ord(fsNormal);
|
QtFormStyle := Ord(fsNormal);
|
||||||
@ -4821,6 +4835,8 @@ begin
|
|||||||
|
|
||||||
BeginEventProcessing;
|
BeginEventProcessing;
|
||||||
case QEvent_type(Event) of
|
case QEvent_type(Event) of
|
||||||
|
QEventWindowUnblocked: Blocked := False;
|
||||||
|
QEventWindowBlocked: Blocked := True;
|
||||||
QEventWindowActivate: SlotActivateWindow(True);
|
QEventWindowActivate: SlotActivateWindow(True);
|
||||||
QEventWindowDeactivate: SlotActivateWindow(False);
|
QEventWindowDeactivate: SlotActivateWindow(False);
|
||||||
QEventShowToParent:
|
QEventShowToParent:
|
||||||
|
@ -4881,6 +4881,8 @@ end;
|
|||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TQtWidgetSet.SetFocus(hWnd: HWND): HWND;
|
function TQtWidgetSet.SetFocus(hWnd: HWND): HWND;
|
||||||
|
var
|
||||||
|
W: TQtWidget;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if hwnd<>0 then
|
if hwnd<>0 then
|
||||||
@ -4889,6 +4891,10 @@ begin
|
|||||||
WriteLn('********* TQtWidgetSet.SetFocus INIT focusing ', TQtWidget(hwnd).lclobject.name);
|
WriteLn('********* TQtWidgetSet.SetFocus INIT focusing ', TQtWidget(hwnd).lclobject.name);
|
||||||
{$endif}
|
{$endif}
|
||||||
Result := GetFocus;
|
Result := GetFocus;
|
||||||
|
W := TQtWidget(HWND).getWindow;
|
||||||
|
if (W <> nil) and not W.IsActiveWindow and
|
||||||
|
not TQtMainWindow(W).Blocked then
|
||||||
|
W.Activate;
|
||||||
TQtWidget(hWnd).setFocus;
|
TQtWidget(hWnd).setFocus;
|
||||||
{$ifdef VerboseFocus}
|
{$ifdef VerboseFocus}
|
||||||
DebugLn('********* TQtWidgetSet.SetFocus END was %x now is %x',[result,hwnd]);
|
DebugLn('********* TQtWidgetSet.SetFocus END was %x now is %x',[result,hwnd]);
|
||||||
|
Loading…
Reference in New Issue
Block a user