本文整理汇总了C++中QDoubleSpinBox::interpretText方法的典型用法代码示例。如果您正苦于以下问题:C++ QDoubleSpinBox::interpretText方法的具体用法?C++ QDoubleSpinBox::interpretText怎么用?C++ QDoubleSpinBox::interpretText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDoubleSpinBox
的用法示例。
在下文中一共展示了QDoubleSpinBox::interpretText方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setModelData
void EventDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
switch(index.column()) {
case 0: {
QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
spinBox->interpretText();
int value = spinBox->value();
model->setData(index, value, Qt::EditRole);
break;
}
case 1: {
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
spinBox->interpretText();
double value = spinBox->value();
model->setData(index, value, Qt::EditRole);
break;
}
case 2: {
QComboBox *spinBox = static_cast<QComboBox*>(editor);
QString value = spinBox->currentText();
model->setData(index, value.toInt(), Qt::EditRole);
break;
}
}
}
示例2:
void
ConfigurationDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
QDoubleSpinBox* doubleSpinBox = static_cast<QDoubleSpinBox*>(editor);
doubleSpinBox->interpretText();
model->setData(index, doubleSpinBox->value(), Qt::EditRole);
}
示例3: setModelData
void LoanAssumptionDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
if (!index.data(Qt::UserRole).isNull()) {
switch (index.data(Qt::UserRole).toInt()) {
case static_cast<qint8>(AssumptionType::DoubleAssumption) :
case static_cast<qint8>(AssumptionType::DoubleAssumption0To100) : {
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
spinBox->interpretText();
model->setData(index, spinBox->value(), Qt::EditRole);
break;
}
case static_cast<qint8>(AssumptionType::IntegerAssumption) : {
QSpinBox *spinBox = qobject_cast<QSpinBox*>(editor);
spinBox->interpretText();
model->setData(index, spinBox->value(), Qt::EditRole);
break;
}
case static_cast<qint8>(AssumptionType::BloombergVectorAssumption) :
case static_cast<qint8>(AssumptionType::IntegerVectorAssumption) :
case static_cast<qint8>(AssumptionType::DayCountVectorAssumption) :
model->setData(index, qobject_cast<QLineEdit*>(editor)->text(), Qt::EditRole);
break;
default:
model->setData(index, QVariant(), Qt::EditRole);
}
}
else model->setData(index, QVariant(), Qt::EditRole);
}
示例4: setModelData
void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
spinBox->interpretText();
int value = spinBox->value();
model->setData(index, value, Qt::EditRole);
}
示例5: setModelData
//cppcheck-suppress unusedFunction
void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
SCASSERT(spinBox != nullptr);
spinBox->interpretText();
qreal value = spinBox->value();
model->setData(index, value, Qt::EditRole);
}
示例6: setModelData
void MerchendiseSelectionDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
if(!index.isValid() || index.column() != 0)
return;
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
spinBox->interpretText();
double count = spinBox->value();
model->setData(index, count, Qt::EditRole);
}
示例7: setModelData
void FilletRadiusDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
spinBox->interpretText();
//double value = spinBox->value();
//QString value = QString::fromAscii("%1").arg(spinBox->value(),0,'f',2);
QString value = QLocale::system().toString(spinBox->value(),'f',2);
model->setData(index, value, Qt::EditRole);
}
示例8: setModelData
void CameraPropertyModelDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,const QModelIndex &index) const
{
switch(index.internalId())
{
case CameraPropertyModel::CAMERANAME:
{
QLineEdit *lineEdit=static_cast<QLineEdit*>(editor);
QString value=lineEdit->text();
model->setData(index,value,Qt::EditRole);
return;
}
break;
case CameraPropertyModel::FOV:
case CameraPropertyModel::FARPLANE:
case CameraPropertyModel::NEARPLANE:
case CameraPropertyModel::FROMX:
case CameraPropertyModel::FROMY:
case CameraPropertyModel::FROMZ:
case CameraPropertyModel::TOX:
case CameraPropertyModel::TOY:
case CameraPropertyModel::TOZ:
case CameraPropertyModel::UPX:
case CameraPropertyModel::UPY:
case CameraPropertyModel::UPZ:
case CameraPropertyModel::SCALE:
{
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
spinBox->interpretText();
int value = spinBox->value();
model->setData(index, value, Qt::EditRole);
return;
}
break;
case CameraPropertyModel::ISSHOWINFO:
case CameraPropertyModel::ISDRAW:
{
QCheckBox *checkBox=static_cast<QCheckBox*>(editor);
bool value=checkBox->isChecked();
model->setData(index,value,Qt::EditRole);
return;
}
break;
}
return QStyledItemDelegate::setModelData(editor,model,index);
}
示例9: setModelData
//-----------------------------------------------------------------------------
void qtDoubleSpinBoxDelegate::setModelData(
QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
QTE_D_CONST(qtDoubleSpinBoxDelegate);
QDoubleSpinBox* spinBox = qobject_cast<QDoubleSpinBox*>(editor);
Q_ASSERT(spinBox);
spinBox->interpretText();
if (d->dataRole != Qt::EditRole)
{
model->setData(index, spinBox->value(), d->dataRole);
model->setData(index, spinBox->text(), Qt::EditRole);
}
else
{
model->setData(index, spinBox->value(), Qt::EditRole);
}
}
示例10: setModelData
void RelationDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
switch (index.column()) {
case COLUMN_CATEGORY:
case COLUMN_FOOTPRINT:
case COLUMN_TEMP:
case COLUMN_SUPPL:
{
QComboBox *cb = static_cast<QComboBox*>(editor);
if (cb->currentData().isValid()) {
int value = cb->currentData().toInt();
model->setData(index, value, Qt::EditRole);
} else
qDebug() << "Invalid combobox data!";
break;
}
case COLUMN_COUNT:
case COLUMN_PRICE_VOL:
{
QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
spinBox->interpretText();
int value = spinBox->value();
model->setData(index, value, Qt::EditRole);
break;
}
case COLUMN_PRICE:
{
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
spinBox->interpretText();
double value = spinBox->value();
model->setData(index, value, Qt::EditRole);
break;
}
default:
QStyledItemDelegate::setModelData(editor, model, index);
break;
}
}
示例11: setModelData
void SpinDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex& index) const {
QDoubleSpinBox *dsb = static_cast<QDoubleSpinBox*>(editor);
dsb->interpretText();
double value = dsb->value();
model->setData(index, value);
}
示例12: setModelData
void CoordinateDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
// Boolean to determine corresponding scene of data
bool scene;
bool broadcast = true;
// Cast the editor as a double spin box
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
spinBox->interpretText();
// Get the value from the editor
double value = spinBox->value();
// Cast the model as a CoordinateModel and set the data
CoordinateModel *m = qobject_cast<CoordinateModel*>(model);
// Use the QModelIndex to locate the corresponding QPointF in the data model
QList<QPointF> refCoords = m->refCoords;
QList<QPointF> epoCoords = m->epoCoords;
QPointF oldPosition;
QPointF newPosition;
switch (index.column()) {
case 0:
oldPosition = refCoords.at(index.row());
newPosition = QPointF(oldPosition);
newPosition.setX(value);
scene = true;
break;
case 1:
oldPosition = refCoords.at(index.row());
newPosition = QPointF(oldPosition);
newPosition.setY(value);
scene = true;
break;
case 2:
oldPosition = epoCoords.at(index.row());
if (oldPosition == QPointF(-1, -1))
broadcast = false;
newPosition = QPointF(oldPosition);
newPosition.setX(value);
scene = false;
break;
case 3:
oldPosition = epoCoords.at(index.row());
if (oldPosition == QPointF(-1, -1))
broadcast = false;
newPosition = QPointF(oldPosition);
newPosition.setY(value);
scene = false;
break;
}
// Broadcast change of data
if (broadcast)
{
QModelIndex indx = QModelIndex(index);
if (scene == true)
emit itemMoved(fitsScene, newPosition, oldPosition, &indx);
else
emit itemMoved(epoScene, newPosition, oldPosition, &indx);
}
}