NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
IntNumericDelegate Class Reference

The IntNumericDelegate class provides a spin box editor for integer numeric data in a view. More...

#include <intnumericdelegate.h>

Inheritance diagram for IntNumericDelegate:

Public Member Functions

 IntNumericDelegate (QWidget *parent=nullptr, int maxValue=1000000000, int minValue=-1000000000, int stepSize=1, int value=0)
 Constructor for the IntNumericDelegate class.
 
QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Creates an editor widget for the given parent, style option, and model index.
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 Sets the model data based on the data of the editor widget.
 

Detailed Description

The IntNumericDelegate class provides a spin box editor for integer numeric data in a view.

Constructor & Destructor Documentation

◆ IntNumericDelegate()

IntNumericDelegate::IntNumericDelegate ( QWidget *  parent = nullptr,
int  maxValue = 1000000000,
int  minValue = -1000000000,
int  stepSize = 1,
int  value = 0 
)
inline

Constructor for the IntNumericDelegate class.

Parameters
parentThe parent widget.
maxValueThe maximum value for the spin box.
minValueThe minimum value for the spin box.
stepSizeThe step size for the spin box.

Member Function Documentation

◆ createEditor()

QWidget * IntNumericDelegate::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
inlineoverride

Creates an editor widget for the given parent, style option, and model index.

Parameters
parentThe parent widget.
optionThe style options for the item.
indexThe model index of the item.
Returns
The created editor widget.

◆ setModelData()

void IntNumericDelegate::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const
inlineoverride

Sets the model data based on the data of the editor widget.

Parameters
editorThe editor widget.
modelThe abstract item model.
indexThe model index of the item.