]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PAL19566, PAL19567, PAL19571, PAL19572
authorasl <asl@opencascade.com>
Thu, 17 Apr 2008 11:33:56 +0000 (11:33 +0000)
committerasl <asl@opencascade.com>
Thu, 17 Apr 2008 11:33:56 +0000 (11:33 +0000)
src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx
src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h

index 38632b4744849c321a689aa203a793cc530c4175..fd9e0c1f08aff7c889cbc42f4babd3247096e28f 100644 (file)
@@ -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);
   }
 
index f931c454c7801c1f6610cbe6c22cdc243e6498ec..0cf3b306eaf6fcf6b7948806647f5a9eda482917 100644 (file)
@@ -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& );