Allows a list model to determine the editor for a field.
More...
#include <CommonItemDelegate.h>
|
enum | EItemDataRole : int {
TypeRole = Qt::ItemDataRole::UserRole
, OptionsRole
, MinimumRole
, MaximumRole
,
IncrementRole
, TextColorRole
, AlignmentRole
} |
| Extension on the Qt::ItemDataRole enumerate. More...
|
|
enum | EEditorType {
etDefault
, etTextEdit
, etDropDown
, etDropDownIndex
,
etDropDownEdit
, etDropDownFlags
, etShortcut
, etSpinBox
,
etDoubleSpinBox
, etULongLong
, etColorEdit
, etStringList
,
etString
} |
| Possible inline editors for a column in the list model. More...
|
|
typedef QList< QPair< QVariant, QString > > | OptionsType |
| Type for the named options available in case of a dropdown.
|
|
|
Q_SIGNAL void | addLineEditActions (QLineEdit *lineEdit, const QModelIndex &index) const |
| Signal allowing adding actions to a line edit.
|
|
| CommonItemDelegate (QObject *parent=nullptr) |
| Constructor.
|
|
QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| Overridden from base class.
|
|
void | setEditorData (QWidget *editor, const QModelIndex &index) const override |
| Overridden from base class.
|
|
void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override |
| Overridden from base class.
|
|
void | updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| Overridden from base class.
|
|
void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| Overridden from base class.
|
|
Allows a list model to determine the editor for a field.
◆ OptionsType
Type for the named options available in case of a dropdown.
◆ EEditorType
Possible inline editors for a column in the list model.
Enumerator |
---|
etDefault | |
etTextEdit | |
etDropDown | |
etDropDownIndex | |
etDropDownEdit | |
etDropDownFlags | |
etShortcut | |
etSpinBox | |
etDoubleSpinBox | |
etULongLong | |
etColorEdit | |
etStringList | |
etString | |
◆ EItemDataRole
Extension on the Qt::ItemDataRole enumerate.
Enumerator |
---|
TypeRole | Type of editor from the model.
|
OptionsRole | For retrieving the options list for a dropdown edit.
|
MinimumRole | Minimum for scalar value e.g. a spin box.
|
MaximumRole | Maximum for scalar value e.g. a spin box.
|
IncrementRole | Increment for scalar value e.g. a spin box.
|
TextColorRole | Determines the text color of the text. Can be a QColor or QPalette::ColorRole (integer) type.
|
AlignmentRole | Determines how the item should be aligned. using
|
◆ CommonItemDelegate()
sf::CommonItemDelegate::CommonItemDelegate |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
◆ addLineEditActions()
Q_SIGNAL void sf::CommonItemDelegate::addLineEditActions |
( |
QLineEdit * |
lineEdit, |
|
|
const QModelIndex & |
index |
|
) |
| const |
Signal allowing adding actions to a line edit.
- Parameters
-
lineEdit | Line edit in question. |
index | Index of the edited item. |
◆ createEditor()
QWidget * sf::CommonItemDelegate::createEditor |
( |
QWidget * |
parent, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Overridden from base class.
◆ getEditorType()
static EEditorType sf::CommonItemDelegate::getEditorType |
( |
const QModelIndex & |
index | ) |
|
|
static |
Gets the editor type by calling the modal data() method with TypeRole.
- Parameters
-
index | Model-index of the field to get the editor type for. |
- Returns
- Type of the editor.
◆ paint()
void sf::CommonItemDelegate::paint |
( |
QPainter * |
painter, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Overridden from base class.
◆ setEditorData()
void sf::CommonItemDelegate::setEditorData |
( |
QWidget * |
editor, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Overridden from base class.
◆ setModelData()
void sf::CommonItemDelegate::setModelData |
( |
QWidget * |
editor, |
|
|
QAbstractItemModel * |
model, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Overridden from base class.
◆ updateEditorGeometry()
void sf::CommonItemDelegate::updateEditorGeometry |
( |
QWidget * |
editor, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Overridden from base class.
The documentation for this class was generated from the following file: