From dd2751add94111204e924e07f6054c824f5dbecc Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 15 Feb 2018 19:17:26 +0200 Subject: [PATCH] center activities text in Layouts --- app/layoutsDelegates/activitycmbboxdelegate.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/layoutsDelegates/activitycmbboxdelegate.cpp b/app/layoutsDelegates/activitycmbboxdelegate.cpp index f437f82f7..81ba40ac7 100644 --- a/app/layoutsDelegates/activitycmbboxdelegate.cpp +++ b/app/layoutsDelegates/activitycmbboxdelegate.cpp @@ -112,7 +112,10 @@ void ActivityCmbBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem myOptions.text = ""; myOptions.widget->style()->drawControl(QStyle::CE_ItemViewItem, &myOptions, painter); - painter->translate(myOptions.rect.left(), myOptions.rect.top()); + //we need an offset to be in the same vertical center of TextEdit + int offsetY = 1 + (myOptions.rect.height() - doc.size().height()) / 2; + + painter->translate(myOptions.rect.left(), myOptions.rect.top() + offsetY); QRect clip(0, 0, myOptions.rect.width(), myOptions.rect.height()); doc.drawContents(painter, clip); } else {