From 0430132aa049f2a97280bcbcff69f71d42ed7d98 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Sun, 13 Mar 2016 01:51:15 +0100 Subject: [PATCH] Circumvent odd stmary font metrics (part of #9990). The stmary font has an unusual large descent that was causing a large gap between lines in the math delimiter dialog because of the \llbracket and \rrbracket delimiters. The solution is to force Qt using the same size for all elements of the QlistWidget widget instead of letting it compute the size of each element. --- src/frontends/qt4/GuiDelimiter.cpp | 8 +++++++- src/frontends/qt4/ui/DelimiterUi.ui | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/frontends/qt4/GuiDelimiter.cpp b/src/frontends/qt4/GuiDelimiter.cpp index 31903fc8b4..2ae6def688 100644 --- a/src/frontends/qt4/GuiDelimiter.cpp +++ b/src/frontends/qt4/GuiDelimiter.cpp @@ -181,6 +181,11 @@ GuiDelimiter::GuiDelimiter(GuiView & lv) initMathSymbols(); + FontInfo lyxfont; + lyxfont.setFamily(CMR_FAMILY); + QFontMetrics fm(frontend::getFont(lyxfont)); + QSize item_size(fm.maxWidth(), fm.height() + 8); + typedef map ListItems; ListItems list_items; // The last element is the empty one. @@ -191,11 +196,12 @@ GuiDelimiter::GuiDelimiter(GuiView & lv) QString symbol(ms.fontcode? QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode))); QListWidgetItem * lwi = new QListWidgetItem(symbol); - FontInfo lyxfont; lyxfont.setFamily(ms.fontfamily); QFont font = frontend::getFont(lyxfont); lwi->setFont(font); lwi->setToolTip(toqstr(delim)); + lwi->setSizeHint(item_size); + lwi->setTextAlignment(Qt::AlignTop); list_items[ms.unicode] = lwi; leftLW->addItem(lwi); } diff --git a/src/frontends/qt4/ui/DelimiterUi.ui b/src/frontends/qt4/ui/DelimiterUi.ui index 0044d13bb1..21c6ad1299 100644 --- a/src/frontends/qt4/ui/DelimiterUi.ui +++ b/src/frontends/qt4/ui/DelimiterUi.ui @@ -84,7 +84,7 @@ QListView::Adjust - 0 + 2 -1 @@ -123,7 +123,7 @@ QListView::Adjust - 0 + 2