Back to index

salome-smesh  6.5.0
Public Types | Public Member Functions | Private Attributes
SMESHGUI_FilterTable::AdditionalWidget Class Reference

List of all members.

Public Types

enum  { Tolerance }

Public Member Functions

 AdditionalWidget (QWidget *theParent)
virtual ~AdditionalWidget ()
virtual QList< int > GetParameters () const
virtual bool IsValid (const bool=true) const
virtual double GetDouble (const int) const
virtual int GetInteger (const int) const
virtual QString GetString (const int) const
virtual void SetDouble (const int, const double)
virtual void SetInteger (const int, const int)
virtual void SetString (const int, const QString &)
void SetEditable (const int, const bool)
void SetEditable (const bool)
void SetPrecision (const int, const char *=0)

Private Attributes

QMap< int, QWidget * > myWidgets

Detailed Description

Definition at line 147 of file SMESHGUI_FilterDlg.cxx.


Member Enumeration Documentation

anonymous enum
Enumerator:
Tolerance 

Definition at line 150 of file SMESHGUI_FilterDlg.cxx.

{ Tolerance };

Constructor & Destructor Documentation

Definition at line 172 of file SMESHGUI_FilterDlg.cxx.

  : QWidget(theParent)
{
  QLabel* aLabel = new QLabel(tr("SMESH_TOLERANCE"), this);

  SMESHGUI_SpinBox* sb = new SMESHGUI_SpinBox(this);
  sb->setAcceptNames( false ); // No Notebook variables allowed
  sb->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
  sb->RangeStepAndValidator( 0., 1.e20, 0.1, "len_tol_precision" );
  myWidgets[ Tolerance ] = sb;

  QHBoxLayout* aLay = new QHBoxLayout(this);
  aLay->setSpacing(SPACING);
  aLay->setMargin(0);

  aLay->addWidget(aLabel);
  aLay->addWidget(myWidgets[ Tolerance ]);
  aLay->addStretch();

  SetDouble( Tolerance, Precision::Confusion() );
}

Here is the call graph for this function:

Definition at line 194 of file SMESHGUI_FilterDlg.cxx.

{
}

Member Function Documentation

double SMESHGUI_FilterTable::AdditionalWidget::GetDouble ( const int  theId) const [virtual]

Definition at line 232 of file SMESHGUI_FilterDlg.cxx.

{
  double retval = 0;
  if ( myWidgets.contains( theId ) ) {
    if ( qobject_cast<QLineEdit*>( myWidgets[ theId ] ) )
      retval = qobject_cast<QLineEdit*>( myWidgets[ theId ] )->text().toDouble();
    if ( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] ) )
      retval = qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] )->GetValue();
  }
  return retval;
}
int SMESHGUI_FilterTable::AdditionalWidget::GetInteger ( const int  theId) const [virtual]

Definition at line 244 of file SMESHGUI_FilterDlg.cxx.

{
  int retval = 0;
  if ( myWidgets.contains( theId ) ) {
    if ( qobject_cast<QLineEdit*>( myWidgets[ theId ] ) )
      retval = qobject_cast<QLineEdit*>( myWidgets[ theId ] )->text().toInt();
    if ( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] ) )
      retval = (int)( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] )->GetValue() );
  }
  return retval;
}

Definition at line 198 of file SMESHGUI_FilterDlg.cxx.

{
  QList<int> theList;
  theList.append(Tolerance);
  return theList;
}
QString SMESHGUI_FilterTable::AdditionalWidget::GetString ( const int  theId) const [virtual]

Definition at line 256 of file SMESHGUI_FilterDlg.cxx.

{
  QString retval = "";
  if ( myWidgets.contains( theId ) ) {
    if ( qobject_cast<QLineEdit*>( myWidgets[ theId ] ) )
      retval = qobject_cast<QLineEdit*>( myWidgets[ theId ] )->text();
    if ( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] ) )
      retval = QString::number( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] )->GetValue() );
  }
  return retval;
}
bool SMESHGUI_FilterTable::AdditionalWidget::IsValid ( const bool  theMsg = true) const [virtual]

Definition at line 205 of file SMESHGUI_FilterDlg.cxx.

