4,15 → 4,16 |
a copyright and/or license notice that predates the release of Scribus 1.3.2 |
for which a new license (GPL+exception) is in place. |
*/ |
#include <QDoubleSpinBox> |
#include <QModelIndex> |
|
#include "scrspinbox.h" |
#include "scribusdoc.h" |
#include "guidesdelegate.h" |
|
|
GuidesDelegate::GuidesDelegate(QObject *parent) |
: QItemDelegate(parent), |
m_docUnitDecimals(0) |
m_doc(0) |
{ |
} |
|
20,9 → 21,7 |
const QStyleOptionViewItem &/* option */, |
const QModelIndex &/* index */) const |
{ |
QDoubleSpinBox *editor = new QDoubleSpinBox(parent); |
editor->setRange(0, 1000); |
editor->setDecimals(m_docUnitDecimals); |
ScrSpinBox *editor = new ScrSpinBox(0, 1000, parent, m_doc?m_doc->unitIndex():0); |
return editor; |
} |
|
30,7 → 29,7 |
const QModelIndex &index) const |
{ |
double value = index.model()->data(index, Qt::DisplayRole).toDouble(); |
QDoubleSpinBox *w = static_cast<QDoubleSpinBox*>(editor); |
ScrSpinBox *w = static_cast<ScrSpinBox*>(editor); |
w->setValue(value); |
} |
|
38,7 → 37,7 |
QAbstractItemModel *model, |
const QModelIndex &index) const |
{ |
QDoubleSpinBox *w = static_cast<QDoubleSpinBox*>(editor); |
ScrSpinBox *w = static_cast<ScrSpinBox*>(editor); |
w->interpretText(); |
double value = w->value(); |
model->setData(index, value); |
51,7 → 50,7 |
editor->setGeometry(option.rect); |
} |
|
void GuidesDelegate::unitChange(int docUnitDecimals) |
void GuidesDelegate::setDoc(ScribusDoc * doc) |
{ |
m_docUnitDecimals = docUnitDecimals; |
m_doc = doc; |
} |