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:
juha 2015-11-19 13:55:33 +00:00
parent 3412df60dc
commit 79dcb7831b
3 changed files with 23 additions and 7 deletions

View File

@ -292,7 +292,6 @@ procedure SetDesignInfoLeft(AComponent: TComponent; const aLeft: SmallInt); inli
procedure SetDesignInfoTop(AComponent: TComponent; const aTop: SmallInt); inline; procedure SetDesignInfoTop(AComponent: TComponent; const aTop: SmallInt); inline;
function LeftTopToDesignInfo(const ALeft, ATop: SmallInt): LongInt; inline; function LeftTopToDesignInfo(const ALeft, ATop: SmallInt): LongInt; inline;
procedure DesignInfoToLeftTop(ADesignInfo: LongInt; out ALeft, ATop: SmallInt); inline; procedure DesignInfoToLeftTop(ADesignInfo: LongInt; out ALeft, ATop: SmallInt); inline;
function IsFormDesign(AForm: TCustomForm): boolean;
function LookupRoot(AForm: TCustomForm): TComponent; function LookupRoot(AForm: TCustomForm): TComponent;
implementation implementation
@ -386,13 +385,15 @@ begin
ATop := LazLongRec(ADesignInfo).Hi; ATop := LazLongRec(ADesignInfo).Hi;
end; end;
function IsFormDesign(AForm: TCustomForm): boolean; function IsFormDesignFunction(AForm: TWinControl): boolean;
var
LForm: TCustomForm absolute AForm;
begin begin
if AForm = nil then if (AForm = nil) or not (AForm is TCustomForm) then
Exit(False); Exit(False);
Result := (csDesignInstance in AForm.ComponentState) Result := (csDesignInstance in LForm.ComponentState)
or ((csDesigning in AForm.ComponentState) and (AForm.Designer <> nil)) or ((csDesigning in LForm.ComponentState) and (LForm.Designer <> nil))
or (AForm is TNonFormProxyDesignerForm); or (LForm is TNonFormProxyDesignerForm);
end; end;
function LookupRoot(AForm: TCustomForm): TComponent; function LookupRoot(AForm: TCustomForm): TComponent;
@ -807,5 +808,7 @@ begin
end; end;
initialization
IsFormDesign := @IsFormDesignFunction;
end. end.

View File

@ -1738,9 +1738,11 @@ procedure RestoreFocusState(FocusState: TFocusState);
type type
TGetDesignerFormEvent = TGetDesignerFormEvent =
function(APersistent: TPersistent): TCustomForm of object; function(APersistent: TPersistent): TCustomForm of object;
TIsFormDesignFunction = function(AForm: TWinControl): boolean;
var var
OnGetDesignerForm: TGetDesignerFormEvent = nil; OnGetDesignerForm: TGetDesignerFormEvent = nil;
IsFormDesign: TIsFormDesignFunction = nil;
function GetParentForm(Control: TControl; TopForm: Boolean = True): TCustomForm; function GetParentForm(Control: TControl; TopForm: Boolean = True): TCustomForm;
function GetFirstParentForm(Control:TControl): TCustomForm; function GetFirstParentForm(Control:TControl): TCustomForm;
@ -2114,6 +2116,16 @@ begin
ImageList.Draw(Canvas,AX,AY,AIndex,ADrawEffect); ImageList.Draw(Canvas,AX,AY,AIndex,ADrawEffect);
end; 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 initialization
RegisterPropertyToSkip(TForm, 'OldCreateOrder', 'VCL compatibility property', ''); RegisterPropertyToSkip(TForm, 'OldCreateOrder', 'VCL compatibility property', '');
RegisterPropertyToSkip(TForm, 'TextHeight', 'VCL compatibility property', ''); RegisterPropertyToSkip(TForm, 'TextHeight', 'VCL compatibility property', '');
@ -2121,6 +2133,7 @@ initialization
RegisterPropertyToSkip(TForm, 'TransparentColorValue', 'VCL compatibility property', ''); RegisterPropertyToSkip(TForm, 'TransparentColorValue', 'VCL compatibility property', '');
LCLProc.OwnerFormDesignerModifiedProc:=@IfOwnerIsFormThenDesignerModified; LCLProc.OwnerFormDesignerModifiedProc:=@IfOwnerIsFormThenDesignerModified;
ThemesImageDrawEvent:=@ImageDrawEvent; ThemesImageDrawEvent:=@ImageDrawEvent;
IsFormDesign := @IsFormDesignFunction;
Screen:=TScreen.Create(nil); Screen:=TScreen.Create(nil);
Application:=TApplication.Create(nil); Application:=TApplication.Create(nil);

View File

@ -174,7 +174,7 @@ begin
if (QtVersionMajor = 4) and (QtVersionMinor >= 6) then if (QtVersionMajor = 4) and (QtVersionMinor >= 6) then
QCoreApplication_setAttribute(QtAA_ImmediateWidgetCreation, True); QCoreApplication_setAttribute(QtAA_ImmediateWidgetCreation, True);
{$ENDIF} {$ENDIF}
if csDesigning in AWinControl.ComponentState then if IsFormDesign(AWinControl) or (csDesigning in AWinControl.ComponentState) then
QtMainWindow := TQtDesignWidget.Create(AWinControl, AParams) QtMainWindow := TQtDesignWidget.Create(AWinControl, AParams)
else else
QtMainWindow := TQtMainWindow.Create(AWinControl, AParams); QtMainWindow := TQtMainWindow.Create(AWinControl, AParams);