qt: fix GetMenuHeight, issue #28034

git-svn-id: trunk@51806 -
This commit is contained in:
ondrej 2016-03-02 15:09:25 +00:00
parent aa7d1d4437
commit 5e30a09527

View File

@ -1841,7 +1841,7 @@ var
Size: TSize; Size: TSize;
begin begin
{$IFDEF DARWIN} {$IFDEF DARWIN}
FCachedMenuBarHeight := 1; Exit(0);
{$ENDIF} {$ENDIF}
if FCachedMenuBarHeight = -1 then if FCachedMenuBarHeight = -1 then
begin begin
@ -1854,19 +1854,10 @@ begin
QMenuBar_sizeHint(AMenuBar, @Size); QMenuBar_sizeHint(AMenuBar, @Size);
QMainWindow_destroy(DummyWindow); QMainWindow_destroy(DummyWindow);
FCachedMenuBarHeight := Size.cy; FCachedMenuBarHeight := Size.cy;
if QStyle_styleHint(QApplication_style(),
QStyleSH_MainWindow_SpaceBelowMenuBar) > 0 then
inc(FCachedMenuBarHeight, 4);
if QStyle_styleHint(QApplication_style(),
QStyleSH_ScrollView_FrameOnlyAroundContents) > 0 then
inc(FCachedMenuBarHeight, 4);
end; end;
if (FCachedMenuBarHeight <= 0) then if (FCachedMenuBarHeight <= 0) then
begin begin
FCachedMenuBarHeight := 22; FCachedMenuBarHeight := 22;
if QStyle_styleHint(QApplication_style(), QStyleSH_MainWindow_SpaceBelowMenuBar) > 0 then
inc(FCachedMenuBarHeight, 4);
end; end;
Result := FCachedMenuBarHeight; Result := FCachedMenuBarHeight;
end; end;