本文整理汇总了C++中QDoubleValidator::decimals方法的典型用法代码示例。如果您正苦于以下问题:C++ QDoubleValidator::decimals方法的具体用法?C++ QDoubleValidator::decimals怎么用?C++ QDoubleValidator::decimals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDoubleValidator
的用法示例。
在下文中一共展示了QDoubleValidator::decimals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sReassign
void reassignLotSerial::sReassign()
{
XSqlQuery reassignReassign;
if (_expirationDate->isEnabled())
{
if (!_expirationDate->isValid() || _expirationDate->isNull())
{
QMessageBox::critical( this, tr("Enter a valid date"),
tr("You must enter a valid expiration date before you can continue.") );
_expirationDate->setFocus();
return;
}
}
if (_source->currentItem() == 0)
{
QMessageBox::critical( this, tr("Select Source Location"),
tr("You must select a Source Location before reassigning its Lot/Serial #.") );
_source->setFocus();
return;
}
if (_qty->toDouble() == 0)
{
QMessageBox::critical( this, tr("Enter Quantity to Reassign"),
tr("You must enter a quantity to reassign.") );
_qty->setFocus();
return;
}
if (_lotNumber->text().length() == 0)
{
QMessageBox::critical( this, tr("Enter New Lot Number to Reassign"),
tr("You must enter a New Lot Number to reassign.") );
_qty->setFocus();
return;
}
QDoubleValidator* qtyVal = (QDoubleValidator*)(_qty->validator());
reassignReassign.prepare("SELECT reassignLotSerial(:source, CAST (:qty AS NUMERIC(100,:decimals)), "
" :lotNumber, :expirationDate, :warrantyDate) AS result;");
reassignReassign.bindValue(":source", _source->id());
reassignReassign.bindValue(":qty", _qty->toDouble());
reassignReassign.bindValue(":decimals", qtyVal->decimals());
reassignReassign.bindValue(":lotNumber", _lotNumber->text());
if (_expirationDate->isEnabled())
reassignReassign.bindValue(":expirationDate", _expirationDate->date());
else
reassignReassign.bindValue(":expirationDate", omfgThis->endOfTime());
if (_warrantyDate->isEnabled())
reassignReassign.bindValue(":warrantyDate", _warrantyDate->date());
reassignReassign.exec();
if (reassignReassign.first())
{
int result = reassignReassign.value("result").toInt();
if (result < 0)
{
systemError(this, storedProcErrorLookup("reassignLotSerial", result),
__FILE__, __LINE__);
return;
}
}
else if (reassignReassign.lastError().type() != QSqlError::NoError)
{
systemError(this, reassignReassign.lastError().databaseText(), __FILE__, __LINE__);
return;
}
if (_captive)
accept();
else
{
_close->setText(tr("&Close"));
sFillList();
if (_qty->isEnabled())
_qty->clear();
_qty->setFocus();
_lotNumber->clear();
_expirationDate->setNull();
_warrantyDate->setNull();
}
}