Salome HOME
Wrap tool tip text by word in Widget action
authornds <nds@opencascade.com>
Fri, 15 Apr 2016 12:30:00 +0000 (15:30 +0300)
committernds <nds@opencascade.com>
Fri, 15 Apr 2016 12:30:00 +0000 (15:30 +0300)
src/ModuleBase/ModuleBase_Tools.h
src/ModuleBase/ModuleBase_WidgetAction.cpp

index 938b30e5c18d8bb90b577ad23d8b7a0b8de90e30..6aff1f90f55e9f2bbd3b62a5df056a3fcd69d6fb 100755 (executable)
@@ -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);
 }
 
index f63455d18824431da9640463496ae2211e7239f9..3d9c616ff29a36e9b52fa4bc2e0f1fc6b083c1c5 100755 (executable)
@@ -13,6 +13,8 @@
 #include <QHBoxLayout>
 #include <QToolButton>
 
+#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);