From e579957f39fdbaa01dfae624a20479ae9a332dcd Mon Sep 17 00:00:00 2001 From: zeljko Date: Tue, 11 Nov 2008 16:41:48 +0000 Subject: [PATCH] Qt: Huge boost to designer painting when "Show grid" enabled (on X11 is at least x10)., implemented qtlclintf DrawGrid(). git-svn-id: trunk@17347 - --- lcl/interfaces/qt/qtlclintf.inc | 20 ++++++++++++++++++++ lcl/interfaces/qt/qtlclintfh.inc | 1 + 2 files changed, 21 insertions(+) diff --git a/lcl/interfaces/qt/qtlclintf.inc b/lcl/interfaces/qt/qtlclintf.inc index a711036169..cb007a1352 100644 --- a/lcl/interfaces/qt/qtlclintf.inc +++ b/lcl/interfaces/qt/qtlclintf.inc @@ -147,6 +147,26 @@ begin end; end; +procedure TQtWidgetSet.DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); +var + QtDC: TQtDeviceContext absolute DC; + X, Y: Integer; + W, H: Integer; +begin + if not IsValidDC(DC) then + exit; + QtDC.save; + try + W := (R.Right - R.Left - 1) div DX; + H := (R.Bottom - R.Top - 1) div DY; + + for X := 0 to W do + for Y := 0 to H do + QtDC.drawPoint(R.Left + X * DX, R.Top + Y * DY + 1); + finally + QtDC.restore; + end; +end; {------------------------------------------------------------------------------ Function: FontCanUTF8 diff --git a/lcl/interfaces/qt/qtlclintfh.inc b/lcl/interfaces/qt/qtlclintfh.inc index 1142eef0b0..eeac10dfa6 100644 --- a/lcl/interfaces/qt/qtlclintfh.inc +++ b/lcl/interfaces/qt/qtlclintfh.inc @@ -40,6 +40,7 @@ function AddProcessEventHandler(AHandle: THandle; function CreateStandardCursor(ACursor: SmallInt): HCURSOR; override; procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); override; procedure DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation); override; +procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override; function FontCanUTF8(Font: HFont): boolean; override; function FontIsMonoSpace(Font: HFont): boolean; override;