From a1cb9ff04bfb45cfd717b853512de158631e4871 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 15 Apr 2016 15:30:00 +0300 Subject: [PATCH] Wrap tool tip text by word in Widget action --- src/ModuleBase/ModuleBase_Tools.h | 2 +- src/ModuleBase/ModuleBase_WidgetAction.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index 938b30e5c..6aff1f90f 100755 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -211,7 +211,7 @@ MODULEBASE_EXPORT void blockUpdateViewer(const bool theValue); /// \param theValue a boolean value /// \param theWidget a widget to know the font /// \param theMaxLineInPixels a maximum line width in pixels -MODULEBASE_EXPORT QString wrapToolTipByWords(const QString& theValue, QWidget* theWidget, +MODULEBASE_EXPORT QString wrapTextByWords(const QString& theValue, QWidget* theWidget, int theMaxLineInPixels = 150); } diff --git a/src/ModuleBase/ModuleBase_WidgetAction.cpp b/src/ModuleBase/ModuleBase_WidgetAction.cpp index f63455d18..3d9c616ff 100755 --- a/src/ModuleBase/ModuleBase_WidgetAction.cpp +++ b/src/ModuleBase/ModuleBase_WidgetAction.cpp @@ -13,6 +13,8 @@ #include #include +#define DEFAULT_TOOL_TIP_WIDTH 300 + ModuleBase_WidgetAction::ModuleBase_WidgetAction(QWidget* theParent, const Config_WidgetAPI* theData) : ModuleBase_ModelWidget(theParent, theData) @@ -24,8 +26,8 @@ ModuleBase_WidgetAction::ModuleBase_WidgetAction(QWidget* theParent, setAttributeID(""); QString aText = QString::fromStdString(theData->widgetLabel()); - QString aToolTip = ModuleBase_Tools::wrapToolTipByWords( - QString::fromStdString(theData->widgetTooltip()), myButton); + QString aToolTip = ModuleBase_Tools::wrapTextByWords( + QString::fromStdString(theData->widgetTooltip()), myButton, DEFAULT_TOOL_TIP_WIDTH); myButton = new QToolButton(this); myButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); -- 2.39.2