1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "XGUI_ObjectsBrowser.h"
21 #include "XGUI_Tools.h"
22 #include "XGUI_DataModel.h"
24 #include <ModelAPI_Data.h>
25 #include <ModelAPI_Session.h>
26 #include <ModelAPI_Document.h>
27 #include <ModelAPI_Tools.h>
28 #include <ModelAPI_ResultField.h>
30 #include <ModuleBase_Tools.h>
31 #include <ModuleBase_ITreeNode.h>
33 #include <XGUI_Workshop.h>
34 #include <XGUI_Displayer.h>
40 #include <QMouseEvent>
42 #include <QStyledItemDelegate>
43 #include <QMessageBox>
44 #include <QApplication>
50 /// Width of second column (minimum acceptable = 27)
51 #define FIRST_COL_WIDTH 20
52 #define SECOND_COL_WIDTH 30
56 * Tree item delegate for definition of data in column items editor
58 class XGUI_TreeViewItemDelegate: public QStyledItemDelegate
62 /// \param theParent a parent of the delegate
63 XGUI_TreeViewItemDelegate(XGUI_DataTree* theParent):QStyledItemDelegate(theParent),
64 myTreedView(theParent) {}
66 /// Set data for item editor (name of the item)
67 /// \param editor a widget of editor
68 /// \param index the tree item index
69 virtual void setEditorData ( QWidget* editor, const QModelIndex& index ) const
71 QLineEdit* aEditor = dynamic_cast<QLineEdit*>(editor);
73 XGUI_DataModel* aModel = myTreedView->dataModel();
74 ObjectPtr aObj = aModel->object(index);
75 if (aObj.get() != NULL) {
76 aEditor->setText(aObj->data()->name().c_str());
80 QStyledItemDelegate::setEditorData(editor, index);
84 XGUI_DataTree* myTreedView;
88 XGUI_DataTree::XGUI_DataTree(QWidget* theParent)
89 : QTreeView(theParent)
91 setHeaderHidden(true);
93 setEditTriggers(QAbstractItemView::NoEditTriggers);
94 setSelectionBehavior(QAbstractItemView::SelectRows);
95 setSelectionMode(QAbstractItemView::ExtendedSelection);
97 setItemDelegateForColumn(1, new XGUI_TreeViewItemDelegate(this));
99 connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
100 SLOT(onDoubleClick(const QModelIndex&)));
103 XGUI_DataTree::~XGUI_DataTree()
107 XGUI_DataModel* XGUI_DataTree::dataModel() const
109 return static_cast<XGUI_DataModel*>(model());
112 void XGUI_DataTree::contextMenuEvent(QContextMenuEvent* theEvent)
114 emit contextMenuRequested(theEvent);
117 void XGUI_DataTree::commitData(QWidget* theEditor)
119 static int aEntrance = 0;
120 if (aEntrance == 0) {
121 // We have to check number of enter and exit of this function because it can be called
122 // recursively by Qt in order to avoid double modifying of a data
124 QLineEdit* aEditor = dynamic_cast<QLineEdit*>(theEditor);
126 QString aName = aEditor->text();
127 QModelIndexList aIndexList = selectionModel()->selectedIndexes();
128 XGUI_DataModel* aModel = dataModel();
129 ObjectPtr aObj = aModel->object(aIndexList.first());
131 if (XGUI_Tools::canRename(aObj, aName)) {
132 SessionPtr aMgr = ModelAPI_Session::get();
133 aMgr->startOperation("Rename");
134 aObj->data()->setName(qPrintable(aName));
135 aMgr->finishOperation();
142 void XGUI_DataTree::clear()
144 dataModel()->clear();
148 void XGUI_DataTree::resizeEvent(QResizeEvent* theEvent)
150 QTreeView::resizeEvent(theEvent);
151 QSize aSize = theEvent->size();
152 if (aSize.isValid()) {
153 setColumnWidth(0, FIRST_COL_WIDTH);
154 setColumnWidth(1, aSize.width() - SECOND_COL_WIDTH - FIRST_COL_WIDTH - 10);
155 setColumnWidth(2, SECOND_COL_WIDTH);
160 void XGUI_DataTree::mousePressEvent(QMouseEvent* theEvent)
162 QTreeView::mousePressEvent(theEvent);
163 if (theEvent->button() != Qt::MidButton)
165 QModelIndex aInd = indexAt(theEvent->pos());
167 QString("r=%1 c=%2 p=%3").arg(aInd.row()).arg(aInd.column()).arg((long)aInd.internalPointer());
169 QModelIndex aPar = aInd.parent();
171 QString("r=%1 c=%2 p=%3").arg(aPar.row()).arg(aPar.column()).arg((long)aPar.internalPointer());
172 QToolTip::showText(theEvent->globalPos(), aTxt + '\n' + aTxt1);
176 void XGUI_DataTree::mouseReleaseEvent(QMouseEvent* theEvent)
178 QTreeView::mouseReleaseEvent(theEvent);
180 if (theEvent->button() != Qt::MidButton)
182 QToolTip::hideText();
184 if (theEvent->button() == Qt::LeftButton) {
185 QModelIndex aInd = indexAt(theEvent->pos());
186 if (aInd.column() == 0)
187 processEyeClick(aInd);
191 void XGUI_DataTree::processHistoryChange(const QModelIndex& theIndex)
193 SessionPtr aMgr = ModelAPI_Session::get();
194 // When operation is opened then we can not change history
195 if (aMgr->isOperation())
197 XGUI_DataModel* aModel = dataModel();
198 if (aModel->flags(theIndex) == 0)
200 ObjectPtr aObj = aModel->object(theIndex);
202 DocumentPtr aDoc = aMgr->activeDocument();
204 std::string aOpName = tr("History change").toStdString();
206 if (aObj->document() != aDoc)
208 aMgr->startOperation(aOpName);
209 aDoc->setCurrentFeature(std::dynamic_pointer_cast<ModelAPI_Feature>(aObj), true);
210 aMgr->finishOperation();
212 // Ignore clicks on folders outside current document
213 if ((theIndex.internalId() == 0) && (aDoc != aMgr->moduleDocument()))
214 // Clicked folder under root but active document is another
216 if ((theIndex.internalId() != 0) && (aDoc != aModel->document(theIndex)))
217 // Cliced not on active document folder
220 aMgr->startOperation(aOpName);
221 aDoc->setCurrentFeature(FeaturePtr(), true);
222 aMgr->finishOperation();
224 QModelIndex aParent = theIndex.parent();
225 int aSize = aModel->rowCount(aParent);
226 for (int i = 0; i < aSize; i++) {
227 update(aModel->index(i, 0, aParent));
228 update(aModel->index(i, 1, aParent));
229 update(aModel->index(i, 2, aParent));
231 XGUI_ObjectsBrowser* aObjBrowser = qobject_cast<XGUI_ObjectsBrowser*>(parent());
232 aObjBrowser->workshop()->displayer()->updateViewer();
235 void XGUI_DataTree::processEyeClick(const QModelIndex& theIndex)
237 XGUI_ObjectsBrowser* aObjBrowser = qobject_cast<XGUI_ObjectsBrowser*>(parent());
238 XGUI_DataModel* aModel = dataModel();
239 ObjectPtr aObj = aModel->object(theIndex);
241 std::set<ObjectPtr> anObjects;
242 anObjects.insert(aObj);
244 bool hasHiddenState = aModel->hasHiddenState(theIndex);
245 if (aObjBrowser && hasHiddenState && !aObjBrowser->workshop()->prepareForDisplay(anObjects))
247 if (hasHiddenState) { // #issue 2335(hide all faces then show solid problem)
248 if (aObj->isDisplayed())
249 aObj->setDisplayed(false);
250 aObj->setDisplayed(true);
253 aObj->setDisplayed(!aObj->isDisplayed());
255 // Update list of selected objects because this event happens after
256 // selection event in object browser
257 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
260 aObjBrowser->onSelectionChanged();
265 void XGUI_DataTree::onDoubleClick(const QModelIndex& theIndex)
267 switch (theIndex.column()) {
269 processHistoryChange(theIndex);
275 //********************************************************************
276 //********************************************************************
277 //********************************************************************
278 XGUI_ActiveDocLbl::XGUI_ActiveDocLbl(const QString& theText, QWidget* theParent )
279 : QLabel(theText, theParent),
280 myPreSelectionStyle(""),
282 mySelectionStyle(""),
287 void XGUI_ActiveDocLbl::setTreeView(QTreeView* theView)
289 myTreeView = theView;
290 setFont(myTreeView->font());
292 QPalette aPalet = myTreeView->palette();
293 QColor aHighlight = aPalet.highlight().color();
294 QColor aHighlightText = aPalet.highlightedText().color();
296 myPreSelectionStyle = "QLabel {background-color: ";
297 myPreSelectionStyle += aHighlight.lighter(170).name() + "}";
298 //myPreSelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 white, stop:1 " +
299 // aHighlight.lighter(170).name() + ");";
300 //myPreSelectionStyle += "border: 1px solid lightblue; border-radius: 2px }";
302 QString aName = aPalet.color(QPalette::Base).name();
303 myNeutralStyle = "QLabel { border: 1px solid " + aName + " }";
306 #if (!defined HAVE_SALOME) && (defined WIN32)
307 mySelectionStyle = "QLabel {background-color: ";
308 mySelectionStyle += "rgb(205, 232, 255); ";
309 //mySelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(236, 245, 255)";
310 //mySelectionStyle += ", stop:1 rgb(208, 229, 255));";
311 //mySelectionStyle += "border: 1px solid rgb(132, 172, 221); border-radius: 2px }";
312 mySelectionStyle += "border: 1px solid rgb(153, 209, 255) }";
314 mySelectionStyle = "QLabel {background-color: " + aHighlight.name();
315 mySelectionStyle += "; color : " + aHighlightText.name() + "}";
318 myTreeView->viewport()->installEventFilter(this);
322 #if (!defined HAVE_SALOME) && (defined WIN32)
323 bool XGUI_ActiveDocLbl::event(QEvent* theEvent)
325 switch (theEvent->type()) {
328 setStyleSheet(myPreSelectionStyle);
332 setStyleSheet(myNeutralStyle);
335 return QLabel::event(theEvent);
339 bool XGUI_ActiveDocLbl::eventFilter(QObject* theObj, QEvent* theEvent)
341 if (theObj == myTreeView->viewport()) {
342 if (theEvent->type() == QEvent::MouseButtonRelease)
345 return QLabel::eventFilter(theObj, theEvent);
348 static bool MYClearing = false;
349 void XGUI_ActiveDocLbl::mouseReleaseEvent( QMouseEvent* e)
353 setStyleSheet(mySelectionStyle);
354 // We can not block signals because on
355 // clear selection the View state will not be updated
356 myTreeView->clearSelection();
357 QLabel::mouseReleaseEvent(e);
361 void XGUI_ActiveDocLbl::unselect()
364 myIsSelected = false;
365 setStyleSheet(myNeutralStyle);
370 //********************************************************************
371 //********************************************************************
372 //********************************************************************
373 XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent, XGUI_Workshop* theWorkshop)
374 : QWidget(theParent), myDocModel(0), myWorkshop(theWorkshop)
376 QVBoxLayout* aLayout = new QVBoxLayout(this);
377 ModuleBase_Tools::zeroMargins(aLayout);
378 aLayout->setSpacing(0);
380 QWidget* aLabelWgt = new QWidget(this);
381 aLabelWgt->setAutoFillBackground(true);
383 aLayout->addWidget(aLabelWgt);
384 QHBoxLayout* aLabelLay = new QHBoxLayout(aLabelWgt);
385 ModuleBase_Tools::zeroMargins(aLabelLay);
386 aLabelLay->setSpacing(0);
388 QLabel* aLbl = new QLabel(aLabelWgt);
389 aLbl->setPixmap(QPixmap(":pictures/assembly.png"));
391 // Do not paint background of the label (in order to show icon)
392 aLbl->setAutoFillBackground(false);
394 aLabelLay->addWidget(aLbl);
396 SessionPtr aMgr = ModelAPI_Session::get();
397 DocumentPtr aDoc = aMgr->moduleDocument();
399 myActiveDocLbl = new XGUI_ActiveDocLbl(tr("Part set"), aLabelWgt);
400 // myActiveDocLbl->setReadOnly(true);
401 // myActiveDocLbl->setFrame(false);
402 myActiveDocLbl->setContextMenuPolicy(Qt::CustomContextMenu);
404 aLabelLay->addWidget(myActiveDocLbl);
405 aLabelLay->setStretch(1, 1);
407 myTreeView = new XGUI_DataTree(this);
408 myTreeView->setFrameShape(QFrame::NoFrame);
409 aLayout->addWidget(myTreeView);
411 QPalette aTreePalet = myTreeView->palette();
412 QColor aTreeBack = aTreePalet.color(QPalette::Base);
415 aPalet.setColor(QPalette::Base, aTreeBack);
416 aPalet.setColor(QPalette::Window, aTreeBack);
417 aLabelWgt->setPalette(aPalet);
419 myDocModel = new XGUI_DataModel(this);
420 connect(myDocModel, SIGNAL(beforeTreeRebuild()), SLOT(onBeforeReset()));
421 connect(myDocModel, SIGNAL(treeRebuilt()), SLOT(onAfterModelReset()));
423 connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
424 SLOT(onContextMenuRequested(QContextMenuEvent*)));
427 //***************************************************
428 XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser()
432 void XGUI_ObjectsBrowser::initialize(ModuleBase_ITreeNode* theRoot)
434 //myDocModel->setXMLReader(theReader);
435 myDocModel->setRoot(theRoot);
436 myTreeView->setModel(myDocModel);
438 // It has to be done after setting of model
439 myActiveDocLbl->setTreeView(myTreeView);
441 QItemSelectionModel* aSelMod = myTreeView->selectionModel();
442 connect(aSelMod, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
443 this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&)));
446 //***************************************************
447 void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent)
449 QModelIndexList aIndexes;
450 QObjectPtrList aSelectedData = selectedObjects(&aIndexes);
451 bool toEnable = false;
453 if (aSelectedData.size() == 1) {
454 QModelIndex aSelected = myTreeView->indexAt(theEvent->pos());
455 if (!aIndexes.contains(aSelected))
456 return; // menu is called on non selected item
458 Qt::ItemFlags aFlags = dataModel()->flags(aIndexes.first());
459 toEnable = ((aFlags & Qt::ItemIsEditable) != 0);
461 foreach(QAction* aCmd, actions()) {
462 aCmd->setEnabled(toEnable);
464 emit contextMenuRequested(theEvent);
467 //***************************************************
468 void XGUI_ObjectsBrowser::onLabelContextMenuRequested(const QPoint& thePnt)
470 myTreeView->selectionModel()->clearSelection();
471 //Empty feature pointer means that selected root document
472 foreach(QAction* aCmd, actions()) {
473 aCmd->setEnabled(true);
475 QContextMenuEvent aEvent(QContextMenuEvent::Mouse, thePnt, myActiveDocLbl->mapToGlobal(thePnt));
476 emit contextMenuRequested(&aEvent);
479 //***************************************************
480 void XGUI_ObjectsBrowser::onEditItem()
482 QObjectPtrList aSelectedData = selectedObjects();
483 if (aSelectedData.size() > 0) {
484 ObjectPtr anObject = aSelectedData.first();
485 if (anObject.get()) { // Selection happens in TreeView
486 // check whether the object can be renamed. There should not be parts which are not loaded
487 std::set<FeaturePtr> aFeatures;
488 aFeatures.insert(ModelAPI_Feature::feature(anObject));
489 if (!XGUI_Tools::canRemoveOrRename((QWidget*)parent(), aFeatures))
492 // Find index which corresponds the feature
494 foreach(QModelIndex aIdx, selectedIndexes()) {
495 if (aIdx.column() == 1) {
496 ObjectPtr aFea = dataModel()->object(aIdx);
497 if (dataModel()->object(aIdx)->isSame(anObject)) {
503 if (aIndex.isValid()) {
504 myTreeView->setCurrentIndex(aIndex);
505 myTreeView->edit(aIndex);
512 //***************************************************
513 QList<ModuleBase_ITreeNode*> XGUI_ObjectsBrowser::expandedItems(const QModelIndex& theParent) const
515 QList<ModuleBase_ITreeNode*> aIndexes;
517 int aCount = myDocModel->rowCount(theParent);
518 for (int i = 0; i < aCount; i++) {
519 aIndex = myDocModel->index(i, 0, theParent);
520 if (myDocModel->hasChildren(aIndex)) {
521 if (myTreeView->isExpanded(aIndex)) {
522 aIndexes.append((ModuleBase_ITreeNode*)aIndex.internalPointer());
523 QList<ModuleBase_ITreeNode*> aSubIndexes = expandedItems(aIndex);
524 if (!aSubIndexes.isEmpty())
525 aIndexes.append(aSubIndexes);
532 //***************************************************
533 void XGUI_ObjectsBrowser::rebuildDataTree()
535 myDocModel->root()->update();
536 myDocModel->rebuildDataTree();
540 //***************************************************
541 void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects)
543 QItemSelectionModel* aSelectModel = myTreeView->selectionModel();
544 QModelIndexList aIndexes = aSelectModel->selectedIndexes();
545 if (theObjects.size() == 0) {
546 bool aIsBlock = aSelectModel->blockSignals(true);
547 aSelectModel->clear();
548 aSelectModel->blockSignals(aIsBlock);
549 foreach(QModelIndex aIdx, aIndexes) {
550 myTreeView->update(aIdx);
556 QModelIndexList aUnselect;
557 QObjectPtrList aToSelect = theObjects;
558 QHash<qint64, ObjectPtr> aNotChanged;
559 foreach(QModelIndex aIdx, aIndexes) {
560 aObject = myDocModel->object(aIdx);
562 if (aToSelect.contains(aObject)) {
563 aNotChanged.insert((qint64)aObject.get(), aObject);
565 aUnselect.append(aIdx);
569 aUnselect.append(aIdx);
573 foreach(ObjectPtr aObj, aNotChanged)
574 aToSelect.removeAll(aObj);
576 bool aIsBlock = aSelectModel->blockSignals(true);
577 foreach(QModelIndex aIdx, aUnselect) {
578 aSelectModel->select(aIdx, QItemSelectionModel::Deselect);
579 myTreeView->update(aIdx);
582 QModelIndex aIndex0, aIndex1, aIndex2, aCurrent;
583 foreach(ObjectPtr aFeature, aToSelect) {
584 aIndex1 = myDocModel->objectIndex(aFeature, 1);
585 if (aIndex1.isValid()) {
586 if (!aCurrent.isValid())
588 aIndex0 = myDocModel->objectIndex(aFeature, 0);
589 aIndex2 = myDocModel->objectIndex(aFeature, 2);
590 aSelectModel->select(aIndex1, QItemSelectionModel::Select | QItemSelectionModel::Rows);
591 myTreeView->update(aIndex0);
592 myTreeView->update(aIndex1);
593 myTreeView->update(aIndex2);
596 aSelectModel->setCurrentIndex(aCurrent, QItemSelectionModel::NoUpdate);
597 aSelectModel->blockSignals(aIsBlock);
600 //***************************************************
601 void XGUI_ObjectsBrowser::ensureVisible(const ObjectPtr theObject)
603 QModelIndex aIndex = myDocModel->objectIndex(theObject);
604 if (aIndex.isValid()) {
605 QModelIndex aParent = aIndex.parent();
606 while (aParent.isValid()) {
607 myTreeView->expand(aParent);
608 aParent = aParent.parent();
610 myTreeView->scrollTo(aIndex);
614 //***************************************************
615 void XGUI_ObjectsBrowser::clearContent()
620 //***************************************************
621 void XGUI_ObjectsBrowser::onSelectionChanged(const QItemSelection& theSelected,
622 const QItemSelection& theDeselected)
624 onSelectionChanged();
627 //***************************************************
628 void XGUI_ObjectsBrowser::onSelectionChanged()
630 emit selectionChanged();
633 //***************************************************
634 QObjectPtrList XGUI_ObjectsBrowser::selectedObjects(QModelIndexList* theIndexes) const
636 QObjectPtrList aList;
637 QModelIndexList aIndexes = selectedIndexes();
638 XGUI_DataModel* aModel = dataModel();
640 foreach(QModelIndex aIdx, aIndexes) {
641 if (aIdx.column() == 1) {
642 ObjectPtr aObject = aModel->object(aIdx);
644 aList.append(aObject);
646 theIndexes->append(aIdx);
653 void XGUI_ObjectsBrowser::onBeforeReset()
655 myExpandedItems = expandedItems();
658 void XGUI_ObjectsBrowser::onAfterModelReset()
660 XGUI_DataModel* aModel = myTreeView->dataModel();
662 foreach(ModuleBase_ITreeNode* aNode, myExpandedItems) {
663 if (aModel->hasNode(aNode)) {
664 aIndex = aModel->getIndex(aNode, 0);
665 if (aIndex.isValid() && (myTreeView->dataModel()->hasIndex(aIndex)))
666 myTreeView->setExpanded(aIndex, true);
669 myExpandedItems.clear();
672 std::list<bool> XGUI_ObjectsBrowser::getStateForDoc(DocumentPtr theDoc) const
674 std::list<bool> aStates;
675 XGUI_DataModel* aModel = dataModel();
676 QModelIndex aRootIdx = aModel->documentRootIndex(theDoc);
677 int aNbChild = aModel->rowCount(aRootIdx);
678 for (int i = 0; i < aNbChild; i++) {
679 QModelIndex aIdx = aModel->index(i, 0, aRootIdx);
680 aStates.push_back(myTreeView->isExpanded(aIdx));
685 void XGUI_ObjectsBrowser::setStateForDoc(DocumentPtr theDoc, const std::list<bool>& theStates)
687 if (theStates.size() == 0)
689 XGUI_DataModel* aModel = dataModel();
690 QModelIndex aRootIdx = aModel->documentRootIndex(theDoc);
691 int aNbChild = aModel->rowCount(aRootIdx);
693 std::list<bool>::const_iterator aIt;
695 for (aIt = theStates.cbegin(); aIt != theStates.cend(); aIt++, i++) {
698 QModelIndex aIdx = aModel->index(i, 0, aRootIdx);
699 myTreeView->setExpanded(aIdx, (*aIt));
703 void XGUI_ObjectsBrowser::updateAllIndexes(int theColumn, const QModelIndex& theParent)
705 int aNb = myDocModel->rowCount(theParent);
706 for (int i = 0; i < aNb; i++) {
707 QModelIndex aIdx = myDocModel->index(i, theColumn, theParent);
708 if (aIdx.isValid() && myDocModel->hasIndex(aIdx)) {
709 myTreeView->update(aIdx);
710 if (myTreeView->isExpanded(aIdx))
711 updateAllIndexes(theColumn, aIdx);
716 QMap<ObjectPtr, bool> XGUI_ObjectsBrowser::getFoldersState(DocumentPtr theDoc) const
718 QMap<ObjectPtr, bool> aMap;
720 int aNb = theDoc->size(ModelAPI_Folder::group());
722 for (int i = 0; i < aNb; i++) {
723 aObj = theDoc->object(ModelAPI_Folder::group(), i);
724 QModelIndex aIdx = myDocModel->objectIndex(aObj, 0);
725 aMap[aObj] = myTreeView->isExpanded(aIdx);
730 void XGUI_ObjectsBrowser::setFoldersState(const QMap<ObjectPtr, bool>& theStates)
732 QMap<ObjectPtr, bool>::const_iterator aIt;
733 for (aIt = theStates.constBegin(); aIt != theStates.constEnd(); aIt++) {
734 QModelIndex aIdx = myDocModel->objectIndex(aIt.key(), 0);
735 myTreeView->setExpanded(aIdx, aIt.value());
740 void XGUI_ObjectsBrowser::resizeEvent(QResizeEvent* theEvent)
742 QWidget::resizeEvent(theEvent);