All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
GeopsyGui::AsciiSignalComponentDelegate Class Reference

List of all members.

Public Member Functions

 AsciiSignalComponentDelegate (QObject *parent=0)
QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
void setEditorData (QWidget *editor, const QModelIndex &index) const
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const

Constructor & Destructor Documentation

: QItemDelegate(parent) {}

Member Function Documentation

QWidget * GeopsyGui::AsciiSignalComponentDelegate::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const

References QGpCoreTools::tr(), TRACE, and w.

{
  TRACE;
  if(index.column()==0) {
    QLineEdit * w=new QLineEdit(parent);
    return w;
  } else {
    QComboBox * w=new QComboBox(parent);
    w->addItem(tr( "Vertical" ));
    w->addItem(tr( "North" ));
    w->addItem(tr( "East" ));
    w->addItem(tr( "Horizontal" ));
    w->addItem(tr( "All" ));
    w->addItem(tr( "Undefined" ));
    return w;
  }
}
void GeopsyGui::AsciiSignalComponentDelegate::setEditorData ( QWidget *  editor,
const QModelIndex &  index 
) const

References TRACE, and w.

{
  TRACE;
  if(index.column()==0) {
    QLineEdit * w= qobject_cast<QLineEdit *>(editor);
    if( !w) return;
    w->setText(index.model() ->data(index).toString());
    w->selectAll();
  } else {
    QComboBox * w=qobject_cast<QComboBox *>(editor);
    if( !w) return;
    int pos=w->findText(index.model() ->data(index).toString(), Qt::MatchExactly);
    w->setCurrentIndex(pos);
  }
}
void GeopsyGui::AsciiSignalComponentDelegate::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const

References TRACE, and w.

{
  TRACE;
  if(index.column()==0) {
    QLineEdit * w=qobject_cast<QLineEdit *>(editor);
    if( !w) return;
    model->setData(index, w->text());
  } else {
    QComboBox * w=qobject_cast<QComboBox *>(editor);
    if( !w) return;
    model->setData(index, w->currentText());
  }
}

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines