summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorIlhan Yesil <ilhanyesil@gmx.de>2020-12-14 17:39:55 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-04-19 12:46:33 +0200
commitf1d9648b5196eacac080a2a4db42c06829554107 (patch)
treea89a5b4ed061cc8ae6873c16113eedfed3a90392 /vcl
parentc7428c607c021f361973f0b1fd9e0dcaf45fa932 (diff)
tdf#138901 Refresh button tooltip in sidebar created by extension
The button's tooltip is refreshed after setting the button's text. Change-Id: I08f272c43c3312d462981d46ab961ef925eeccbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107718 Tested-by: Jenkins Reviewed-by: Ilhan Yesil <ilhanyesil@gmx.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/button.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index f26561cf0890..08ede8f8afbd 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -79,6 +79,7 @@ public:
tools::Long mnSeparatorX;
DrawButtonFlags mnButtonState;
bool mbSmallSymbol;
+ bool mbGeneratedTooltip;
Image maImage;
ImageAlign meImageAlign;
@@ -91,7 +92,7 @@ public:
};
ImplCommonButtonData::ImplCommonButtonData() : maFocusRect(), mnSeparatorX(0), mnButtonState(DrawButtonFlags::NONE),
-mbSmallSymbol(false), maImage(), meImageAlign(ImageAlign::Top), meSymbolAlign(SymbolAlign::LEFT), maCustomContentImage()
+mbSmallSymbol(false), mbGeneratedTooltip(false), maImage(), meImageAlign(ImageAlign::Top), meSymbolAlign(SymbolAlign::LEFT), maCustomContentImage()
{
}
@@ -237,8 +238,13 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
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()!= aText && mpButtonData->mbGeneratedTooltip)
+ SetQuickHelpText("");
if (GetQuickHelpText().isEmpty() && textRect.getWidth() > rSize.getWidth())
+ {
SetQuickHelpText(aText);
+ mpButtonData->mbGeneratedTooltip = true;
+ }
ImplSetFocusRect(aOutRect);
rSize = aOutRect.GetSize();