]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Emulate tree node from Label above Tree view (issue #23)
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 19 May 2014 07:27:00 +0000 (11:27 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 19 May 2014 07:27:00 +0000 (11:27 +0400)
src/XGUI/XGUI_ObjectsBrowser.cpp

index cf0e8577d5556843d6b32295085e96cbc24c443b..8850213f7b14fede5cfe62c3cd049d4a37d40297 100644 (file)
@@ -81,21 +81,27 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
   aLayout->setContentsMargins(0, 0, 0, 0);
   aLayout->setSpacing(0);
 
-  QWidget* aLabelWgt = new QWidget(this);
+  QFrame* aLabelWgt = new QFrame(this);
+  aLabelWgt->setAutoFillBackground(true);
+  QPalette aPalet = aLabelWgt->palette();
+  aPalet.setColor(QPalette::Window, Qt::white);
+  aLabelWgt->setPalette(aPalet);
+
   aLayout->addWidget(aLabelWgt);
   QHBoxLayout* aLabelLay = new QHBoxLayout(aLabelWgt);
-  aLabelLay->setContentsMargins(3, 3, 3, 3);
+  aLabelLay->setContentsMargins(0, 0, 0, 0);
+  aLabelLay->setSpacing(0);
 
   QLabel* aLbl = new QLabel(aLabelWgt);
   aLbl->setPixmap(QPixmap(":pictures/assembly.png"));
-  aLabelLay->addWidget(aLbl);
+  aLbl->setMargin(2);
 
-  myActiveDocLbl = new QLabel("", aLabelWgt);
-  myActiveDocLbl->setAlignment(Qt::AlignHCenter);
+  aLbl->setAutoFillBackground(true);
 
-  QFont aFnt = myActiveDocLbl->font();
-  aFnt.setBold(true);
-  myActiveDocLbl->setFont(aFnt);
+  aLabelLay->addWidget(aLbl);
+
+  myActiveDocLbl = new QLabel(tr("Part set"), aLabelWgt);
+  myActiveDocLbl->setMargin(2);
 
   myActiveDocLbl->installEventFilter(this);
 
@@ -107,6 +113,9 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
 
   myDocModel = myTreeView->dataModel();
 
+  aLabelWgt->setFrameShape(myTreeView->frameShape());
+  aLabelWgt->setFrameShadow(myTreeView->frameShadow());
+
   connect(myTreeView, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
   connect(myTreeView, SIGNAL(activePartChanged(FeaturePtr)), this, SLOT(onActivePartChanged(FeaturePtr)));
   connect(myTreeView, SIGNAL(activePartChanged(FeaturePtr)), this, SIGNAL(activePartChanged(FeaturePtr)));
@@ -126,11 +135,11 @@ void XGUI_ObjectsBrowser::onActivePartChanged(FeaturePtr thePart)
 {
   QPalette aPalet = myActiveDocLbl->palette();
   if (thePart) {
-    myActiveDocLbl->setText(tr("Activate Part set"));
+    //myActiveDocLbl->setText(tr("Activate Part set"));
     aPalet.setColor(QPalette::Foreground, Qt::black);
     myActiveDocLbl->setCursor(Qt::PointingHandCursor);
   }  else {
-    myActiveDocLbl->setText(tr("Part set is active"));
+    //myActiveDocLbl->setText(tr("Part set is active"));
     aPalet.setColor(QPalette::Foreground, QColor(0, 72, 140));
     myActiveDocLbl->unsetCursor();
   }