Subversion Repositories svn1-original

Rev

Rev 111 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 111 Rev 114
Line 50... Line 50...
50
 
50
 
51
#include "spinboxdelegate.h"
51
#include "spinboxdelegate.h"
52
 
52
 
53
 
53
 
54
//! [0]
54
//! [0]
55
SpinBoxDelegate::SpinBoxDelegate(QObject *parent)
55
SpinBoxDelegate::SpinBoxDelegate(int minvalue, int maxvalue, QObject *parent)
56
    : QItemDelegate(parent)
56
    : QItemDelegate(parent)
57
{
57
{
-
 
58
    min_value = minvalue;
-
 
59
    max_value = maxvalue;
58
}
60
}
59
//! [0]
61
//! [0]
60
 
62
 
61
//! [1]
63
//! [1]
62
QWidget *SpinBoxDelegate::createEditor(QWidget *parent,
64
QWidget *SpinBoxDelegate::createEditor(QWidget *parent,
63
    const QStyleOptionViewItem &/* option */,
65
    const QStyleOptionViewItem &/* option */,
64
    const QModelIndex &/* index */) const
66
    const QModelIndex &/* index */) const
65
{
67
{
66
    QSpinBox *editor = new QSpinBox(parent);
68
    QSpinBox *editor = new QSpinBox(parent);
67
    editor->setMinimum(0);
69
    editor->setMinimum(min_value);
68
    editor->setMaximum(100);
70
    editor->setMaximum(max_value);
69
 
71
 
70
    return editor;
72
    return editor;
71
}
73
}
72
//! [1]
74
//! [1]
73
 
75