diff --git a/lcl/interfaces/customdrawn/customdrawnprivate.pas b/lcl/interfaces/customdrawn/customdrawnprivate.pas index 487c839115..cb5c391ec6 100644 --- a/lcl/interfaces/customdrawn/customdrawnprivate.pas +++ b/lcl/interfaces/customdrawn/customdrawnprivate.pas @@ -231,6 +231,7 @@ var lTarget: TWinControl; begin lTarget := AWindowHandle.GetFocusedControl(); + if lTarget = nil then Exit; {$ifdef VerboseCDEvents} DebugLn(Format('CallbackKeyUp FocusedControl=%s:%s', [lTarget.Name, lTarget.ClassName])); {$endif} diff --git a/lcl/interfaces/customdrawn/customdrawnproc.pas b/lcl/interfaces/customdrawn/customdrawnproc.pas index 9dad34bfd8..21eefb53be 100644 --- a/lcl/interfaces/customdrawn/customdrawnproc.pas +++ b/lcl/interfaces/customdrawn/customdrawnproc.pas @@ -238,7 +238,6 @@ begin {$ENDIF} lFormInfo := TCDNonNativeForm.Create; lFormInfo.LCLForm := AForm; - lFormInfo.Children := TFPList.Create; AddFormWithCDHandle(lFormInfo); Result := lFormInfo; end; @@ -986,11 +985,14 @@ begin //FProps.CaseSensitive:=false; commented as in the qt widgetset FProps.Sorted:=true; IncInvalidateCount(); // Always starts needing an invalidate + + Children := TFPList.Create; end; destructor TCDBaseControl.Destroy; begin FProps.Free; + Children.Free; // Free the Canvas and Image if required // Dont free for the Form because elsewhere this is taken care of diff --git a/lcl/interfaces/customdrawn/customdrawnwsbuttons.pas b/lcl/interfaces/customdrawn/customdrawnwsbuttons.pas index de39b33c12..6511550503 100644 --- a/lcl/interfaces/customdrawn/customdrawnwsbuttons.pas +++ b/lcl/interfaces/customdrawn/customdrawnwsbuttons.pas @@ -113,51 +113,17 @@ end; Returns: Nothing ------------------------------------------------------------------------------} class procedure TCDWSBitBtn.SetGlyph(const ABitBtn: TCustomBitBtn; const AValue: TButtonGlyph); -(*const - IconModeToButtonState: array[QIconMode] of TButtonState = - ( -{ QIconNormal } bsUp, -{ QIconDisabled } bsDisabled, -{ QIconActive } bsHot, -{ QIconSelected } bsDown - ); - var - AIcon: QIconH; - APixmap: QPixmapH; - AGlyph: TBitmap; - AIndex: Integer; - AEffect: TGraphicsDrawEffect; - Mode: QIconMode; - ASize: TSize;*) + lCDWinControl: TCDWinControl; + lCDControl: TCDIntfButton; begin -{ if not WSCheckHandleAllocated(ABitBtn, 'SetGlyph') then - Exit; + // if not WSCheckHandleAllocated(ABitBtn, 'SetGlyph') then + // Exit; - TQtBitBtn(ABitBtn.Handle).GlyphLayout := Ord(ABitBtn.Layout); - AIcon := QIcon_create(); - if ABitBtn.CanShowGlyph then - begin - AGlyph := TBitmap.Create; - APixmap := QPixmap_create(); + lCDWinControl := TCDWinControl(ABitBtn.Handle); + lCDControl := TCDIntfButton(lCDWinControl.CDControl); - for Mode := QIconNormal to QIconSelected do - begin - AValue.GetImageIndexAndEffect(IconModeToButtonState[Mode], AIndex, AEffect); - AValue.Images.GetBitmap(AIndex, AGlyph, AEffect); - QPixmap_fromImage(APixmap, TQtImage(AGlyph.Handle).Handle); - QIcon_addPixmap(AIcon, APixmap, Mode, QIconOn); - end; - QPixmap_destroy(APixmap); - AGlyph.Free; - - ASize.cx := AValue.Images.Width; - ASize.cy := AValue.Images.Height; - TQtBitBtn(ABitBtn.Handle).setIconSize(@ASize); - end; - - TQtBitBtn(ABitBtn.Handle).setIcon(AIcon); - QIcon_destroy(AIcon);} + lCDControl.Glyph.Assign(AValue.Glyph); end; class procedure TCDWSBitBtn.SetLayout(const ABitBtn: TCustomBitBtn;