+void XGUI_DataTree::mouseDoubleClickEvent(QMouseEvent* theEvent)
+{
+ if (theEvent->button() == Qt::LeftButton) {
+ QModelIndex aIndex = currentIndex();
+ XGUI_DocumentDataModel* aModel = dataModel();
+
+ if ((aModel->activePartIndex() != aIndex) && aModel->activePartIndex().isValid()) {
+ setExpanded(aModel->activePartIndex(), false);
+ }
+ bool isChanged = aModel->activatedIndex(aIndex);
+ QTreeView::mouseDoubleClickEvent(theEvent);
+ if (isChanged) {
+ if (aModel->activePartIndex().isValid())
+ setExpanded(aIndex, true);
+ emit activePartChanged(aModel->activePart());
+ }
+ } else
+ QTreeView::mouseDoubleClickEvent(theEvent);
+}
+
+void XGUI_DataTree::contextMenuEvent(QContextMenuEvent* theEvent)
+{
+ emit contextMenuRequested(theEvent);
+}
+
+//********************************************************************
+//********************************************************************
+//********************************************************************
+XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
+ : QWidget(theParent)
+{
+ QVBoxLayout* aLayout = new QVBoxLayout(this);
+ aLayout->setContentsMargins(0, 0, 0, 0);
+ aLayout->setSpacing(0);
+
+ 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(0, 0, 0, 0);
+ aLabelLay->setSpacing(0);
+
+ QLabel* aLbl = new QLabel(aLabelWgt);
+ aLbl->setPixmap(QPixmap(":pictures/assembly.png"));
+ aLbl->setMargin(2);
+
+ aLbl->setAutoFillBackground(true);
+
+ aLabelLay->addWidget(aLbl);
+
+ myActiveDocLbl = new QLabel(tr("Part set"), aLabelWgt);
+ myActiveDocLbl->setMargin(2);
+ myActiveDocLbl->setContextMenuPolicy(Qt::CustomContextMenu);
+
+ myActiveDocLbl->installEventFilter(this);
+
+ aLabelLay->addWidget(myActiveDocLbl);
+ aLabelLay->setStretch(1,1);
+
+ myTreeView = new XGUI_DataTree(this);
+ aLayout->addWidget(myTreeView);
+
+ 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)));
+
+ connect(myActiveDocLbl, SIGNAL(customContextMenuRequested(const QPoint&)),
+ this, SLOT(onLabelContextMenuRequested(const QPoint&)));
+ connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*)),
+ this, SLOT(onContextMenuRequested(QContextMenuEvent*)));
+
+ onActivePartChanged(FeaturePtr());
+}
+
+
+XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser()
+{
+}
+
+
+void XGUI_ObjectsBrowser::onActivePartChanged(FeaturePtr thePart)