Brief description of class still missing. More...
#include <DistanceDelegate.h>
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) |
Brief description of class still missing.
Full description of class still missing
DistanceDelegate::DistanceDelegate | ( | QObject * | parent | ) |
QWidget * DistanceDelegate::createEditor | ( | QWidget * | parent, |
const QStyleOptionViewItem & | , | ||
const QModelIndex & | index | ||
) | const |
{ 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 |
{ 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 |
void DistanceDelegate::setNames | ( | const QStringList & | n | ) | [inline] |
Referenced by DistanceWidget::setStations().
{_names=n;}