12#ifndef NUMERIC_VALUE_CHOOSER_DELEGATE_H_
13#define NUMERIC_VALUE_CHOOSER_DELEGATE_H_
16#include <QStyledItemDelegate>
61 QWidget *
createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const;
68 void setEditorData(QWidget *editor,
const QModelIndex &index)
const;
76 void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index)
const;
96 void onValueChanged(
int i);
A delegate for choosing numeric values within a specified range in item views.
Definition numeric_value_chooser_delegate.h:22
void setEditorData(QWidget *editor, const QModelIndex &index) const
Sets the data to be displayed in the editor widget.
Definition numeric_value_chooser_delegate.cpp:63
void setMinMaxRange(int min, int max)
Sets the minimum and maximum allowed range for the chooser.
Definition numeric_value_chooser_delegate.cpp:30
~NumericValueChooserDelegate()
Destroys the NumericValueChooserDelegate object.
Definition numeric_value_chooser_delegate.cpp:26
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Saves the data from the editor widget back into the model.
Definition numeric_value_chooser_delegate.cpp:79
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Creates the editor widget for the item.
Definition numeric_value_chooser_delegate.cpp:46
void setDefaultValue(int defValue, QVariant defaultReturn)
Sets the default value and the default return variant.
Definition numeric_value_chooser_delegate.cpp:39