From: nds Date: Fri, 15 Apr 2016 12:30:00 +0000 (+0300) Subject: Wrap tool tip text by word in Widget action X-Git-Tag: V_2.3.0~213 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a1cb9ff04bfb45cfd717b853512de158631e4871;p=modules%2Fshaper.git Wrap tool tip text by word in Widget action --- 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);