Qt: simplified selection code for TQtWSCustomListBox by using Selected[] property

git-svn-id: trunk@33174 -
This commit is contained in:
zeljko 2011-10-30 12:40:34 +00:00
parent 241bbc0b79
commit ce82b57b84

View File

@ -582,14 +582,11 @@ class procedure TQtWSCustomListBox.SelectItem(const ACustomListBox: TCustomListB
AIndex: integer; ASelected: boolean); AIndex: integer; ASelected: boolean);
var var
QtListWidget: TQtListWidget; QtListWidget: TQtListWidget;
ListItem: QListWidgetItemH;
begin begin
if not WSCheckHandleAllocated(ACustomListBox, 'SelectItem') then if not WSCheckHandleAllocated(ACustomListBox, 'SelectItem') then
Exit; Exit;
QtListWidget := TQtListWidget(ACustomListBox.Handle); QtListWidget := TQtListWidget(ACustomListBox.Handle);
ListItem := QtListWidget.getItem(AIndex); QtListWidget.Selected[AIndex] := ASelected;
if ListItem <> nil then
QtListWidget.setItemSelected(ListItem, ASelected);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------