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>
29 #include <ModuleBase_Tools.h>
30 #include <ModuleBase_ITreeNode.h>
32 #include <XGUI_Workshop.h>
38 #include <QMouseEvent>
40 #include <QStyledItemDelegate>
41 #include <QMessageBox>
42 #include <QApplication>
48 /// Width of second column (minimum acceptable = 27)
49 #define FIRST_COL_WIDTH 20
50 #define SECOND_COL_WIDTH 30
54 * Tree item delegate for definition of data in column items editor
56 class XGUI_TreeViewItemDelegate: public QStyledItemDelegate
60 /// \param theParent a parent of the delegate
61 XGUI_TreeViewItemDelegate(XGUI_DataTree* theParent):QStyledItemDelegate(theParent),
62 myTreedView(theParent) {}
64 /// Set data for item editor (name of the item)
65 /// \param editor a widget of editor
66 /// \param index the tree item index
67 virtual void setEditorData ( QWidget* editor, const QModelIndex& index ) const
69 QLineEdit* aEditor = dynamic_cast<QLineEdit*>(editor);
71 XGUI_DataModel* aModel = myTreedView->dataModel();
72 ObjectPtr aObj = aModel->object(index);
73 if (aObj.get() != NULL) {
74 aEditor->setText(aObj->data()->name().c_str());
78 QStyledItemDelegate::setEditorData(editor, index);
82 XGUI_DataTree* myTreedView;
86 XGUI_DataTree::XGUI_DataTree(QWidget* theParent)
87 : QTreeView(theParent)
89 setHeaderHidden(true);
91 setEditTriggers(QAbstractItemView::NoEditTriggers);
92 setSelectionBehavior(QAbstractItemView::SelectRows);
93 setSelectionMode(QAbstractItemView::ExtendedSelection);
95 setItemDelegateForColumn(1, new XGUI_TreeViewItemDelegate(this));
97 connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
98 SLOT(onDoubleClick(const QModelIndex&)));
101 XGUI_DataTree::~XGUI_DataTree()
105 XGUI_DataModel* XGUI_DataTree::dataModel() const
107 return static_cast<XGUI_DataModel*>(model());
110 void XGUI_DataTree::contextMenuEvent(QContextMenuEvent* theEvent)
112 emit contextMenuRequested(theEvent);
115 void XGUI_DataTree::commitData(QWidget* theEditor)
117 static int aEntrance = 0;
118 if (aEntrance == 0) {
119 // We have to check number of enter and exit of this function because it can be called
120 // recursively by Qt in order to avoid double modifying of a data
122 QLineEdit* aEditor = dynamic_cast<QLineEdit*>(theEditor);
124 QString aName = aEditor->text();
125 QModelIndexList aIndexList = selectionModel()->selectedIndexes();
126 XGUI_DataModel* aModel = dataModel();
127 ObjectPtr aObj = aModel->object(aIndexList.first());
129 if (XGUI_Tools::canRename(aObj, aName)) {
130 SessionPtr aMgr = ModelAPI_Session::get();
131 aMgr->startOperation("Rename");
132 aObj->data()->setName(qPrintable(aName));
133 aMgr->finishOperation();
140 void XGUI_DataTree::clear()
142 dataModel()->clear();
146 void XGUI_DataTree::resizeEvent(QResizeEvent* theEvent)
148 QTreeView::resizeEvent(theEvent);
149 QSize aSize = theEvent->size();
150 if (aSize.isValid()) {
151 setColumnWidth(0, FIRST_COL_WIDTH);
152 setColumnWidth(1, aSize.width() - SECOND_COL_WIDTH - FIRST_COL_WIDTH - 10);
153 setColumnWidth(2, SECOND_COL_WIDTH);
158 void XGUI_DataTree::mousePressEvent(QMouseEvent* theEvent)
160 QTreeView::mousePressEvent(theEvent);
161 if (theEvent->button() != Qt::MidButton)
163 QModelIndex aInd = indexAt(theEvent->pos());
165 QString("r=%1 c=%2 p=%3").arg(aInd.row()).arg(aInd.column()).arg((long)aInd.internalPointer());
167 QModelIndex aPar = aInd.parent();
169 QString("r=%1 c=%2 p=%3").arg(aPar.row()).arg(aPar.column()).arg((long)aPar.internalPointer());
170 QToolTip::showText(theEvent->globalPos(), aTxt + '\n' + aTxt1);
174 void XGUI_DataTree::mouseReleaseEvent(QMouseEvent* theEvent)
176 QTreeView::mouseReleaseEvent(theEvent);
178 if (theEvent->button() != Qt::MidButton)
180 QToolTip::hideText();
182 if (theEvent->button() == Qt::LeftButton) {
183 QModelIndex aInd = indexAt(theEvent->pos());
184 if (aInd.column() == 0)
185 processEyeClick(aInd);
189 void XGUI_DataTree::processHistoryChange(const QModelIndex& theIndex)
191 SessionPtr aMgr = ModelAPI_Session::get();
192 // When operation is opened then we can not change history
193 if (aMgr->isOperation())
195 XGUI_DataModel* aModel = dataModel();
196 if (aModel->flags(theIndex) == 0)
198 ObjectPtr aObj = aModel->object(theIndex);
200 DocumentPtr aDoc = aMgr->activeDocument();
202 std::string aOpName = tr("History change").toStdString();
204 if (aObj->document() != aDoc)
206 aMgr->startOperation(aOpName);
207 aDoc->setCurrentFeature(std::dynamic_pointer_cast<ModelAPI_Feature>(aObj), true);
208 aMgr->finishOperation();
210 // Ignore clicks on folders outside current document
211 if ((theIndex.internalId() == 0) && (aDoc != aMgr->moduleDocument()))
212 // Clicked folder under root but active document is another
214 if ((theIndex.internalId() != 0) && (aDoc != aModel->document(theIndex)))
215 // Cliced not on active document folder
218 aMgr->startOperation(aOpName);
219 aDoc->setCurrentFeature(FeaturePtr(), true);
220 aMgr->finishOperation();
222 QModelIndex aParent = theIndex.parent();
223 int aSize = aModel->rowCount(aParent);
224 for (int i = 0; i < aSize; i++) {
225 update(aModel->index(i, 0, aParent));
226 update(aModel->index(i, 1, aParent));
227 update(aModel->index(i, 2, aParent));
231 void XGUI_DataTree::processEyeClick(const QModelIndex& theIndex)
233 XGUI_DataModel* aModel = dataModel();
234 ObjectPtr aObj = aModel->object(theIndex);
236 ResultPtr aResObj = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
237 XGUI_ObjectsBrowser* aObjBrowser = qobject_cast<XGUI_ObjectsBrowser*>(parent());
239 std::set<ObjectPtr> anObjects;
240 anObjects.insert(aResObj);
242 bool hasHiddenState = aModel->hasHiddenState(theIndex);
243 if (aObjBrowser && hasHiddenState && !aObjBrowser->workshop()->prepareForDisplay(anObjects))
245 if (hasHiddenState) { // #issue 2335(hide all faces then show solid problem)
246 if (aResObj->isDisplayed())
247 aResObj->setDisplayed(false);
248 aResObj->setDisplayed(true);
251 aResObj->setDisplayed(!aResObj->isDisplayed());
252 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
255 // Update list of selected objects because this event happens after
256 // selection event in object browser
258 aObjBrowser->onSelectionChanged();
263 void XGUI_DataTree::onDoubleClick(const QModelIndex& theIndex)
265 switch (theIndex.column()) {
267 processHistoryChange(theIndex);
273 //********************************************************************
274 //********************************************************************
275 //********************************************************************
276 XGUI_ActiveDocLbl::XGUI_ActiveDocLbl(const QString& theText, QWidget* theParent )
277 : QLabel(theText, theParent),
278 myPreSelectionStyle(""),
280 mySelectionStyle(""),
285 void XGUI_ActiveDocLbl::setTreeView(QTreeView* theView)
287 myTreeView = theView;
288 setFont(myTreeView->font());
290 QPalette aPalet = myTreeView->palette();
291 QColor aHighlight = aPalet.highlight().color();
292 QColor aHighlightText = aPalet.highlightedText().color();
294 myPreSelectionStyle = "QLabel {background-color: ";
295 myPreSelectionStyle += aHighlight.lighter(170).name() + "}";
296 //myPreSelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 white, stop:1 " +
297 // aHighlight.lighter(170).name() + ");";
298 //myPreSelectionStyle += "border: 1px solid lightblue; border-radius: 2px }";
300 QString aName = aPalet.color(QPalette::Base).name();
301 myNeutralStyle = "QLabel { border: 1px solid " + aName + " }";
304 #if (!defined HAVE_SALOME) && (defined WIN32)
305 mySelectionStyle = "QLabel {background-color: ";
306 mySelectionStyle += "rgb(205, 232, 255); ";
307 //mySelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(236, 245, 255)";
308 //mySelectionStyle += ", stop:1 rgb(208, 229, 255));";
309 //mySelectionStyle += "border: 1px solid rgb(132, 172, 221); border-radius: 2px }";
310 mySelectionStyle += "border: 1px solid rgb(153, 209, 255) }";
312 mySelectionStyle = "QLabel {background-color: " + aHighlight.name();
313 mySelectionStyle += "; color : " + aHighlightText.name() + "}";
316 myTreeView->viewport()->installEventFilter(this);
320 #if (!defined HAVE_SALOME) && (defined WIN32)
321 bool XGUI_ActiveDocLbl::event(QEvent* theEvent)
323 switch (theEvent->type()) {
326 setStyleSheet(myPreSelectionStyle);
330 setStyleSheet(myNeutralStyle);
333 return QLabel::event(theEvent);
337 bool XGUI_ActiveDocLbl::eventFilter(QObject* theObj, QEvent* theEvent)
339 if (theObj == myTreeView->viewport()) {
340 if (theEvent->type() == QEvent::MouseButtonRelease)
343 return QLabel::eventFilter(theObj, theEvent);
346 static bool MYClearing = false;
347 void XGUI_ActiveDocLbl::mouseReleaseEvent( QMouseEvent* e)
351 setStyleSheet(mySelectionStyle);
352 // We can not block signals because on
353 // clear selection the View state will not be updated
354 myTreeView->clearSelection();
355 QLabel::mouseReleaseEvent(e);
359 void XGUI_ActiveDocLbl::unselect()
362 myIsSelected = false;
363 setStyleSheet(myNeutralStyle);
368 //********************************************************************
369 //********************************************************************
370 //********************************************************************
371 XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent, XGUI_Workshop* theWorkshop)
372 : QWidget(theParent), myDocModel(0), myWorkshop(theWorkshop)
374 QVBoxLayout* aLayout = new QVBoxLayout(this);
375 ModuleBase_Tools::zeroMargins(aLayout);
376 aLayout->setSpacing(0);
378 QWidget* aLabelWgt = new QWidget(this);
379 aLabelWgt->setAutoFillBackground(true);
381 aLayout->addWidget(aLabelWgt);
382 QHBoxLayout* aLabelLay = new QHBoxLayout(aLabelWgt);
383 ModuleBase_Tools::zeroMargins(aLabelLay);
384 aLabelLay->setSpacing(0);
386 QLabel* aLbl = new QLabel(aLabelWgt);
387 aLbl->setPixmap(QPixmap(":pictures/assembly.png"));
389 // Do not paint background of the label (in order to show icon)
390 aLbl->setAutoFillBackground(false);
392 aLabelLay->addWidget(aLbl);
394 SessionPtr aMgr = ModelAPI_Session::get();
395 DocumentPtr aDoc = aMgr->moduleDocument();
397 myActiveDocLbl = new XGUI_ActiveDocLbl(tr("Part set"), aLabelWgt);
398 // myActiveDocLbl->setReadOnly(true);
399 // myActiveDocLbl->setFrame(false);
400 myActiveDocLbl->setContextMenuPolicy(Qt::CustomContextMenu);
402 aLabelLay->addWidget(myActiveDocLbl);
403 aLabelLay->setStretch(1, 1);
405 myTreeView = new XGUI_DataTree(this);
406 myTreeView->setFrameShape(QFrame::NoFrame);
407 aLayout->addWidget(myTreeView);
409 QPalette aTreePalet = myTreeView->palette();
410 QColor aTreeBack = aTreePalet.color(QPalette::Base);
413 aPalet.setColor(QPalette::Base, aTreeBack);
414 aPalet.setColor(QPalette::Window, aTreeBack);
415 aLabelWgt->setPalette(aPalet);
417 myDocModel = new XGUI_DataModel(this);
418 connect(myDocModel, SIGNAL(beforeTreeRebuild()), SLOT(onBeforeReset()));
419 connect(myDocModel, SIGNAL(treeRebuilt()), SLOT(onAfterModelReset()));
421 connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
422 SLOT(onContextMenuRequested(QContextMenuEvent*)));
425 //***************************************************
426 XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser()
430 void XGUI_ObjectsBrowser::initialize(ModuleBase_ITreeNode* theRoot)
432 //myDocModel->setXMLReader(theReader);
433 myDocModel->setRoot(theRoot);
434 myTreeView->setModel(myDocModel);
436 // It has to be done after setting of model
437 myActiveDocLbl->setTreeView(myTreeView);
439 QItemSelectionModel* aSelMod = myTreeView->selectionModel();
440 connect(aSelMod, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
441 this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&)));
444 //***************************************************
445 void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent)
447 QModelIndexList aIndexes;
448 QObjectPtrList aSelectedData = selectedObjects(&aIndexes);
449 bool toEnable = false;
451 if (aSelectedData.size() == 1) {
452 QModelIndex aSelected = myTreeView->indexAt(theEvent->pos());
453 if (!aIndexes.contains(aSelected))
454 return; // menu is called on non selected item
456 Qt::ItemFlags aFlags = dataModel()->flags(aIndexes.first());
457 toEnable = ((aFlags & Qt::ItemIsEditable) != 0);
459 foreach(QAction* aCmd, actions()) {
460 aCmd->setEnabled(toEnable);
462 emit contextMenuRequested(theEvent);
465 //***************************************************
466 void XGUI_ObjectsBrowser::onLabelContextMenuRequested(const QPoint& thePnt)
468 myTreeView->selectionModel()->clearSelection();
469 //Empty feature pointer means that selected root document
470 foreach(QAction* aCmd, actions()) {
471 aCmd->setEnabled(true);
473 QContextMenuEvent aEvent(QContextMenuEvent::Mouse, thePnt, myActiveDocLbl->mapToGlobal(thePnt));
474 emit contextMenuRequested(&aEvent);
477 //***************************************************
478 void XGUI_ObjectsBrowser::onEditItem()
480 QObjectPtrList aSelectedData = selectedObjects();
481 if (aSelectedData.size() > 0) {
482 ObjectPtr anObject = aSelectedData.first();
483 if (anObject.get()) { // Selection happens in TreeView
484 // check whether the object can be renamed. There should not be parts which are not loaded
485 std::set<FeaturePtr> aFeatures;
486 aFeatures.insert(ModelAPI_Feature::feature(anObject));
487 if (!XGUI_Tools::canRemoveOrRename((QWidget*)parent(), aFeatures))
490 // Find index which corresponds the feature
492 foreach(QModelIndex aIdx, selectedIndexes()) {
493 if (aIdx.column() == 1) {
494 ObjectPtr aFea = dataModel()->object(aIdx);
495 if (dataModel()->object(aIdx)->isSame(anObject)) {
501 if (aIndex.isValid()) {
502 myTreeView->setCurrentIndex(aIndex);
503 myTreeView->edit(aIndex);
510 //***************************************************
511 QList<ModuleBase_ITreeNode*> XGUI_ObjectsBrowser::expandedItems(const QModelIndex& theParent) const
513 QList<ModuleBase_ITreeNode*> aIndexes;
515 int aCount = myDocModel->rowCount(theParent);
516 for (int i = 0; i < aCount; i++) {
517 aIndex = myDocModel->index(i, 0, theParent);
518 if (myDocModel->hasChildren(aIndex)) {
519 if (myTreeView->isExpanded(aIndex)) {
520 aIndexes.append((ModuleBase_ITreeNode*)aIndex.internalPointer());
521 QList<ModuleBase_ITreeNode*> aSubIndexes = expandedItems(aIndex);
522 if (!aSubIndexes.isEmpty())
523 aIndexes.append(aSubIndexes);
530 //***************************************************
531 void XGUI_ObjectsBrowser::rebuildDataTree()
533 myDocModel->root()->update();
534 myDocModel->rebuildDataTree();
538 //***************************************************
539 void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects)
541 QItemSelectionModel* aSelectModel = myTreeView->selectionModel();
542 QModelIndexList aIndexes = aSelectModel->selectedIndexes();
543 if (theObjects.size() == 0) {
544 bool aIsBlock = aSelectModel->blockSignals(true);
545 aSelectModel->clear();
546 aSelectModel->blockSignals(aIsBlock);
547 foreach(QModelIndex aIdx, aIndexes) {
548 myTreeView->update(aIdx);
554 QModelIndexList aUnselect;
555 QObjectPtrList aToSelect = theObjects;
556 QHash<qint64, ObjectPtr> aNotChanged;
557 foreach(QModelIndex aIdx, aIndexes) {
558 aObject = myDocModel->object(aIdx);
560 if (aToSelect.contains(aObject)) {
561 aNotChanged.insert((qint64)aObject.get(), aObject);
563 aUnselect.append(aIdx);
567 aUnselect.append(aIdx);
571 foreach(ObjectPtr aObj, aNotChanged)
572 aToSelect.removeAll(aObj);
574 bool aIsBlock = aSelectModel->blockSignals(true);
575 foreach(QModelIndex aIdx, aUnselect) {
576 aSelectModel->select(aIdx, QItemSelectionModel::Deselect);
577 myTreeView->update(aIdx);
580 QModelIndex aIndex0, aIndex1, aIndex2, aCurrent;
581 foreach(ObjectPtr aFeature, aToSelect) {
582 aIndex1 = myDocModel->objectIndex(aFeature, 1);
583 if (aIndex1.isValid()) {
584 if (!aCurrent.isValid())
586 aIndex0 = myDocModel->objectIndex(aFeature, 0);
587 aIndex2 = myDocModel->objectIndex(aFeature, 2);
588 aSelectModel->select(aIndex1, QItemSelectionModel::Select | QItemSelectionModel::Rows);
589 myTreeView->update(aIndex0);
590 myTreeView->update(aIndex1);
591 myTreeView->update(aIndex2);
594 aSelectModel->setCurrentIndex(aCurrent, QItemSelectionModel::NoUpdate);
595 aSelectModel->blockSignals(aIsBlock);
598 //***************************************************
599 void XGUI_ObjectsBrowser::ensureVisible(const ObjectPtr theObject)
601 QModelIndex aIndex = myDocModel->objectIndex(theObject);
602 if (aIndex.isValid()) {
603 QModelIndex aParent = aIndex.parent();
604 while (aParent.isValid()) {
605 myTreeView->expand(aParent);
606 aParent = aParent.parent();
608 myTreeView->scrollTo(aIndex);
612 //***************************************************
613 void XGUI_ObjectsBrowser::clearContent()
618 //***************************************************
619 void XGUI_ObjectsBrowser::onSelectionChanged(const QItemSelection& theSelected,
620 const QItemSelection& theDeselected)
622 onSelectionChanged();
625 //***************************************************
626 void XGUI_ObjectsBrowser::onSelectionChanged()
628 emit selectionChanged();
631 //***************************************************
632 QObjectPtrList XGUI_ObjectsBrowser::selectedObjects(QModelIndexList* theIndexes) const
634 QObjectPtrList aList;
635 QModelIndexList aIndexes = selectedIndexes();
636 XGUI_DataModel* aModel = dataModel();
638 foreach(QModelIndex aIdx, aIndexes) {
639 if (aIdx.column() == 1) {
640 ObjectPtr aObject = aModel->object(aIdx);
642 aList.append(aObject);
644 theIndexes->append(aIdx);
651 void XGUI_ObjectsBrowser::onBeforeReset()
653 myExpandedItems = expandedItems();
656 void XGUI_ObjectsBrowser::onAfterModelReset()
658 XGUI_DataModel* aModel = myTreeView->dataModel();
660 foreach(ModuleBase_ITreeNode* aNode, myExpandedItems) {
661 if (aModel->hasNode(aNode)) {
662 aIndex = aModel->getIndex(aNode, 0);
663 if (aIndex.isValid() && (myTreeView->dataModel()->hasIndex(aIndex)))
664 myTreeView->setExpanded(aIndex, true);
667 myExpandedItems.clear();
670 std::list<bool> XGUI_ObjectsBrowser::getStateForDoc(DocumentPtr theDoc) const
672 std::list<bool> aStates;
673 XGUI_DataModel* aModel = dataModel();
674 QModelIndex aRootIdx = aModel->documentRootIndex(theDoc);
675 int aNbChild = aModel->rowCount(aRootIdx);
676 for (int i = 0; i < aNbChild; i++) {
677 QModelIndex aIdx = aModel->index(i, 0, aRootIdx);
678 aStates.push_back(myTreeView->isExpanded(aIdx));
683 void XGUI_ObjectsBrowser::setStateForDoc(DocumentPtr theDoc, const std::list<bool>& theStates)
685 if (theStates.size() == 0)
687 XGUI_DataModel* aModel = dataModel();
688 QModelIndex aRootIdx = aModel->documentRootIndex(theDoc);
689 int aNbChild = aModel->rowCount(aRootIdx);
691 std::list<bool>::const_iterator aIt;
693 for (aIt = theStates.cbegin(); aIt != theStates.cend(); aIt++, i++) {
696 QModelIndex aIdx = aModel->index(i, 0, aRootIdx);
697 myTreeView->setExpanded(aIdx, (*aIt));
701 void XGUI_ObjectsBrowser::updateAllIndexes(int theColumn, const QModelIndex& theParent)
703 int aNb = myDocModel->rowCount(theParent);
704 for (int i = 0; i < aNb; i++) {
705 QModelIndex aIdx = myDocModel->index(i, theColumn, theParent);
706 if (aIdx.isValid() && myDocModel->hasIndex(aIdx)) {
707 myTreeView->update(aIdx);
708 if (myTreeView->isExpanded(aIdx))
709 updateAllIndexes(theColumn, aIdx);
714 QMap<ObjectPtr, bool> XGUI_ObjectsBrowser::getFoldersState(DocumentPtr theDoc) const
716 QMap<ObjectPtr, bool> aMap;
718 int aNb = theDoc->size(ModelAPI_Folder::group());
720 for (int i = 0; i < aNb; i++) {
721 aObj = theDoc->object(ModelAPI_Folder::group(), i);
722 QModelIndex aIdx = myDocModel->objectIndex(aObj, 0);
723 aMap[aObj] = myTreeView->isExpanded(aIdx);
728 void XGUI_ObjectsBrowser::setFoldersState(const QMap<ObjectPtr, bool>& theStates)
730 QMap<ObjectPtr, bool>::const_iterator aIt;
731 for (aIt = theStates.constBegin(); aIt != theStates.constEnd(); aIt++) {
732 QModelIndex aIdx = myDocModel->objectIndex(aIt.key(), 0);
733 myTreeView->setExpanded(aIdx, aIt.value());
738 void XGUI_ObjectsBrowser::resizeEvent(QResizeEvent* theEvent)
740 QWidget::resizeEvent(theEvent);