Fix misaligned icons in wxTreeCtrl for wxQt

Center the items vertically, as this looks much better, and is also more
consistent with the appearance in the generic version, which was
previously used.

Closes https://github.com/wxWidgets/wxWidgets/pull/1378
This commit is contained in:
Graham Dawes
2019-07-01 10:13:12 +01:00
committed by Vadim Zeitlin
parent 81c31c6094
commit 25c9bf9664

View File

@@ -222,7 +222,8 @@ protected:
const wxImageList *imageList = GetHandler()->GetImageList();
const wxBitmap bitmap = imageList->GetBitmap(imageIndex);
const QRect rect = visualRect(index);
painter->drawPixmap(rect.topLeft(), *bitmap.GetHandle());
const int offset = (rect.height() / 2) - (bitmap.GetHeight() / 2);
painter->drawPixmap(rect.topLeft() + QPoint(0,offset), *bitmap.GetHandle());
}
}