From: Jean-Marc Lasgouttes Date: Mon, 23 May 2016 13:24:13 +0000 (+0200) Subject: Fix drawing of buttonText (enforce same left/right spacing) X-Git-Tag: 2.3.0alpha1~1643^2~5 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=516d5d29dce28deab4601ec6aa714ca7ff59e6cd;p=features.git Fix drawing of buttonText (enforce same left/right spacing) The computation of the width of the button was wrong. If <--> stands for TEXT_TO_INSET_OFFSET/2 spacing, and if `[]' marks the button's limits, then the intent is <-->[<-->button text<-->]<--> Therefore the physical grey rectangle width is width - Inset::TEXT_TO_INSET_OFFSET With this change, the spacing on the right of the button is not larger than the left one. Fixes bug #10147. --- diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index 495a11a8a6..5329624a6a 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -579,7 +579,7 @@ void GuiPainter::buttonText(int x, int y, docstring const & str, static int const d = Inset::TEXT_TO_INSET_OFFSET / 2; - button(x + d, y - ascent, width - d, descent + ascent, mouseHover); + button(x + d, y - ascent, width - Inset::TEXT_TO_INSET_OFFSET, descent + ascent, mouseHover); text(x + Inset::TEXT_TO_INSET_OFFSET, y, str, font); }