Version: 6.3.1
Data Structures | Public Types | Signals | Public Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes

StdMeshersGUI_DistrTableFrame Class Reference

Distribution table widget. More...

#include <StdMeshersGUI_DistrTable.h>

Inheritance diagram for StdMeshersGUI_DistrTableFrame:
Inheritance graph
[legend]

Data Structures

class  SpinBoxDelegate
 Custom item delegate (uses double spin box to edit table item) More...
class  Table
 Table function widget. More...

Public Types

enum  TableButton { InsertRowBtn, RemoveRowBtn }

Signals

void valueChanged (int, int)
void currentChanged (int, int)

Public Member Functions

 StdMeshersGUI_DistrTableFrame (QWidget *=0)
 ~StdMeshersGUI_DistrTableFrame ()
void showButton (const TableButton, const bool)
bool isButtonShown (const TableButton) const
void data (DataArray &) const
void setData (const DataArray &)
void setFuncMinValue (double)

Private Types

enum  { ArgColumn, FuncColumn }
typedef SMESH::double_array DataArray

Private Slots

void onInsert ()
void onRemove ()

Private Member Functions

QPushButton * button (const TableButton) const

Private Attributes

QMap< int, QPushButton * > myButtons
TablemyTable

Detailed Description

Distribution table widget.

Definition at line 43 of file StdMeshersGUI_DistrTable.h.


Member Typedef Documentation

Definition at line 50 of file StdMeshersGUI_DistrTable.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
ArgColumn 
FuncColumn 

Definition at line 47 of file StdMeshersGUI_DistrTable.h.

Enumerator:
InsertRowBtn 
RemoveRowBtn 

Definition at line 55 of file StdMeshersGUI_DistrTable.h.


Constructor & Destructor Documentation

StdMeshersGUI_DistrTableFrame::StdMeshersGUI_DistrTableFrame ( QWidget parent = 0)

Definition at line 510 of file StdMeshersGUI_DistrTable.cxx.

References currentChanged(), InsertRowBtn, main(), myButtons, myTable, onInsert(), onRemove(), RemoveRowBtn, SPACING, and valueChanged().

  : QWidget( parent )
{
  QGridLayout* main = new QGridLayout( this );
  main->setMargin( 0 );
  main->setSpacing( 0 );

  // ---
  myTable = new Table( this );
  connect( myTable, SIGNAL( valueChanged( int, int ) ), this, SIGNAL( valueChanged( int, int ) ) );

  myButtons[ InsertRowBtn ] = new QPushButton( tr( "SMESH_INSERT_ROW" ), this );
  myButtons[ RemoveRowBtn ] = new QPushButton( tr( "SMESH_REMOVE_ROW" ), this );


  // ---
  main->addWidget( myTable , 0, 0, 1, 3);
  main->addWidget( myButtons[ InsertRowBtn ] , 1, 0);
  main->addWidget( myButtons[ RemoveRowBtn ] , 1, 1);
  main->setColumnStretch(2, 1);
  main->setSpacing( SPACING );
  
  // ---
  connect( myButtons[ InsertRowBtn ], SIGNAL( clicked() ), this, SLOT( onInsert() ) );
  connect( myButtons[ RemoveRowBtn ], SIGNAL( clicked() ), this, SLOT( onRemove() ) );
  connect( myTable, SIGNAL( currentCellChanged( int, int, int, int ) ),
           this,    SIGNAL( currentChanged( int, int ) ) );
  connect( myTable, SIGNAL( cellChanged( int, int ) ),
           this,    SIGNAL( valueChanged( int, int ) ) );
}
StdMeshersGUI_DistrTableFrame::~StdMeshersGUI_DistrTableFrame ( )

Definition at line 542 of file StdMeshersGUI_DistrTable.cxx.

{
}

Member Function Documentation

QPushButton * StdMeshersGUI_DistrTableFrame::button ( const TableButton  b) const [private]

Definition at line 593 of file StdMeshersGUI_DistrTable.cxx.

References myButtons.

Referenced by isButtonShown(), and showButton().

{
  return myButtons.contains( b ) ? myButtons[ b ] : 0;
}
void StdMeshersGUI_DistrTableFrame.currentChanged ( int  ,
int   
) [signal]
void StdMeshersGUI_DistrTableFrame::data ( DataArray array) const

Definition at line 562 of file StdMeshersGUI_DistrTable.cxx.

References ex13_hole1partial.d, StdMeshersGUI_DistrTableFrame.Table.data(), myTable, and sortData().

Referenced by StdMeshersGUI_NbSegmentsCreator.onValueChanged(), and StdMeshersGUI_NbSegmentsCreator.readParamsFromWidgets().

{
  QList<double> d = myTable->data();
  sortData( d );

  array.length( d.count() );
  for ( int i = 0; i < d.count(); i++ )
    array[i] = d[i];
}
bool StdMeshersGUI_DistrTableFrame::isButtonShown ( const TableButton  b) const

Definition at line 555 of file StdMeshersGUI_DistrTable.cxx.

References button().

{
  return button( b ) ? button( b )->isVisible() : false;
}
void StdMeshersGUI_DistrTableFrame::onInsert ( ) [private, slot]
void StdMeshersGUI_DistrTableFrame::onRemove ( ) [private, slot]
void StdMeshersGUI_DistrTableFrame::setData ( const DataArray array)

Definition at line 574 of file StdMeshersGUI_DistrTable.cxx.

References ex13_hole1partial.d, myTable, StdMeshersGUI_DistrTableFrame.Table.setData(), and sortData().

Referenced by StdMeshersGUI_NbSegmentsCreator.onValueChanged(), and StdMeshersGUI_NbSegmentsCreator.retrieveParams().

{
  QList<double> d;
  for ( int i = 0; i < array.length(); i++ )
    d.append( array[i] );

  sortData( d );
  myTable->setData( d );
}
void StdMeshersGUI_DistrTableFrame::setFuncMinValue ( double  v)
void StdMeshersGUI_DistrTableFrame::showButton ( const TableButton  b,
const bool  on 
)

Definition at line 548 of file StdMeshersGUI_DistrTable.cxx.

References button().

{
  if ( button( b ) ) button( b )->setVisible( on );
}
void StdMeshersGUI_DistrTableFrame.valueChanged ( int  ,
int   
) [signal]

Field Documentation

QMap<int, QPushButton*> StdMeshersGUI_DistrTableFrame.myButtons [private]

Definition at line 80 of file StdMeshersGUI_DistrTable.h.

Referenced by button(), and StdMeshersGUI_DistrTableFrame().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS