]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2556: Change Layout of Inspection panel.
authorvsv <vsv@opencascade.com>
Thu, 13 Sep 2018 16:20:24 +0000 (19:20 +0300)
committervsv <vsv@opencascade.com>
Thu, 13 Sep 2018 16:20:24 +0000 (19:20 +0300)
src/XGUI/XGUI_InspectionPanel.cpp
src/XGUI/XGUI_InspectionPanel.h
src/XGUI/XGUI_Workshop.cpp

index 545c2fc9f491c5360ce660424ed88b0af3dc5f17..e96acd39ad945b5ee3f9678288847b57baa39dcc 100644 (file)
@@ -53,6 +53,7 @@
 #include <QHeaderView>
 #include <QTextBrowser>
 #include <QResizeEvent>
+#include <QSplitter>
 
 #include <BRepBndLib.hxx>
 #include <TopoDS_Iterator.hxx>
@@ -115,27 +116,21 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr
   setObjectName(INSPECTION_PANEL);
   setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
 
-  QScrollArea* aScrollArea = new QScrollArea(this);
-  setWidget(aScrollArea);
+  QSplitter* aSplitter = new QSplitter(Qt::Vertical, this);
 
   // Create an internal widget
-  myMainWidget = new QWidget(aScrollArea);
-
-  myMainLayout = new QVBoxLayout(myMainWidget);
-  myMainLayout->setContentsMargins(5, 5, 5, 5);
-
-  QWidget* aNameWgt = new QWidget(myMainWidget);
+  QWidget* aNameWgt = new QWidget(aSplitter);
   QHBoxLayout* aNameLayout = new QHBoxLayout(aNameWgt);
-  aNameLayout->setContentsMargins(0, 0, 0, 0);
+  aNameLayout->setContentsMargins(3, 0, 3, 0);
   aNameLayout->addWidget(new QLabel(tr("Object"), aNameWgt));
   myNameEdt = new QLineEdit(aNameWgt);
   myNameEdt->setReadOnly(true);
   aNameLayout->addWidget(myNameEdt);
 
-  myMainLayout->addWidget(aNameWgt);
+  aSplitter->addWidget(aNameWgt);
 
   // Table with sub-shapes
-  mySubShapesTab = new QTableWidget(9, 2, myMainWidget);
+  mySubShapesTab = new QTableWidget(9, 2, aSplitter);
   mySubShapesTab->setFocusPolicy(Qt::NoFocus);
   mySubShapesTab->verticalHeader()->hide();
   QStringList aTitles;
@@ -160,32 +155,41 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr
   mySubShapesTab->setColumnWidth(0, 90);
   mySubShapesTab->setColumnWidth(1, 70);
 
-  mySubShapesTab->setMaximumWidth(170);
-  mySubShapesTab->setMinimumHeight(300);
+  //mySubShapesTab->setMaximumWidth(170);
+  //mySubShapesTab->setMinimumHeight(300);
 
-  myMainLayout->addWidget(mySubShapesTab);
+  aSplitter->addWidget(mySubShapesTab);
 
   // Type of object
-  QWidget* aTypeWgt = new QWidget(myMainWidget);
+  QWidget* aTypeWgt = new QWidget(aSplitter);
   QHBoxLayout* aTypeLayout = new QHBoxLayout(aTypeWgt);
-  aTypeLayout->setContentsMargins(0, 0, 0, 0);
+  aTypeLayout->setContentsMargins(3, 0, 3, 0);
 
   aTypeLayout->addWidget(new QLabel(tr("Type:"), aTypeWgt));
   myTypeLbl = new QLabel("", aTypeWgt);
   aTypeLayout->addWidget(myTypeLbl);
 
-  myMainLayout->addWidget(aTypeWgt);
+  aSplitter->addWidget(aTypeWgt);
 
-  myTypeParams = new QTextBrowser(myMainWidget);
+  myTypeParams = new QTextBrowser(aSplitter);
   myTypeParams->setFixedWidth(170);
   myTypeParams->setReadOnly(true);
   myTypeParams->setFocusPolicy(Qt::NoFocus);
   myTypeParams->setFrameStyle(QFrame::NoFrame);
   myTypeParams->viewport()->setBackgroundRole(QPalette::Window);
 
-  myMainLayout->addWidget(myTypeParams, 1);
+  aSplitter->addWidget(myTypeParams);
+
+  aSplitter->setCollapsible(0, false);
+  aSplitter->setCollapsible(1, false);
+  aSplitter->setCollapsible(2, false);
+  aSplitter->setCollapsible(3, false);
+
+  QList<int> aSizes;
+  aSizes << 10 << 140 << 10;
+  aSplitter->setSizes(aSizes);
 
-  aScrollArea->setWidget(myMainWidget);
+  setWidget(aSplitter);
 
   connect(mySelectionMgr, SIGNAL(selectionChanged()), SLOT(onSelectionChanged()));
 }
@@ -698,13 +702,3 @@ void XGUI_InspectionPanel::setParamsText(const QString& theText)
 {
   myTypeParams->setText(theText);
 }
-
-void XGUI_InspectionPanel::resizeEvent(QResizeEvent* theEvent)
-{
-  QSize aSize = theEvent->size();
-
-  int aHeight = aSize.height();
-
-  if (aHeight > 450) // 450 is a a minimal height
-    myMainWidget->setFixedHeight(aHeight - 30);
-}
\ No newline at end of file
index 552ce7774e399a2a934aa9e55477afe6307f9644..e8a6f7ba6f38ead416353a2f654ce1e2e514d343 100644 (file)
@@ -85,12 +85,6 @@ public:
   virtual ~XGUI_InspectionPanel();
 
 
-protected:
-  /// Vitrual method is redefined in order to adjust size of internal wirdet to size of
-  /// the whole whindow
-  /// \param theEvent an event with resize parameters
-  virtual void resizeEvent(QResizeEvent* theEvent);
-
 private slots:
   /// A slot to react on selection changed
   void onSelectionChanged();
@@ -192,7 +186,7 @@ private:
   QLabel* myTypeLbl; //> label of a type
   QTextBrowser* myTypeParams; //> parameters area
   QVBoxLayout* myMainLayout; //> main layout
-  QWidget* myMainWidget;  //> main widget
+  //QWidget* myMainWidget;  //> main widget
 };
 
 #endif
\ No newline at end of file
index 82495a49f2001c081a6ccb50ce22db858b0293b8..907270967f0c51916dcaff3b39655251081a5afb 100755 (executable)
@@ -1423,6 +1423,8 @@ void XGUI_Workshop::createDockWidgets()
     Qt::RightDockWidgetArea);
   aDesktop->addDockWidget(Qt::RightDockWidgetArea, myInspectionPanel);
 
+  myInspectionPanel->hide();
+
   aDesktop->addDockWidget(
 #ifdef HAVE_SALOME
     Qt::RightDockWidgetArea,