Salome HOME
Jenkins compilation correction.
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetToolbox.cpp
index 05759642d17c2145618181b60f6c394c82549005..3a9666b5599d5dbae7f6932403b998ea91c2d1bc 100644 (file)
@@ -1,9 +1,22 @@
-/*
- * ModuleBase_WidgetToolbox.cpp
- *
- *  Created on: Feb 27, 2015
- *      Author: sbh
- */
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
 
 #include <ModuleBase_WidgetToolbox.h>
 #include <ModuleBase_PageBase.h>
 #include <QVBoxLayout>
 #include <QIcon>
 
-ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(QWidget* theParent, const Config_WidgetAPI* theData)
+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 ModuleBase_ToolBox(this);
+
+  bool aHasContainerParent = false;
+  QWidget* aParent = dynamic_cast<QWidget*>(parent());
+  while(aParent && !aHasContainerParent) {
+    ModuleBase_PagedContainer* aPagedContainer = dynamic_cast<ModuleBase_PagedContainer*>(aParent);
+    aHasContainerParent = aPagedContainer;
+    aParent = dynamic_cast<QWidget*>(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;"
@@ -49,7 +71,6 @@ int ModuleBase_WidgetToolbox::addPage(ModuleBase_PageBase* thePage,
 {
   ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon);
   QFrame* aFrame = dynamic_cast<QFrame*>(thePage);
-  aFrame->setFrameStyle(QFrame::Box | QFrame::Raised);
   myToolBox->addItem(aFrame, theName, theIcon );
   return myToolBox->count();
 }