From b4fb7517828c08c9c1cd615fd2c5c5b0bfe60b91 Mon Sep 17 00:00:00 2001 From: zeljko Date: Sun, 11 May 2014 10:37:38 +0000 Subject: [PATCH] Qt: use QWidget_geometry() when calculating default clientrect of TCustomForm while it's not mapped. git-svn-id: trunk@45003 - --- lcl/interfaces/qt/qtwsforms.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lcl/interfaces/qt/qtwsforms.pp b/lcl/interfaces/qt/qtwsforms.pp index 6d56054d19..5bab5b8a7f 100644 --- a/lcl/interfaces/qt/qtwsforms.pp +++ b/lcl/interfaces/qt/qtwsforms.pp @@ -957,8 +957,8 @@ var ASize: TSize; begin Result := False; - if AWinControl.HandleAllocated and not - TQtMainWindow(AWinControl.Handle).testAttribute(QtWA_Mapped) then + if AWinControl.HandleAllocated and + not TQtMainWindow(AWinControl.Handle).testAttribute(QtWA_Mapped) then begin if Assigned(TCustomForm(AWinControl).Menu) then begin @@ -966,7 +966,9 @@ begin if Assigned(AWin.MenuBar) then begin AWin.MenuBar.sizeHint(@ASize); - aClientRect := AWin.getClientBounds; + // we must use real geometry, and then exclude menubar height. + aClientRect := AWin.getGeometry; + OffsetRect(aClientRect, -aClientRect.Left, -aClientRect.Top); dec(AClientRect.Bottom, ASize.cy); {$IFDEF VerboseQtResize} DebugLn('TQtWSCustomForm.getDefaultClientRect ',dbgsName(AWinControl),' ',dbgs(AWin.getClientBounds),' mnuBarHeight ',dbgs(AWin.MenuBar.getHeight),' ASize=',dbgs(ASize),' FINAL=',dbgs(AClientRect));