{
  if (!isEnabled())
    return true;

  QList<int> aParams = GetParameters();
  QList<int>::const_iterator anIter;
  for (anIter = aParams.begin(); anIter != aParams.end(); ++anIter) {
    if ( !myWidgets.contains( *anIter ) ) continue;
    bool valid = true;
    if ( qobject_cast<QLineEdit*>( myWidgets[ *anIter ] ) ) {
      valid = qobject_cast<QLineEdit*>( myWidgets[ *anIter ] )->hasAcceptableInput();
    }
    else if ( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ *anIter ] ) ) {
      QString foo;
      valid = qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ *anIter ] )->isValid( foo, false );
    }
    if (!valid && theMsg) {
      SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
                                   tr("SMESHGUI_INVALID_PARAMETERS"));
      return false;
    }
  }

  return true;
}
void SMESHGUI_FilterTable::AdditionalWidget::SetDouble ( const int  theId,
const double  theVal 
) [virtual]

Definition at line 268 of file SMESHGUI_FilterDlg.cxx.

{
  if ( myWidgets.contains( theId ) ) {
    if ( qobject_cast<QLineEdit*>( myWidgets[ theId ] ) )
      qobject_cast<QLineEdit*>( myWidgets[ theId ] )->setText( QString::number( theVal ) );
    if ( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] ) )
      qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] )->SetValue( theVal );
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMESHGUI_FilterTable::AdditionalWidget::SetEditable ( const int  theId,
const bool  isEditable 
)

Definition at line 298 of file SMESHGUI_FilterDlg.cxx.

{
  if ( myWidgets.contains( theId ) ) {
    if ( qobject_cast<QLineEdit*>( myWidgets[ theId ] ) )
      qobject_cast<QLineEdit*>( myWidgets[ theId ] )->setReadOnly( !isEditable );
    if ( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] ) )
      qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] )->setReadOnly( !isEditable );
  }
}
void SMESHGUI_FilterTable::AdditionalWidget::SetEditable ( const bool  isEditable)

Definition at line 308 of file SMESHGUI_FilterDlg.cxx.

{
  QList<int> aParams = GetParameters();
  QList<int>::const_iterator anIter;
  for (anIter = aParams.begin(); anIter != aParams.end(); ++anIter)
    SetEditable( *anIter,  isEditable );
}
void SMESHGUI_FilterTable::AdditionalWidget::SetInteger ( const int  theId,
const int  theVal 
) [virtual]

Definition at line 278 of file SMESHGUI_FilterDlg.cxx.

{
  if ( myWidgets.contains( theId ) ) {
    if ( qobject_cast<QLineEdit*>( myWidgets[ theId ] ) )
      qobject_cast<QLineEdit*>( myWidgets[ theId ] )->setText( QString::number( theVal ) );
    if ( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] ) )
      qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] )->SetValue( (double)theVal );
  }
}

Here is the call graph for this function:

void SMESHGUI_FilterTable::AdditionalWidget::SetPrecision ( const int  theId,
const char *  precision = 0 
)

Definition at line 316 of file SMESHGUI_FilterDlg.cxx.

{
  if ( myWidgets.contains( theId ) ) {
    if ( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] ) ) {
      SMESHGUI_SpinBox* sb = qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] );
      double val = sb->GetValue();
      double min = pow(10.0, -(sb->decimals()));
      sb->RangeStepAndValidator( 0., 1.e20, 0.1, precision ? precision : "len_tol_precision" );
      sb->SetValue( qMax( val, min ) );
    }
  }
}
void SMESHGUI_FilterTable::AdditionalWidget::SetString ( const int  theId,
const QString &  theVal 
) [virtual]

Definition at line 288 of file SMESHGUI_FilterDlg.cxx.

{
  if ( myWidgets.contains( theId ) ) {
    if ( qobject_cast<QLineEdit*>( myWidgets[ theId ] ) )
      qobject_cast<QLineEdit*>( myWidgets[ theId ] )->setText( theVal );
    if ( qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] ) )
      qobject_cast<SMESHGUI_SpinBox*>( myWidgets[ theId ] )->SetValue( theVal.toDouble() );
  }
}

Here is the call graph for this function:


Member Data Documentation

QMap< int, QWidget* > SMESHGUI_FilterTable::AdditionalWidget::myWidgets [private]

Definition at line 169 of file SMESHGUI_FilterDlg.cxx.


The documentation for this class was generated from the following file: