From 25c9bf96647bec3ba01a84f5ee96f47785d58465 Mon Sep 17 00:00:00 2001 From: Graham Dawes Date: Mon, 1 Jul 2019 10:13:12 +0100 Subject: [PATCH] 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 --- src/qt/treectrl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qt/treectrl.cpp b/src/qt/treectrl.cpp index 27c17b5c15..b21b0e8e03 100644 --- a/src/qt/treectrl.cpp +++ b/src/qt/treectrl.cpp @@ -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()); } }