Changeset 734


Ignore:
Timestamp:
Jan 17, 2026, 4:57:01 PM (9 hours ago)
Author:
chronos
Message:
  • Fixed: Some buttons were not paint correctly with Qt5 widgetset.
Location:
trunk/Packages/CevoComponents
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/ButtonB.pas

    r554 r734  
    44
    55uses
    6   ButtonBase, Classes, LCLIntf, LCLType,
     6  ButtonBase, Classes, LCLIntf, LCLType, SysUtils,
    77  {$IFDEF DPI}Dpi.Graphics{$ELSE}Graphics{$ENDIF};
    88
    99type
     10
     11  { TButtonB }
     12
    1013  TButtonB = class(TButtonBase)
    11     constructor Create(AOwner: TComponent); override;
    1214  private
    1315    FMask: TBitmap;
    1416    FIndex: Integer;
     17    FBuffer: TBitmap;
    1518    procedure SetIndex(Text: Integer);
    1619  protected
    1720    procedure Paint; override;
    1821  public
     22    constructor Create(AOwner: TComponent); override;
     23    destructor Destroy; override;
    1924    property Mask: TBitmap read FMask write FMask;
    2025  published
     
    3742end;
    3843
    39 constructor TButtonB.Create(AOwner: TComponent);
     44constructor TButtonB.Create;
    4045begin
    4146  inherited;
    4247  ShowHint := True;
    4348  SetBounds(0, 0, 25, 25);
     49  FBuffer := TBitmap.Create;
     50  FBuffer.PixelFormat := TPixelFormat.pf24bit;
     51  FBuffer.SetSize(Width, Height);
     52  FBuffer.Canvas.FillRect(0, 0, FBuffer.Width, FBuffer.Height);
     53end;
     54
     55destructor TButtonB.Destroy;
     56begin
     57  FreeAndNil(FBuffer);
     58  inherited;
    4459end;
    4560
     
    4863  with Canvas do
    4964    if FGraphic <> nil then begin
    50       BitBltCanvas(Canvas, 0, 0, 25, 25, FGraphic.Canvas, 169,
     65      UnshareBitmap(FBuffer);
     66      BitBltBitmap(FBuffer, 0, 0, Width, Height, FGraphic, 169,
    5167        243 + 26 * Byte(FDown));
    5268      if FIndex >= 0 then begin
    53         BitBltCanvas(Canvas, 0, 0, 25, 25, FMask.Canvas,
     69        BitBltBitmap(FBuffer, 0, 0, Width, Height, FMask,
    5470          1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCAND);
    55         BitBltCanvas(Canvas, 0, 0, 25, 25, FGraphic.Canvas,
     71        BitBltBitmap(FBuffer, 0, 0, Width, Height, FGraphic,
    5672          1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCPAINT);
    5773      end;
     74      BitBltCanvas(Canvas, 0, 0, Width, Height, FBuffer.Canvas, 0, 0);
    5875    end else begin
    5976      Brush.Color := $0000FF;
    60       FrameRect(Rect(0, 0, 25, 25));
     77      FrameRect(Rect(0, 0, Width, Height));
    6178    end;
     79  inherited;
    6280end;
    6381
  • trunk/Packages/CevoComponents/ButtonBase.pas

    r554 r734  
    111111        { PlayDownSound; }
    112112        FDown := True;
    113         Paint;
     113        Invalidate;
    114114        if @DownChangedProc <> nil then
    115115          DownChangedProc(Self);
     
    120120      { PlayUpSound; }
    121121      FDown := False;
    122       Paint;
     122      Invalidate;
    123123      if @DownChangedProc <> nil then
    124124        DownChangedProc(Self);
  • trunk/Packages/CevoComponents/EOTButton.pas

    r554 r734  
    2222    procedure SetIndex(X: Integer);
    2323  protected
    24     Buffer, Back: TBitmap;
     24    Buffer: TBitmap;
     25    Back: TBitmap;
    2526    procedure Paint; override;
    2627  public
Note: See TracChangeset for help on using the changeset viewer.