diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index f310fd85a8..36cce8cda2 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -7403,13 +7403,13 @@ begin {first must get contents rect - all except main menu} QWidget_contentsRect(FCentralWidget, @R); {TODO: find better way to find out which controls are top,left,right & bottom aligned ...} - for i := 0 to LCLObject.ComponentCount - 1 do + for i := 0 to LCLObject.ControlCount - 1 do begin - if (LCLObject.Components[i] is TWinControl) and - (TWinControl(LCLObject.Components[i]).Align in [alTop, alLeft, alRight, alBottom]) then + if (LCLObject.Controls[i] is TWinControl) and + (TWinControl(LCLObject.Controls[i]).Align in [alTop, alLeft, alRight, alBottom]) then begin - R2 := TWinControl(LCLObject.Components[i]).BoundsRect; - case TWinControl(LCLObject.Components[i]).Align of + R2 := TWinControl(LCLObject.Controls[i]).BoundsRect; + case TWinControl(LCLObject.Controls[i]).Align of alLeft: R.Left := R.Left + (R2.Right - R2.Left); alTop: R.Top := R.Top + (R2.Bottom - R2.Top); alRight: R.Right := R.Right - (R2.Right - R2.Left); diff --git a/lcl/interfaces/qt/qtwsstdctrls.pp b/lcl/interfaces/qt/qtwsstdctrls.pp index ecde8e529f..0f9fd5e1e7 100644 --- a/lcl/interfaces/qt/qtwsstdctrls.pp +++ b/lcl/interfaces/qt/qtwsstdctrls.pp @@ -366,15 +366,20 @@ begin QtScrollBar.BeginUpdate; try if (QtScrollBar.getMin <> AScrollBar.Min) or - (QtScrollBar.getMax <> AScrollbar.Max) then - QtScrollBar.setRange(AScrollBar.Min, AScrollBar.Max); + (QtScrollBar.getMax <> (AScrollbar.Max - AScrollBar.PageSize)) then + QtScrollBar.setRange(AScrollBar.Min, AScrollBar.Max - AScrollBar.PageSize); if QtScrollBar.getPageStep <> AScrollBar.PageSize then begin QtScrollBar.setPageStep(AScrollBar.PageSize); QtScrollBar.setSingleStep((AScrollBar.PageSize div 6) + 1); end; if QtScrollbar.getValue <> AScrollBar.Position then - QtScrollBar.setValue(AScrollBar.Position); + begin + if AScrollBar.Position > QtScrollBar.getMax then + QtScrollBar.setValue(QtScrollBar.getMax) + else + QtScrollBar.setValue(AScrollBar.Position); + end; case AScrollBar.Kind of sbHorizontal: