X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_OrderedListWidget.cxx;h=fe1cdce1dee59fee995ad9f55087b285b37a00b7;hb=6ba63abdcb5832a1773cb33cf67d6b34aee4139d;hp=c17903a3b67f415d202c00af34d0df081614f63a;hpb=18bf2fdae8933e8a31ca58f36b6dceb7a4a8cf42;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx b/src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx index c17903a3..fe1cdce1 100644 --- a/src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx +++ b/src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx @@ -112,12 +112,21 @@ HYDROGUI_OrderedListWidget::HYDROGUI_OrderedListWidget( QWidget* theParent, int connect ( myList->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SIGNAL( selectionChanged() ) ); + + connect ( myList->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), + this, SLOT( onSelectionChanged() ) ); // Initialize setHiddenObjectsShown( true ); setVisibilityIconShown( true ); } +void HYDROGUI_OrderedListWidget::onSelectionChanged() +{ + QStringList selectedEntries = getSelectedEntries(); + +} + /** Destructor. */ @@ -137,6 +146,53 @@ void HYDROGUI_OrderedListWidget::setObjects( const HYDROGUI_ListModel::Object2Vi } } +void HYDROGUI_OrderedListWidget::setBackgroundColor (int theInd, QColor theColor) +{ + HYDROGUI_ListModel* aModel = getSourceModel(); + if( aModel ) { + aModel->setBackgroundColor( theInd, theColor ); + } +} + +void HYDROGUI_OrderedListWidget::setBackgroundColor (QString theName, QColor theColor) +{ + HYDROGUI_ListModel* aModel = getSourceModel(); + if (aModel) + { + QList anObjects = aModel->getObjects(); + int ind = -1; + int cur_ind = 0; + foreach (Handle(HYDROData_Entity) ent, anObjects) + { + if (ent->GetName() == theName) + { + ind = cur_ind; + break; + } + cur_ind++; + } + if (ind != -1) + aModel->setBackgroundColor( ind, theColor ); + } +} + +void HYDROGUI_OrderedListWidget::clearAllBackgroundColors () +{ + HYDROGUI_ListModel* aModel = getSourceModel(); + if( aModel ) { + aModel->clearAllBackgroundColors( ); + } +} + + + QColor HYDROGUI_OrderedListWidget::getBackgroundColor (int theInd) const + { + HYDROGUI_ListModel* aModel = getSourceModel(); + if( aModel ) { + return aModel->getBackgroundColor( theInd ); + } + } + /** Returns the ordered list of objects. @return the list of objects