diff --git a/lcl/interfaces/qt/qtwscomctrls.pp b/lcl/interfaces/qt/qtwscomctrls.pp index e9c01001bb..83b695d6d7 100644 --- a/lcl/interfaces/qt/qtwscomctrls.pp +++ b/lcl/interfaces/qt/qtwscomctrls.pp @@ -552,6 +552,7 @@ class procedure TQtWSStatusBar.RecreatePanels(const AStatusBar: TStatusBar; var Str: WideString; i: Integer; + Margin: Integer; begin Str := ''; //clean up. http://bugs.freepascal.org/view.php?id=18683 @@ -564,6 +565,9 @@ begin end else if AStatusBar.Panels.Count > 0 then begin + Margin := (QStyle_pixelMetric(QApplication_style(), QStylePM_DefaultFrameWidth, nil, nil) * 2) - 1; + if Margin <= 0 then + Margin := 2; Widget.setUpdatesEnabled(False); SetLength(Widget.Panels, AStatusBar.Panels.Count); for i := 0 to AStatusBar.Panels.Count - 1 do @@ -577,6 +581,8 @@ begin QLabel_setAlignment(QLabelH(Widget.Panels[i].Widget), AlignmentToQtAlignmentMap[AStatusBar.Panels[i].Alignment]); QWidget_setMinimumWidth(Widget.Panels[i].Widget, AStatusBar.Panels[i].Width); + QWidget_setVisible(Widget.Panels[i].Widget, + AStatusBar.Panels[i].Width >= Margin); Widget.Panels[i].AttachEvents; Widget.addWidget(Widget.Panels[i].Widget, ord(i = AStatusBar.Panels.Count - 1)); end; @@ -614,6 +620,7 @@ class procedure TQtWSStatusBar.PanelUpdate(const AStatusBar: TStatusBar; PanelIn var QtStatusBar: TQtStatusBar; Str: Widestring; + Margin: Integer; begin QtStatusBar := TQtStatusBar(AStatusBar.Handle); if AStatusBar.SimplePanel then @@ -629,12 +636,18 @@ begin if (PanelIndex >= Low(QtStatusBar.Panels)) and (PanelIndex <= High(QtStatusBar.Panels)) then begin + Margin := (QStyle_pixelMetric(QApplication_style(), QStylePM_DefaultFrameWidth, nil, nil) * 2) - 1; + if Margin <= 0 then + Margin := 2; + Str := GetUtf8String(AStatusBar.Panels[PanelIndex].Text); QLabel_setText(QLabelH(QtStatusBar.Panels[PanelIndex].Widget), @Str); QLabel_setAlignment(QLabelH(QtStatusBar.Panels[PanelIndex].Widget), AlignmentToQtAlignmentMap[AStatusBar.Panels[PanelIndex].Alignment]); QWidget_setMinimumWidth(QtStatusBar.Panels[PanelIndex].Widget, AStatusBar.Panels[PanelIndex].Width); + QWidget_setVisible(QtStatusBar.Panels[PanelIndex].Widget, + AStatusBar.Panels[PanelIndex].Width >= Margin); end; end; end;