X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetAction.cpp;h=0b81abb97894c20e1e5fa882c976e7fdd8d5faec;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=3d9c616ff29a36e9b52fa4bc2e0f1fc6b083c1c5;hpb=a1cb9ff04bfb45cfd717b853512de158631e4871;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 3d9c616ff..0b81abb97 --- 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-2023 CEA, EDF +// +// 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 @@ -17,25 +31,25 @@ 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 = ModuleBase_Tools::wrapTextByWords( - QString::fromStdString(theData->widgetTooltip()), myButton, DEFAULT_TOOL_TIP_WIDTH); - 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); @@ -47,6 +61,11 @@ ModuleBase_WidgetAction::~ModuleBase_WidgetAction() { } +bool ModuleBase_WidgetAction::focusTo() +{ + return false; +} + QList ModuleBase_WidgetAction::getControls() const { QList aList;