本文整理汇总了C++中Armor::SetWeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Armor::SetWeight方法的具体用法?C++ Armor::SetWeight怎么用?C++ Armor::SetWeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Armor
的用法示例。
在下文中一共展示了Armor::SetWeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_pushButton_clicked
void armor_edit_new::on_pushButton_clicked()
{
//cout << "Next pressed\n";
QString arr_qstring[13], description;
bool good = false;
bool priceerr = false,
weighterr = false,
armorBonuserr = false;
//cout << "Grabbing user input\n";
arr_qstring[0] = ui->name_textbox->text();
arr_qstring[1] = ui->price_textbox->text();
arr_qstring[2] = ui->type_textbox->text();
arr_qstring[3] = ui->weight_textbox->text();
arr_qstring[4] = ui->armor_textbox->text();
arr_qstring[5] = ui->armorCheckPenalty_textbox->text();
arr_qstring[6] = ui->don_textbox->text();
arr_qstring[7] = ui->donHaste_textbox->text();
arr_qstring[8] = ui->remove_textbox->text();
arr_qstring[9] = ui->speedHuman_textbox->text();
arr_qstring[10] = ui->speedDwarf_textbox->text();
arr_qstring[11] = ui->maxDexBonus_textbox->text();
arr_qstring[12] = ui->arcaneSpellFail_textbox->text();
description = ui->description_textbox->toPlainText();
Armor a;
a.SetName(arr_qstring[0].toStdString()),
a.SetCost(arr_qstring[1].toStdString()),
a.SetType(arr_qstring[2].toStdString()),
a.SetWeight(arr_qstring[3].toStdString()),
a.SetArmorBonus(arr_qstring[4].toStdString()),
a.SetArmorCheckPenalty(arr_qstring[5].toStdString()),
a.SetDon(arr_qstring[6].toStdString()),
a.SetDonHastely(arr_qstring[7].toStdString()),
a.SetRemove(arr_qstring[8].toStdString()),
a.SetSpeedHuman(arr_qstring[9].toStdString()),
a.SetSpeedDwarf(arr_qstring[10].toStdString()),
a.SetMaxDexBonus(arr_qstring[11].toStdString()),
a.SetArcaneSpellFailure(arr_qstring[12].toStdString()),
a.SetDescription(description.toStdString());
for (int i = 0 ; i < a.GetCost().size(); i++)
if (!isdigit(a.GetCost()[i]) || a.GetCost()[i] == '.')
priceerr = true;
for (int i = 0; i < a.GetWeight().size(); i++)
if (!isdigit(a.GetWeight()[i]))
weighterr = true;
for (int i = 0; i < a.GetArmorBonus().size(); i++)
if (!isdigit(a.GetArmorBonus()[i]))
armorBonuserr = true;
if (!priceerr && !weighterr && !armorBonuserr)
good = true;
else
{
good = false;
//cout << "Something was false\n";
}
if (good)
{
//No need to check the return.
//If we're at this point in the code then the database is fine.
//cout << "Calling AddtoCEAMS\n";
//if (
AddToCEAMS(a);//)
newDB.armor_V->push_back(a);
//cout << "Success!\n";
//else
//cout << "Fail :(\n";
//cout << "AddToCEAMS has returned\n";
//Close window and signal success
//success* goodWindow = new success;
// goodWindow->show();
this->close();
}
else
{
//Signal error, highlight error boxes
if (priceerr)
ui->price_textbox->setStyleSheet("QLabel{background_color:red;}");
else
ui->price_textbox->setStyleSheet("QLabel{background_color:white;}");
if (weighterr)
ui->weight_textbox->setStyleSheet("QLabel{background_color:red;}");
else
ui->weight_textbox->setStyleSheet("QLabel{background_color:white;}");
if (armorBonuserr)
ui->armor_textbox->setStyleSheet("QLabel{background_color:red;}");
else
ui->armor_textbox->setStyleSheet("QLabel{background_color:white;}");
}
//.........这里部分代码省略.........