'operator =='错误的模糊重载

时间:2011-11-18 11:14:38

标签: qt qt4

我有:

remoteDB();
QSqlQuery query("SELECT * FROM products");
int id = query.record().indexOf("id");
int aa = query.record().indexOf("license_type");
int bb = query.record().indexOf("free_trial_product_code");
int zz = query.record().indexOf("free_trial_license_number");
int xx = query.record().indexOf("free_trial_claimed_current_status");
int cc = query.record().indexOf("free_trial_correctly_validated_on");
int dd = query.record().indexOf("free_trial_start_date");
int ee = query.record().indexOf("free_trial_stop_date");
int ff = query.record().indexOf("free_trial_lasting_days");
int gg = query.record().indexOf("free_trial_issued_by");
int hh = query.record().indexOf("free_trial_license_issued_on");
int ii = query.record().indexOf("free_trial_mac_address");

int jj = query.record().indexOf("full_license_product_code");
int kk = query.record().indexOf("full_license_number");
int ll = query.record().indexOf("full_license_claimed_current_status");
int mm = query.record().indexOf("full_license_correctly_validated_on");
int nn = query.record().indexOf("full_license_licensed_to");
int oo = query.record().indexOf("full_license_email");
int pp = query.record().indexOf("full_license_telephone_number");
int qq = query.record().indexOf("full_license_issued_on");
int rr = query.record().indexOf("full_license_issued_by");
int ss = query.record().indexOf("full_license_cost");
int tt = query.record().indexOf("full_license_mac_address");

while (query.next()) {
    QString theid = query.value(id).toString();
    QString license_type = query.value(aa).toString();
    QString free_trial_product_code = query.value(bb).toString();
    QString free_trial_license_number = query.value(zz).toString();
    QString free_trial_claimed_current_status = query.value(xx).toString();
    QString free_trial_correctly_validated_on = query.value(cc).toString();
    QString free_trial_start_date = query.value(dd).toString();
    QString free_trial_stop_date = query.value(ee).toString();
    QString free_trial_lasting_days = query.value(ff).toString();
    QString free_trial_issued_by = query.value(gg).toString();
    QString free_trial_license_issued_on = query.value(hh).toString();
    QString free_trial_mac_address = query.value(ii).toString();

    QString full_license_product_code = query.value(jj).toString();
    QString full_license_number = query.value(kk).toString();
    QString full_license_claimed_current_status = query.value(ll).toString();
    QString full_license_correctly_validated_on = query.value(mm).toString();
    QString full_license_licensed_to = query.value(nn).toString();
    QString full_license_email = query.value(oo).toString();
    QString full_license_telephone_number = query.value(pp).toString();
    QString full_license_issued_on = query.value(qq).toString();
    QString full_license_issued_by = query.value(rr).toString();
    QString full_license_cost = query.value(ss).toString();
    QString full_license_mac_address = query.value(tt).toString();

    QDate date = QDate::currentDate();

    SimpleCrypt processSimpleCrypt(35363728);
    QString macaddress = getMac();
    QString separator = "_";

    QString l_type;
    QString f_trial_product_code;
    QString f_trial_license_number;
    QString f_trial_claimed_current_status;
    QString f_trial_correctly_validated_on;
    QString f_trial_start_date;
    QString f_trial_stop_date;
    QString f_trial_lasting_days;
    QString f_trial_issued_by;
    QString f_trial_license_issued_on;
    QString f_trial_mac_address;
    QString f_license_product_code;
    QString f_license_number;
    QString f_license_claimed_current_status;
    QString f_license_correctly_validated_on;
    QString f_license_licensed_to;
    QString f_license_email;
    QString f_license_telephone_number;
    QString f_license_issued_on;
    QString f_license_issued_by;
    QString f_license_cost;
    QString f_license_mac_address;


    l_type = processSimpleCrypt.encryptToString(license_type % separator % macaddress);
    f_trial_product_code = processSimpleCrypt.encryptToString(free_trial_product_code % separator % macaddress);
    f_trial_license_number = processSimpleCrypt.encryptToString(free_trial_license_number % separator % macaddress);
    f_trial_claimed_current_status = processSimpleCrypt.encryptToString(free_trial_claimed_current_status % separator % macaddress);
    f_trial_correctly_validated_on = processSimpleCrypt.encryptToString(free_trial_correctly_validated_on % separator % macaddress);
    f_trial_start_date = processSimpleCrypt.encryptToString(free_trial_start_date % separator % macaddress);
    f_trial_stop_date = processSimpleCrypt.encryptToString(free_trial_stop_date % separator % macaddress);
    f_trial_lasting_days = processSimpleCrypt.encryptToString(free_trial_lasting_days % separator % macaddress);
    f_trial_issued_by = processSimpleCrypt.encryptToString(free_trial_issued_by % separator % macaddress);
    f_trial_license_issued_on = processSimpleCrypt.encryptToString(free_trial_license_issued_on % separator % macaddress);
    f_trial_mac_address = processSimpleCrypt.encryptToString(free_trial_mac_address % separator % macaddress);

    f_license_product_code = processSimpleCrypt.encryptToString(full_license_product_code % separator % macaddress);
    f_license_number = processSimpleCrypt.encryptToString(full_license_number % separator % macaddress);
    f_license_claimed_current_status = processSimpleCrypt.encryptToString(full_license_claimed_current_status % separator % macaddress);
    f_license_correctly_validated_on = processSimpleCrypt.encryptToString(full_license_correctly_validated_on % separator % macaddress);
    f_license_licensed_to = processSimpleCrypt.encryptToString(full_license_licensed_to % separator % macaddress);
    f_license_email = processSimpleCrypt.encryptToString(full_license_email % separator % macaddress);
    f_license_telephone_number = processSimpleCrypt.encryptToString(full_license_telephone_number % separator % macaddress);
    f_license_issued_on = processSimpleCrypt.encryptToString(full_license_issued_on % separator % macaddress);
    f_license_issued_by = processSimpleCrypt.encryptToString(full_license_issued_by % separator % macaddress);
    f_license_cost = processSimpleCrypt.encryptToString(full_license_cost % separator % macaddress);
    f_license_mac_address = processSimpleCrypt.encryptToString(full_license_mac_address % separator % macaddress);

    if ((ui.validateInput->text() == full_license_number) && (full_license_claimed_current_status == 2))
    {
        QSqlQuery query;
        query.prepare("UPDATE products SET full_license_claimed_current_status=:full_license_claimed_current_status, full_license_correctly_validated_on=:full_license_correctly_validated_on,full_license_mac_address=:full_license_mac_address WHERE id=:id");
        query.bindValue(":id", theid);
        query.bindValue(":full_license_claimed_current_status", 1);
        query.bindValue(":full_license_correctly_validated_on", date);
        query.bindValue(":full_license_mac_address", macaddress);
        query.exec();
        QMessageBox msgBox;
        msgBox.setText("Success,The License Has Been Validated.");
        msgBox.exec();

    }

但我正在

error: ambiguous overload for 'operator==' in 'full_license_claimed_current_status == 2'

当我编译。

1 个答案:

答案 0 :(得分:0)

你试过括号吗?

if ((ui.validateInput->text() == full_license_number) && (full_license_claimed_current_status == 2))

还有什么类型的full_license_number和full_license_claimed_current_status?

相关问题