59 EventDelegate::EventDelegate(QObject *parent)
60 : QItemDelegate(parent)
68 const QStyleOptionViewItem &,
69 const QModelIndex & index)
const
73 switch(index.column()) {
75 QSpinBox *editor =
new QSpinBox(parent);
76 editor->setMinimum(0);
82 QDoubleSpinBox *editor =
new QDoubleSpinBox(parent);
83 editor->setMinimum(0.0);
85 editor->setSingleStep(0.01);
90 QComboBox *editor =
new QComboBox(parent);
96 QWidget *returnWidget =
new QWidget();
103 void EventDelegate::setEditorData(QWidget *editor,
const QModelIndex &index)
const
105 switch(index.column()) {
107 int value = index.model()->data(index, Qt::DisplayRole).toInt();
108 QSpinBox *spinBox =
static_cast<QSpinBox*
>(editor);
109 spinBox->setValue(value);
114 double value = index.model()->data(index, Qt::DisplayRole).toDouble();
115 QDoubleSpinBox *spinBox =
static_cast<QDoubleSpinBox*
>(editor);
116 spinBox->setValue(value);
121 int value = index.model()->data(index, Qt::DisplayRole).toInt();
122 QComboBox *spinBox =
static_cast<QComboBox*
>(editor);
123 spinBox->setCurrentText(QString().number(value));
132 void EventDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
133 const QModelIndex &index)
const
135 switch(index.column()) {
137 QSpinBox *spinBox =
static_cast<QSpinBox*
>(editor);
138 spinBox->interpretText();
139 int value = spinBox->value();
141 model->setData(index, value, Qt::EditRole);
146 QDoubleSpinBox *spinBox =
static_cast<QDoubleSpinBox*
>(editor);
147 spinBox->interpretText();
148 double value = spinBox->value();
150 model->setData(index, value, Qt::EditRole);
155 QComboBox *spinBox =
static_cast<QComboBox*
>(editor);
156 QString value = spinBox->currentText();
158 model->setData(index, value.toInt(), Qt::EditRole);
167 void EventDelegate::updateEditorGeometry(QWidget *editor,
168 const QStyleOptionViewItem &option,
const QModelIndex &)
const
170 editor->setGeometry(option.rect);
QStringList getEventTypeList() const
Contains the declaration of the EventDelegate class.
QPair< int, int > getFirstLastSample() const
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
FiffInfo getFiffInfo() const