[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - vcl/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 4 21:17:40 UTC 2020


 vcl/source/control/button.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit a1f07a57e548763c6afd546938caa131a2a22427
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Jan 29 16:41:02 2020 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Feb 4 22:17:05 2020 +0100

    Place button text in tooltip if it doesn't fit into the button
    
    Seen this happening in custom sidebars (from extensions).
    When the text is too long for the button, it will get cut off
    and there is no way to view the button text.
    
    Change-Id: I86ce72154e0371bdf24480be41517855dc3ce050
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87692
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit dabb6176407067ef8d46bdde863b087457805c6a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87948
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 53eaa3ff6b0c..7d235e6bd4c8 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -216,6 +216,11 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
     else if (bDrawText && !bDrawImage && !bHasSymbol)
     {
         aOutRect = DrawControlText(*pDev, aOutRect, aText, nTextStyle, nullptr, nullptr);
+        tools::Rectangle textRect = GetTextRect(
+            tools::Rectangle(Point(), Size(0x7fffffff, 0x7fffffff)), aText, nTextStyle);
+        // If the button text doesn't fit into it, put it into a tooltip (might happen in sidebar)
+        if (GetQuickHelpText().isEmpty() && textRect.getWidth() > rSize.getWidth())
+            SetQuickHelpText(aText);
 
         ImplSetFocusRect(aOutRect);
         rSize = aOutRect.GetSize();


More information about the Libreoffice-commits mailing list