X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetToolbox.cpp;h=aca5ec4b6d124c992db99d858b2abffec153b0cf;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=6a16aa3d2647d6d4057e6352971f686ad02e1a06;hpb=ec6aaa4d8bd3609b04ea85683e1b1175b6632238;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetToolbox.cpp b/src/ModuleBase/ModuleBase_WidgetToolbox.cpp index 6a16aa3d2..aca5ec4b6 100644 --- a/src/ModuleBase/ModuleBase_WidgetToolbox.cpp +++ b/src/ModuleBase/ModuleBase_WidgetToolbox.cpp @@ -1,29 +1,52 @@ -/* - * ModuleBase_WidgetToolbox.cpp - * - * Created on: Feb 27, 2015 - * Author: sbh - */ +// 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 +#include #include #include #include #include +#include -ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(QWidget* theParent, const Config_WidgetAPI* theData, - const std::string& theParentId) -: ModuleBase_PagedContainer(theParent, theData, theParentId) +ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(QWidget* theParent, + const Config_WidgetAPI* theData) +: ModuleBase_PagedContainer(theParent, theData) { QVBoxLayout* aMainLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aMainLayout); - myToolBox = new QToolBox(this); + + bool aHasContainerParent = false; + QWidget* aParent = dynamic_cast(parent()); + while(aParent && !aHasContainerParent) { + ModuleBase_PagedContainer* aPagedContainer = dynamic_cast(aParent); + aHasContainerParent = aPagedContainer; + aParent = dynamic_cast(aParent->parent()); + } + myToolBox = new ModuleBase_ToolBox(this, aHasContainerParent); // Dark-grey rounded tabs with button-like border #and bold font + // TODO: apply style to custom widget QString css = "QToolBox::tab{background-color:#c8c8c8;" "border-radius:5px;" "border:1px inset;" @@ -41,13 +64,14 @@ ModuleBase_WidgetToolbox::~ModuleBase_WidgetToolbox() } int ModuleBase_WidgetToolbox::addPage(ModuleBase_PageBase* thePage, - const QString& theName, const QString& theCaseId) + const QString& theName, + const QString& theCaseId, + const QPixmap& theIcon, + const QString& theTooltip) { - ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId); + ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip); QFrame* aFrame = dynamic_cast(thePage); - aFrame->setFrameShape(QFrame::Box); - aFrame->setFrameStyle(QFrame::Sunken); - myToolBox->addItem(aFrame, theName); + myToolBox->addItem(aFrame, translate(theName.toStdString()), theIcon ); return myToolBox->count(); }