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

Public Member Functions | |
| SpinBoxDelegate (StdMeshersGUI_DistrTableFrame::Table *) | |
| ~SpinBoxDelegate () | |
| QWidget * | createEditor (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::Table * | myTable |
Custom item delegate (uses double spin box to edit table item)
Definition at line 83 of file StdMeshersGUI_DistrTable.cxx.
| 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.
{
}
| QWidget * StdMeshersGUI_DistrTableFrame.SpinBoxDelegate::createEditor | ( | QWidget * | parent, |
| const QStyleOptionViewItem & | , | ||
| const QModelIndex & | index | ||
| ) | const |
Definition at line 178 of file StdMeshersGUI_DistrTable.cxx.
References StdMeshersGUI_DistrTableFrame.ArgColumn, StdMeshersGUI_DistrTableFrame.Table.argMaximum(), StdMeshersGUI_DistrTableFrame.Table.argMinimum(), StdMeshersGUI_DistrTableFrame.Table.argStep(), StdMeshersGUI_DistrTableFrame.Table.funcMaximum(), StdMeshersGUI_DistrTableFrame.Table.funcMinimum(), StdMeshersGUI_DistrTableFrame.Table.funcStep(), StdMeshersGUI_DistrTableFrame.myTable, SMESHGUI_SpinBox.RangeStepAndValidator(), and StdMeshersGUI_DistrTableFrame.Table.setEditor().
{
SMESHGUI_SpinBox* sb = new SMESHGUI_SpinBox( parent );
sb->setAcceptNames(false); // No Notebook variables allowed
double aMin = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ?
myTable->argMinimum( index.row() ) :
myTable->funcMinimum( index.row() );
double aMax = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ?
myTable->argMaximum( index.row() ) :
myTable->funcMaximum( index.row() );
double aStep = index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ?
myTable->argStep( index.row() ) :
myTable->funcStep( index.row() );
sb->RangeStepAndValidator( aMin, aMax, aStep, "parametric_precision" );
sb->setFrame(false);
myTable->setEditor( index.row(), index.column(), sb );
return sb;
}
| 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 );
}
StdMeshersGUI_DistrTableFrame::Table* StdMeshersGUI_DistrTableFrame.SpinBoxDelegate.myTable [private] |
Definition at line 100 of file StdMeshersGUI_DistrTable.cxx.