mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add step size in our SpinBox delegates
For the Set point spinbox, it was kinda hard just stepping by the default 1.0, so setting it to step by 0.1 makes much more sense. The int SpinBox got a step size parameter for consistency. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6008d08557
commit
c4981f28a6
3 changed files with 16 additions and 10 deletions
|
@ -365,10 +365,11 @@ void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||
QStyledItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
|
||||
SpinBoxDelegate::SpinBoxDelegate(int min, int max, QObject *parent):
|
||||
SpinBoxDelegate::SpinBoxDelegate(int min, int max, int step, QObject *parent):
|
||||
QStyledItemDelegate(parent),
|
||||
min(min),
|
||||
max(max)
|
||||
max(max),
|
||||
step(step)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -376,13 +377,15 @@ QWidget *SpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewIt
|
|||
{
|
||||
QSpinBox *w = qobject_cast<QSpinBox*>(QStyledItemDelegate::createEditor(parent, option, index));
|
||||
w->setRange(min,max);
|
||||
w->setSingleStep(step);
|
||||
return w;
|
||||
}
|
||||
|
||||
DoubleSpinBoxDelegate::DoubleSpinBoxDelegate(double min, double max, QObject *parent):
|
||||
DoubleSpinBoxDelegate::DoubleSpinBoxDelegate(double min, double max, double step, QObject *parent):
|
||||
QStyledItemDelegate(parent),
|
||||
min(min),
|
||||
max(max)
|
||||
max(max),
|
||||
step(step)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -390,5 +393,6 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
|
|||
{
|
||||
QDoubleSpinBox *w = qobject_cast<QDoubleSpinBox*>(QStyledItemDelegate::createEditor(parent, option, index));
|
||||
w->setRange(min,max);
|
||||
w->setSingleStep(step);
|
||||
return w;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue