From 4ef1b08ee8732bce35c11db71379bda47ebd2e8c Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 26 Nov 2016 11:22:35 +0100 Subject: [PATCH] attempt to fix emoticons sizes on high DPI screens --- retroshare-gui/src/gui/common/Emoticons.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/common/Emoticons.cpp b/retroshare-gui/src/gui/common/Emoticons.cpp index 9ea2445a8..c070edfe7 100644 --- a/retroshare-gui/src/gui/common/Emoticons.cpp +++ b/retroshare-gui/src/gui/common/Emoticons.cpp @@ -164,8 +164,8 @@ void Emoticons::showSmileyWidget(QWidget *parent, QWidget *button, const char *s smGLayout->addWidget(smTab); } - const int buttonWidth = QFontMetricsF(smWidget->font()).height()*2; - const int buttonHeight = QFontMetricsF(smWidget->font()).height()*2; + const int buttonWidth = QFontMetricsF(smWidget->font()).height()*1.2; + const int buttonHeight = QFontMetricsF(smWidget->font()).height()*1.2; int maxRowCount = 0; int maxCountPerLine = 0; @@ -179,7 +179,12 @@ void Emoticons::showSmileyWidget(QWidget *parent, QWidget *button, const char *s if (! bOnlyOneGroup) { tabGrpWidget = new QWidget(smTab); - smTab->setIconSize(QSize(24,24)); + + // (Cyril) Never use an absolute size. It needs to be scaled to the actual font size on the screen. + // + QFontMetricsF fm(parent->font()) ; + smTab->setIconSize(QSize(32*fm.height()/14.0,32*fm.height()/14.0)); + if (groupName.right(4).toLower() == ".png") smTab->addTab( tabGrpWidget, QIcon(groupName), ""); else