Version: 6.3.1
Public Member Functions | Private Attributes

StdMeshersGUI_DistrTableFrame.SpinBoxDelegate Class Reference

Custom item delegate (uses double spin box to edit table item) More...

Inheritance diagram for StdMeshersGUI_DistrTableFrame.SpinBoxDelegate:
Inheritance graph
[legend]

Public Member Functions

 SpinBoxDelegate (StdMeshersGUI_DistrTableFrame::Table *)
 ~SpinBoxDelegate ()
QWidgetcreateEditor (QWidget *, const QStyleOptionViewItem &, const QModelIndex &) const
void setEditorData (QWidget *, const QModelIndex &) const
void setModelData (QWidget *, QAbstractItemModel *, const QModelIndex &) const
void updateEditorGeometry (QWidget *, const QStyleOptionViewItem &, const QModelIndex &) const

Private Attributes

StdMeshersGUI_DistrTableFrame::TablemyTable

Detailed Description

Custom item delegate (uses double spin box to edit table item)

Definition at line 83 of file StdMeshersGUI_DistrTable.cxx.


Constructor & Destructor Documentation

StdMeshersGUI_DistrTableFrame.SpinBoxDelegate::SpinBoxDelegate ( StdMeshersGUI_DistrTableFrame::Table parent)

Definition at line 166 of file StdMeshersGUI_DistrTable.cxx.

  : QItemDelegate( parent ), myTable( parent )
{
}
StdMeshersGUI_DistrTableFrame.SpinBoxDelegate::~SpinBoxDelegate ( )

Definition at line 172 of file StdMeshersGUI_DistrTable.cxx.

{
}

Member Function Documentation

QWidget * StdMeshersGUI_DistrTableFrame.SpinBoxDelegate::createEditor ( QWidget parent,
const QStyleOptionViewItem &  ,
const QModelIndex &  index 
) const
void StdMeshersGUI_DistrTableFrame.SpinBoxDelegate::setEditorData ( QWidget editor,
const QModelIndex &  index 
) const

Definition at line 203 of file StdMeshersGUI_DistrTable.cxx.

{
  QString value = index.model()->data(index, Qt::DisplayRole).toString();
  SMESHGUI_SpinBox* sb = static_cast<SMESHGUI_SpinBox*>(editor);

  bool bOk = false;
  double v = value.toDouble( &bOk );
  if ( !bOk ) v = sb->minimum();

  sb->setValue( v );
}
void StdMeshersGUI_DistrTableFrame.SpinBoxDelegate::setModelData ( QWidget editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const

Definition at line 217 of file StdMeshersGUI_DistrTable.cxx.

{
  SMESHGUI_SpinBox* sb = static_cast<SMESHGUI_SpinBox*>(editor);
  model->setData( index, QString::number( sb->value() ), Qt::DisplayRole );
}
void StdMeshersGUI_DistrTableFrame.SpinBoxDelegate::updateEditorGeometry ( QWidget editor,
const QStyleOptionViewItem &  option,
const QModelIndex &   
) const

Definition at line 226 of file StdMeshersGUI_DistrTable.cxx.

{
  editor->setGeometry( option.rect );
}

Field Documentation

Definition at line 100 of file StdMeshersGUI_DistrTable.cxx.

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