mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-13 21:39:39 +02:00
LCL: Bug fix for QT painting non-visual components for TFakeNonControl design form (TDataModule and TFrame). From Maciej.
git-svn-id: trunk@50418 -
This commit is contained in:
parent
3412df60dc
commit
79dcb7831b
@ -292,7 +292,6 @@ procedure SetDesignInfoLeft(AComponent: TComponent; const aLeft: SmallInt); inli
|
||||
procedure SetDesignInfoTop(AComponent: TComponent; const aTop: SmallInt); inline;
|
||||
function LeftTopToDesignInfo(const ALeft, ATop: SmallInt): LongInt; inline;
|
||||
procedure DesignInfoToLeftTop(ADesignInfo: LongInt; out ALeft, ATop: SmallInt); inline;
|
||||
function IsFormDesign(AForm: TCustomForm): boolean;
|
||||
function LookupRoot(AForm: TCustomForm): TComponent;
|
||||
|
||||
implementation
|
||||
@ -386,13 +385,15 @@ begin
|
||||
ATop := LazLongRec(ADesignInfo).Hi;
|
||||
end;
|
||||
|
||||
function IsFormDesign(AForm: TCustomForm): boolean;
|
||||
function IsFormDesignFunction(AForm: TWinControl): boolean;
|
||||
var
|
||||
LForm: TCustomForm absolute AForm;
|
||||
begin
|
||||
if AForm = nil then
|
||||
if (AForm = nil) or not (AForm is TCustomForm) then
|
||||
Exit(False);
|
||||
Result := (csDesignInstance in AForm.ComponentState)
|
||||
or ((csDesigning in AForm.ComponentState) and (AForm.Designer <> nil))
|
||||
or (AForm is TNonFormProxyDesignerForm);
|
||||
Result := (csDesignInstance in LForm.ComponentState)
|
||||
or ((csDesigning in LForm.ComponentState) and (LForm.Designer <> nil))
|
||||
or (LForm is TNonFormProxyDesignerForm);
|
||||
end;
|
||||
|
||||
function LookupRoot(AForm: TCustomForm): TComponent;
|
||||
@ -807,5 +808,7 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
initialization
|
||||
IsFormDesign := @IsFormDesignFunction;
|
||||
end.
|
||||
|
||||
|
13
lcl/forms.pp
13
lcl/forms.pp
@ -1738,9 +1738,11 @@ procedure RestoreFocusState(FocusState: TFocusState);
|
||||
type
|
||||
TGetDesignerFormEvent =
|
||||
function(APersistent: TPersistent): TCustomForm of object;
|
||||
TIsFormDesignFunction = function(AForm: TWinControl): boolean;
|
||||
|
||||
var
|
||||
OnGetDesignerForm: TGetDesignerFormEvent = nil;
|
||||
IsFormDesign: TIsFormDesignFunction = nil;
|
||||
|
||||
function GetParentForm(Control: TControl; TopForm: Boolean = True): TCustomForm;
|
||||
function GetFirstParentForm(Control:TControl): TCustomForm;
|
||||
@ -2114,6 +2116,16 @@ begin
|
||||
ImageList.Draw(Canvas,AX,AY,AIndex,ADrawEffect);
|
||||
end;
|
||||
|
||||
function IsFormDesignFunction(AForm: TWinControl): boolean;
|
||||
var
|
||||
LForm: TCustomForm absolute AForm;
|
||||
begin
|
||||
if (AForm = nil) or not (AForm is TCustomForm) then
|
||||
Exit(False);
|
||||
Result := (csDesignInstance in LForm.ComponentState)
|
||||
or ((csDesigning in LForm.ComponentState) and (LForm.Designer <> nil));
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPropertyToSkip(TForm, 'OldCreateOrder', 'VCL compatibility property', '');
|
||||
RegisterPropertyToSkip(TForm, 'TextHeight', 'VCL compatibility property', '');
|
||||
@ -2121,6 +2133,7 @@ initialization
|
||||
RegisterPropertyToSkip(TForm, 'TransparentColorValue', 'VCL compatibility property', '');
|
||||
LCLProc.OwnerFormDesignerModifiedProc:=@IfOwnerIsFormThenDesignerModified;
|
||||
ThemesImageDrawEvent:=@ImageDrawEvent;
|
||||
IsFormDesign := @IsFormDesignFunction;
|
||||
Screen:=TScreen.Create(nil);
|
||||
Application:=TApplication.Create(nil);
|
||||
|
||||
|
@ -174,7 +174,7 @@ begin
|
||||
if (QtVersionMajor = 4) and (QtVersionMinor >= 6) then
|
||||
QCoreApplication_setAttribute(QtAA_ImmediateWidgetCreation, True);
|
||||
{$ENDIF}
|
||||
if csDesigning in AWinControl.ComponentState then
|
||||
if IsFormDesign(AWinControl) or (csDesigning in AWinControl.ComponentState) then
|
||||
QtMainWindow := TQtDesignWidget.Create(AWinControl, AParams)
|
||||
else
|
||||
QtMainWindow := TQtMainWindow.Create(AWinControl, AParams);
|
||||
|
Loading…
Reference in New Issue
Block a user