Qt5,Qt6: fixed TListBox.TopIndex. issue #41688

This commit is contained in:
zeljan1 2025-06-03 18:09:30 +02:00
parent cf1d97517f
commit 478688e0f1
2 changed files with 18 additions and 0 deletions

View File

@ -580,8 +580,17 @@ end;
Returns: Nothing
------------------------------------------------------------------------------}
class function TQtWSCustomListBox.GetTopIndex(const ACustomListBox: TCustomListBox): integer;
var
QtListWidget: TQtListWidget;
AQtPoint: TQtPoint;
begin
Result := 0;
if not WSCheckHandleAllocated(ACustomListBox, 'GetTopIndex') then
Exit;
QtListWidget := TQtListWidget(ACustomListBox.Handle);
AQtPoint.x := 0;
AQtPoint.y := 0;
Result := QtListWidget.IndexAt(@AQtPoint);
end;
{------------------------------------------------------------------------------

View File

@ -580,8 +580,17 @@ end;
Returns: Nothing
------------------------------------------------------------------------------}
class function TQtWSCustomListBox.GetTopIndex(const ACustomListBox: TCustomListBox): integer;
var
QtListWidget: TQtListWidget;
AQtPoint: TQtPoint;
begin
Result := 0;
if not WSCheckHandleAllocated(ACustomListBox, 'GetTopIndex') then
Exit;
QtListWidget := TQtListWidget(ACustomListBox.Handle);
AQtPoint.x := 0;
AQtPoint.y := 0;
Result := QtListWidget.IndexAt(@AQtPoint);
end;
{------------------------------------------------------------------------------