X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2FModuleBase%2FModuleBase_WidgetAction.cpp;h=8a927868959be73ed360573a54c5cd8e0250b16e;hb=374a366d81778aa27ed32cc080c0f95bdb03f1c5;hp=2b0dd39151156044a7a95ccb990f1432fcf00e06;hpb=50aeec65965daa04bb5ef38125363c22067817f5;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetAction.cpp b/src/ModuleBase/ModuleBase_WidgetAction.cpp old mode 100755 new mode 100644 index 2b0dd3915..8a9278689 --- a/src/ModuleBase/ModuleBase_WidgetAction.cpp +++ b/src/ModuleBase/ModuleBase_WidgetAction.cpp @@ -1,11 +1,25 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: ModuleBase_WidgetAction.cpp -// Created: 15 Apr 2016 -// Author: Natalia Ermolaeva +// Copyright (C) 2014-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #include #include +#include #include @@ -13,26 +27,29 @@ #include #include +#define DEFAULT_TOOL_TIP_WIDTH 300 + ModuleBase_WidgetAction::ModuleBase_WidgetAction(QWidget* theParent, const Config_WidgetAPI* theData) -: ModuleBase_ModelWidget(theParent, theData) +: ModuleBase_ModelWidget(theParent, theData), + myActionID(attributeID()) { + setAttributeID(""); // To prevent errors. Action not stored as attribtue in feature. QHBoxLayout* aControlLay = new QHBoxLayout(this); ModuleBase_Tools::adjustMargins(aControlLay); - myActionID = attributeID(); - setAttributeID(""); - - QString aText = QString::fromStdString(theData->widgetLabel()); - QString aToolTip = QString::fromStdString(theData->widgetTooltip()); - myButton = new QToolButton(this); + QString aText = translate(theData->widgetLabel()); + QString aToolTip = ModuleBase_Tools::wrapTextByWords(translate(theData->widgetTooltip()), + myButton, + DEFAULT_TOOL_TIP_WIDTH); + myButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); aControlLay->addWidget(myButton); QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); if (!aLabelIcon.isEmpty()) - myButton->setIcon(QPixmap(aLabelIcon)); + myButton->setIcon(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); else myButton->setText(aText); myButton->setToolTip(aToolTip); @@ -44,6 +61,11 @@ ModuleBase_WidgetAction::~ModuleBase_WidgetAction() { } +bool ModuleBase_WidgetAction::focusTo() +{ + return false; +} + QList ModuleBase_WidgetAction::getControls() const { QList aList;