]> git.lyx.org Git - features.git/commitdiff
Fix drawing of buttonText (enforce same left/right spacing)
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 23 May 2016 13:24:13 +0000 (15:24 +0200)
committerRichard Heck <rgheck@lyx.org>
Sun, 29 May 2016 21:55:46 +0000 (17:55 -0400)
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.

src/frontends/qt4/GuiPainter.cpp

index 495a11a8a6f036892bb9d088364bb06e228e0583..5329624a6a1b6f2605f0713fa1c6bbcf10e6cb1e 100644 (file)
@@ -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);
 }