From: vsv Date: Thu, 13 Sep 2018 16:20:24 +0000 (+0300) Subject: Issue #2556: Change Layout of Inspection panel. X-Git-Tag: V9_2_0a1~37 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5c5547dac7feec007bc8804398cfc3111642b225;p=modules%2Fshaper.git Issue #2556: Change Layout of Inspection panel. --- diff --git a/src/XGUI/XGUI_InspectionPanel.cpp b/src/XGUI/XGUI_InspectionPanel.cpp index 545c2fc9f..e96acd39a 100644 --- a/src/XGUI/XGUI_InspectionPanel.cpp +++ b/src/XGUI/XGUI_InspectionPanel.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -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 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 diff --git a/src/XGUI/XGUI_InspectionPanel.h b/src/XGUI/XGUI_InspectionPanel.h index 552ce7774..e8a6f7ba6 100644 --- a/src/XGUI/XGUI_InspectionPanel.h +++ b/src/XGUI/XGUI_InspectionPanel.h @@ -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 diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 82495a49f..907270967 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1423,6 +1423,8 @@ void XGUI_Workshop::createDockWidgets() Qt::RightDockWidgetArea); aDesktop->addDockWidget(Qt::RightDockWidgetArea, myInspectionPanel); + myInspectionPanel->hide(); + aDesktop->addDockWidget( #ifdef HAVE_SALOME Qt::RightDockWidgetArea,