From ba6d8fa77d7a43378970794d25282ad44e9b462d Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 7 Apr 2024 09:58:30 +0800 Subject: [PATCH] reduce icon size in completion popup --- RedPandaIDE/widgets/codecompletionpopup.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RedPandaIDE/widgets/codecompletionpopup.cpp b/RedPandaIDE/widgets/codecompletionpopup.cpp index aa945181..7f964aab 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.cpp +++ b/RedPandaIDE/widgets/codecompletionpopup.cpp @@ -1344,7 +1344,9 @@ void CodeCompletionListItemDelegate::paint(QPainter *painter, const QStyleOption if (option.state & QStyle::State_Selected) { painter->fillRect(option.rect, mCurrentSelectionColor); } - QPixmap icon = mModel->statementIcon(index, QFontMetrics(font()).height()); + QFontMetrics fm{font()}; + int iconSize = fm.ascent(); + QPixmap icon = mModel->statementIcon(index, iconSize); int x=option.rect.left(); if (!icon.isNull()) { qreal dpr=icon.devicePixelRatioF();