Qt: fixed index out of bounds when setting item text. issue #27740

git-svn-id: trunk@48509 -
This commit is contained in:
zeljko 2015-03-26 16:02:28 +00:00
parent 31adc59c71
commit 3162d8bfd0

View File

@ -1547,7 +1547,9 @@ begin
AAlignment := AlignmentToQtAlignmentMap[ALV.Column[ASubIndex].Alignment] or QtAlignVCenter; AAlignment := AlignmentToQtAlignmentMap[ALV.Column[ASubIndex].Alignment] or QtAlignVCenter;
QtTreeWidget.setItemText(TWI, ASubIndex, Str, AAlignment); QtTreeWidget.setItemText(TWI, ASubIndex, Str, AAlignment);
{issue #27696 for autosized columns we must provide sizehint} {issue #27696 for autosized columns we must provide sizehint}
if ALV.Column[ASubIndex].AutoSize then if (TCustomListViewHack(ALV).Columns.Count > 0) and (ASubIndex >= 0) and
(ASubIndex < TCustomListViewHack(ALV).Columns.Count) and
ALV.Column[ASubIndex].AutoSize then
begin begin
if Assigned(TCustomListViewHack(ALV).SmallImages) then if Assigned(TCustomListViewHack(ALV).SmallImages) then
AIconWidth := TCustomListViewHack(ALV).SmallImages.Width AIconWidth := TCustomListViewHack(ALV).SmallImages.Width