From: asl Date: Thu, 17 Apr 2008 11:33:56 +0000 (+0000) Subject: PAL19566, PAL19567, PAL19571, PAL19572 X-Git-Tag: V5_0_0~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b3a56b6ba93c18e3eb1e8715dbb3fc221e09dd78;p=modules%2Fsmesh.git PAL19566, PAL19567, PAL19571, PAL19572 --- diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx index 38632b474..fd9e0c1f0 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx @@ -225,8 +225,8 @@ QWidget* SMESHGUI_FilterLibraryDlg::createMainFrame (QWidget* theParent) connect(myFileName, SIGNAL(returnPressed()), this, SLOT(onReturnPressed())); connect(myOpenBtn, SIGNAL(clicked()), this, SLOT(onBrowse())); - connect(myListBox, SIGNAL(currentTextChanged(const QString&)), - this, SLOT(onFilterChanged(const QString&))); + connect(myListBox, SIGNAL( currentItemChanged( QListWidgetItem*, QListWidgetItem* ) ), + this, SLOT( onFilterChanged( QListWidgetItem*, QListWidgetItem* ) ) ); connect(myAddBtn, SIGNAL(clicked()), this, SLOT(onAddBtnPressed())); connect(myDeleteBtn, SIGNAL(clicked()), this, SLOT(onDeleteBtnPressed())); @@ -647,7 +647,8 @@ void SMESHGUI_FilterLibraryDlg::onBrowse() setFileName(fName); - QString aName = myListBox->item(myListBox->count() - 1)->text(); + QListWidgetItem* item = myListBox->item( myListBox->count()-1 ); + QString aName = item ? item->text() : QString::null; processNewLibrary(); if (myMode == ADD_TO) @@ -812,8 +813,9 @@ bool SMESHGUI_FilterLibraryDlg::isValid(const bool theMess) const // name : SMESHGUI_FilterLibraryDlg::onFilterChanged // Purpose : SLOT. Called when selected filter of library changed //======================================================================= -void SMESHGUI_FilterLibraryDlg::onFilterChanged(const QString& theName) +void SMESHGUI_FilterLibraryDlg::onFilterChanged( QListWidgetItem* item, QListWidgetItem* ) { + QString theName = item->text(); if (myLibrary->_is_nil()) return; @@ -847,7 +849,7 @@ void SMESHGUI_FilterLibraryDlg::onFilterChanged(const QString& theName) myTable->Clear(myTable->GetType()); - if (!aFilter->GetCriteria(aCriteria)) + if (CORBA::is_nil( aFilter ) || !aFilter->GetCriteria(aCriteria)) return; for (int i = 0, n = aCriteria->length(); i < n; i++) @@ -863,7 +865,8 @@ void SMESHGUI_FilterLibraryDlg::onFilterChanged(const QString& theName) //======================================================================= void SMESHGUI_FilterLibraryDlg::onReturnPressed() { - QString aName = myListBox->item(myListBox->count() - 1)->text(); + QListWidgetItem* item = myListBox->item( myListBox->count()-1 ); + QString aName = item ? item->text() : QString::null; processNewLibrary(); @@ -933,10 +936,11 @@ void SMESHGUI_FilterLibraryDlg::onAddBtnPressed() { if (!isValid(true)) return; - + } + { SMESH::Filter_var aFilter = createFilter(); - myLibrary->Replace(myCurrFilterName.toLatin1().data(), - myName->text().toLatin1().data(), + myLibrary->Replace(myCurrFilterName.toLatin1().constData(), + myName->text().toLatin1().constData(), aFilter); } diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h index f931c454c..0cf3b306e 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h @@ -39,6 +39,7 @@ #include CORBA_SERVER_HEADER(SMESH_Filter) class QListWidget; +class QListWidgetItem; class QLineEdit; class QPushButton; class SMESHGUI; @@ -89,7 +90,7 @@ private slots: void onBrowse(); void onReturnPressed(); - void onFilterChanged( const QString& ); + void onFilterChanged( QListWidgetItem*, QListWidgetItem* ); void onAddBtnPressed(); void onDeleteBtnPressed(); void onFilterNameChanged( const QString& );