Public Member Functions
DistanceDelegate Class Reference

Brief description of class still missing. More...

#include <DistanceDelegate.h>

List of all members.

Public Member Functions

QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const
 DistanceDelegate (QObject *parent)
bool editingValue () const
void setEditorData (QWidget *editor, const QModelIndex &index) const
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
void setNames (const QStringList &n)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

DistanceDelegate::DistanceDelegate ( QObject *  parent)

References TRACE.

  : QItemDelegate(parent)
{
  TRACE;
  _editingValue=0;
}

Member Function Documentation

QWidget * DistanceDelegate::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  ,
const QModelIndex &  index 
) const

References TRACE, and w.

{
  TRACE;
  switch (index.column()) {
  case 0:
  case 1: {
      QComboBox * w=new QComboBox(parent);
      w->addItems(_names);
      w->setEditable(true);
      return w;
    }
  default: {
      QDoubleSpinBox * w=new QDoubleSpinBox(parent);
      w->setMinimum(0.0);
      w->setMaximum(1e99);
      w->setSuffix(" m");
      w->setDecimals(3);
      w->setSingleStep(0.01);
      _editingValue++;
      connect(w, SIGNAL(destroyed()), this, SLOT(valueEditorDestroyed()));
      connect(w, SIGNAL(valueChanged(double)), this, SLOT(valueChanged()));
      return w;
    }
  }
  return 0;
}
bool DistanceDelegate::editingValue ( ) const [inline]

Referenced by DistanceWidget::eventFilter().

{return _editingValue>0;}
void DistanceDelegate::setEditorData ( QWidget *  editor,
const QModelIndex &  index 
) const

References TRACE, and w.

{
  TRACE;
  switch (index.column()) {
  case 0:
  case 1: {
      QComboBox * w=qobject_cast<QComboBox *>(editor);
      ASSERT(w);
      w->setEditText(index.model()->data(index).toString());
      break;
    }
  default: {
      QDoubleSpinBox * w=qobject_cast<QDoubleSpinBox *>(editor);
      ASSERT(w);
      w->setValue(index.model()->data(index).toDouble());
      break;
    }
  }
}
void DistanceDelegate::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const

References TRACE, and w.

{
  TRACE;
  switch (index.column()) {
  case 0:
  case 1: {
      QComboBox * w=qobject_cast<QComboBox *>(editor);
      ASSERT(w);
      model->setData(index, w->currentText());
      break;
    }
  default: {
      QDoubleSpinBox * w=qobject_cast<QDoubleSpinBox *>(editor);
      ASSERT(w);
      model->setData(index, w->value());
      break;
    }
  }
}
void DistanceDelegate::setNames ( const QStringList &  n) [inline]

Referenced by DistanceWidget::setStations().

{_names=n;}

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