本文整理汇总了C++中ItemLineEdit类的典型用法代码示例。如果您正苦于以下问题:C++ ItemLineEdit类的具体用法?C++ ItemLineEdit怎么用?C++ ItemLineEdit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ItemLineEdit类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void ToitemTableDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
const QAbstractItemModel *model = index.model();
QLineEdit *lineedit = 0;
switch (index.column())
{
case ITEM_NUMBER_COL:
{
ItemLineEdit *item = static_cast<ItemLineEdit*>(editor);
item->setId(model->data(model->index(index.row(),
TOITEM_ITEM_ID_COL)).toInt());
break;
}
case TOITEM_QTY_ORDERED_COL:
case TOITEM_FREIGHT_COL:
lineedit = static_cast<QLineEdit*>(editor);
lineedit->setText(model->data(index).toString());
break;
case TOITEM_DUEDATE_COL:
{
DLineEdit *duedate = static_cast<DLineEdit*>(editor);
duedate->setDate(index.data().toDate());
break;
}
#ifdef QE_PROJECT
case PRJ_NUMBER_COL:
{
ProjectLineEdit *prj = static_cast<ProjectLineEdit*>(editor);
prj->setId(model->data(model->index(index.row(), TOITEM_PRJ_ID_COL)).toInt());
break;
}
#endif
default:
break;
}
}
示例2: qDebug
void PoitemTableDelegate::setModelData(QWidget *editor, QAbstractItemModel *pModel, const QModelIndex &index) const
{
XSqlQuery PoitemetModelData;
if (DEBUG)
qDebug("PoitemTableDelegate::setModelData() entered");
bool hitError = false;
QVariant oldval = pModel->data(index);
PoitemTableModel *model = static_cast<PoitemTableModel*>(pModel);
switch (index.column())
{
case ITEM_NUMBER_COL:
{
ItemLineEdit *item = static_cast<ItemLineEdit*>(editor);
if (item->itemNumber() != oldval.toString())
{
if (item->itemNumber().isEmpty())
{
model->setData(index, QVariant());
model->setData(model->index(index.row(), ITEM_ID_COL), QVariant());
model->setData(model->index(index.row(), POITEM_ITEMSITE_ID_COL), QVariant());
model->setData(model->index(index.row(), WAREHOUS_ID_COL), QVariant());
model->setData(model->index(index.row(), WAREHOUS_CODE_COL), QVariant());
model->setData(model->index(index.row(), POITEM_ITEMSRC_ID_COL), QVariant());
model->setData(model->index(index.row(), POITEM_VEND_ITEM_NUMBER_COL), QVariant());
model->setData(model->index(index.row(), POITEM_VEND_ITEM_DESCRIP_COL), QVariant());
model->setData(model->index(index.row(), POITEM_VEND_UOM_COL), QVariant());
model->setData(model->index(index.row(), ITEMSRC_MINORDQTY_COL), QVariant());
model->setData(model->index(index.row(), ITEMSRC_MULTORDQTY_COL), QVariant());
model->setData(model->index(index.row(), ITEMSRC_INVVENDORUOMRATIO_COL), QVariant());
model->setData(model->index(index.row(), POITEM_INVVENDUOMRATIO_COL), QVariant());
model->setData(model->index(index.row(), EARLIESTDATE_COL), QVariant());
}
else
{
model->setData(index, item->itemNumber());
model->setData(model->index(index.row(), ITEM_ID_COL), item->id());
if (item->isValid())
{
XSqlQuery itemq;
itemq.prepare("SELECT (warehous_id=:preferred) AS preferred, "
" itemsite_id, warehous_id, warehous_code "
"FROM itemsite, whsinfo "
"WHERE ((itemsite_item_id=:item_id)"
" AND (itemsite_warehous_id=warehous_id)) "
"ORDER BY preferred DESC, warehous_code "
"LIMIT 1;");
itemq.bindValue(":item_id", item->id());
itemq.bindValue(":preferred",
_x_preferences->value("PreferredWarehouse").toInt());
itemq.exec();
if (itemq.first())
{
model->setData(model->index(index.row(), POITEM_ITEMSITE_ID_COL), itemq.value("itemsite_id").toInt());
model->setData(model->index(index.row(), WAREHOUS_ID_COL), itemq.value("warehous_id").toInt());
model->setData(model->index(index.row(), WAREHOUS_CODE_COL), itemq.value("warehous_code").toString());
}
else if (ErrorReporter::error(QtCriticalMsg, 0, tr("Error Retrieving PO Information"),
itemq, __FILE__, __LINE__))
{
hitError = true;
break;
}
else
{
ErrorReporter::error(QtCriticalMsg, 0, tr("Error Occurred"),
tr("Could not find Item Site for %1 (%2).")
.arg(item->itemNumber())
.arg(item->id()),__FILE__,__LINE__);
hitError = true;
break;
}
if (_metrics->boolean("RequireStdCostForPOItem"))
{
XSqlQuery stdcostq;
stdcostq.prepare("SELECT stdCost(:item_id) AS result");
stdcostq.bindValue(":item_id", item->id());
stdcostq.exec();
if(stdcostq.first() && stdcostq.value("result").toDouble() == 0.0)
{
QMessageBox::critical(0, tr("Selected Item Missing Cost"),
tr("<p>The selected item has no Std. Costing information. "
"Please see your controller to correct this situation "
"before continuing."));
model->setData(index, QString());
model->setData(model->index(index.row(), POITEM_ITEMSITE_ID_COL), QVariant());
model->setData(model->index(index.row(), WAREHOUS_ID_COL), QVariant());
model->setData(model->index(index.row(), WAREHOUS_CODE_COL), QString());
model->setData(index, QString());
hitError = true;
break;
}
else if (ErrorReporter::error(QtCriticalMsg, 0, tr("Error Retrieving Standard Cost Information"),
stdcostq, __FILE__, __LINE__))
{
hitError = true;
break;
}
//.........这里部分代码省略.........