34 lines
1007 B
C++
34 lines
1007 B
C++
#ifndef ITEMNUMBERDELEGATE_H
|
|
#define ITEMNUMBERDELEGATE_H
|
|
|
|
#include <QItemDelegate>
|
|
#include <QWidget>
|
|
|
|
class ItemNumberDelegate : public QItemDelegate
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
ItemNumberDelegate(double min = 0.00,
|
|
double max = 999999999.99,
|
|
double step = 0.1,
|
|
int precision = 2,
|
|
QObject *parent = Q_NULLPTR);
|
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
|
const QModelIndex &index) const;
|
|
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
|
void setModelData (QWidget *editor, QAbstractItemModel *model,
|
|
const QModelIndex &index) const;
|
|
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &opcion,
|
|
const QModelIndex &index) const;
|
|
private:
|
|
|
|
double m_min;
|
|
double m_max;
|
|
double m_step;
|
|
int m_precision;
|
|
};
|
|
|
|
#endif // ITEMNUMBERDELEGATE_H
|
|
|