Salome HOME
Update copyrights
[modules/gui.git] / src / TreeData / DockWidgets.cxx
index 6a7922c03b82967e30d80479a8eda36bda76069f..67a09cf9e1f71584756af43e0b7cbf64f70a1660 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // 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.
+// 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
 #include <SUIT_DataBrowser.h>
 #include <QtxTreeView.h>
 
+namespace
+{
+  QString toObjectName( const QString& s )
+  {
+    QStringList words = s.split( QRegExp("\\s+") );
+    QStringList result;
+    if ( words.count() > 0 )
+      result.append( words[0].left(1).toLower() + words[0].mid(1) );
+    for ( int i = 1; i < words.count(); i++ )
+      result.append( words[i].left(1).toUpper() + words[i].mid(1) );
+    return result.join( "" );
+  }
+}
+
 /*!
  * This create a gui container to hold widgets dedicated to the XCAD
  * data model. By default, the dock widgets are not visible. Use the
@@ -49,6 +63,7 @@ DockWidgets::DockWidgets(SalomeApp_Application* salomeApp,
   _dwDataPanel = new QDockWidget(parent);
   _dwDataPanel->setVisible(false);
   _dwDataPanel->setWindowTitle(title);
+  _dwDataPanel->setObjectName(toObjectName(title)+"Dock");
   parent->addDockWidget(Qt::LeftDockWidgetArea, _dwDataPanel);
   //
   // At this step, the _dwDataPanel is located side by side with the object
@@ -104,3 +119,10 @@ void DockWidgets::setDataView(QTreeView * dataView) {
 void DockWidgets::setPropertiesView(QTreeView * propertiesView) {
   // Not implemented yet
 }
+
+/*!
+ * This function returns dock widget
+ */
+QDockWidget * DockWidgets::getDockWidget() {
+  return _dwDataPanel;
+}