mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 09:16:16 +02:00
git-svn-id: trunk@64857 -
This commit is contained in:
parent
6e22a97b90
commit
7b8b329d98
@ -8115,53 +8115,30 @@ var
|
|||||||
LeftMargin: Integer;
|
LeftMargin: Integer;
|
||||||
TopMargin: Integer;
|
TopMargin: Integer;
|
||||||
RightMargin: Integer;
|
RightMargin: Integer;
|
||||||
BottomMargin: Integer;
|
BottomMargin, AStyleMetric: Integer;
|
||||||
{$IFDEF HASX11}
|
|
||||||
Font: QFontH;
|
|
||||||
FontMetrics: QFontMetricsH;
|
|
||||||
FontHeight: Integer;
|
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
if ALayout = nil then
|
if ALayout = nil then
|
||||||
exit;
|
exit;
|
||||||
QWidget_getContentsMargins(AWidget,@LeftMargin, @TopMargin, @RightMargin, @BottomMargin);
|
QWidget_getContentsMargins(AWidget,@LeftMargin, @TopMargin, @RightMargin, @BottomMargin);
|
||||||
|
|
||||||
{if contentsMargins TopMargin is huge then we must rethink about TopMargin
|
AStyleMetric := QStyle_pixelMetric(QApplication_style(), QStyleSE_DockWidgetTitleBarText, nil, Widget);
|
||||||
size (eg.oxygen theme have 32 top margin while plastique have 19
|
|
||||||
with same font height) }
|
{issue #37576}
|
||||||
{$IFDEF HASX11}
|
{if (AStyle = 'fusion') or (AStyle = 'gtk2') or
|
||||||
Font := QWidget_font(AWidget);
|
(AStyle = 'qt5ct-style') then}
|
||||||
FontMetrics := QFontMetrics_create(Font);
|
if AStyleMetric = 0 then
|
||||||
try
|
else
|
||||||
FontHeight := QFontMetrics_height(FontMetrics);
|
if (getText = '') then
|
||||||
finally
|
|
||||||
QFontMetrics_destroy(FontMetrics);
|
|
||||||
end;
|
|
||||||
{currently applies only to wrong TopMargin calculation (eg.gtk style).}
|
|
||||||
if (TopMargin - FontHeight < 2) then
|
|
||||||
TopMargin := FontHeight + 2 // top & bottom +1px
|
|
||||||
else {currently applies only to oxygen & nitrogen theme.}
|
|
||||||
if ((TopMargin - BottomMargin - 2) > FontHeight) then
|
|
||||||
begin
|
|
||||||
{do not touch fusion style !}
|
|
||||||
if QtWidgetSet.StyleName <> 'fusion' then
|
|
||||||
begin
|
|
||||||
TopMargin := TopMargin - BottomMargin - 3;
|
|
||||||
BottomMargin := 0;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
{if there's no text set margin to bottom margin size. issue #23642}
|
|
||||||
if getText = '' then
|
|
||||||
TopMargin := BottomMargin;
|
TopMargin := BottomMargin;
|
||||||
|
|
||||||
QLayout_setContentsMargins(ALayout, LeftMargin, TopMargin, RightMargin, BottomMargin);
|
QLayout_setContentsMargins(ALayout, LeftMargin, TopMargin, RightMargin, BottomMargin);
|
||||||
QLayout_invalidate(ALayout);
|
QLayout_invalidate(ALayout);
|
||||||
|
|
||||||
if (LCLObject <> nil) and testAttribute(QtWA_Mapped) then
|
if (LCLObject <> nil) and testAttribute(QtWA_Mapped) then
|
||||||
begin
|
begin
|
||||||
{.$IFDEF VerboseQtResize}
|
{$IFDEF VerboseQtResize}
|
||||||
DebugLn('TQtGroupBox.setLayoutThemeMargins: ',dbgsName(LCLObject),' casp: ',dbgs(caspComputingBounds in LCLObject.AutoSizePhases),' mapped ',dbgs(testAttribute(QtWA_Mapped)));
|
DebugLn('TQtGroupBox.setLayoutThemeMargins: ',dbgsName(LCLObject),' casp: ',dbgs(caspComputingBounds in LCLObject.AutoSizePhases),' mapped ',dbgs(testAttribute(QtWA_Mapped)));
|
||||||
{.$ENDIF}
|
{$ENDIF}
|
||||||
LCLObject.DoAdjustClientRectChange(False);
|
LCLObject.DoAdjustClientRectChange(False);
|
||||||
LCLObject.InvalidateClientRectCache(True);
|
LCLObject.InvalidateClientRectCache(True);
|
||||||
end;
|
end;
|
||||||
@ -8378,7 +8355,15 @@ var
|
|||||||
L, T, R, B: Integer;
|
L, T, R, B: Integer;
|
||||||
ASize: TSize;
|
ASize: TSize;
|
||||||
begin
|
begin
|
||||||
QWidget_getContentsMargins(Widget,@L, @T, @R, @B);
|
if WithThemeSpace then
|
||||||
|
QWidget_getContentsMargins(Widget,@L, @T, @R, @B)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
L := 0;
|
||||||
|
T := 0;
|
||||||
|
R := 0;
|
||||||
|
B := 0;
|
||||||
|
end;
|
||||||
QGroupBox_minimumSizeHint(QGroupBoxH(Widget), @ASize);
|
QGroupBox_minimumSizeHint(QGroupBoxH(Widget), @ASize);
|
||||||
PreferredWidth := ASize.cx + L + R;
|
PreferredWidth := ASize.cx + L + R;
|
||||||
PreferredHeight := ASize.cy + B + T;
|
PreferredHeight := ASize.cy + B + T;
|
||||||
|
Loading…
Reference in New Issue
Block a user