Exemple #1
0
void TagImgDlg::readAttributes( QDict<QString> *d )
{
  dict = d;

  updateDict("src",   lineImgSource );
  updateDict("alt",   lineAltText );
  updateDict("width", lineWidth );
  updateDict("height",lineHeight );
  updateDict("hspace",lineHSpace );
  updateDict("vspace",lineVSpace );
  updateDict("align", comboAlign );
  updateDict("border",spinBorder );
}
Exemple #2
0
void MainWindow::on_pushButtonEsave_clicked()
{
    QString name = ui->lineEditEname->text().trimmed();
    QString gender = ui->comboBoxEgender->currentText().trimmed();
    QString phone = ui->lineEditEphone->text().trimmed();
    phone = phone.remove(" ");
    QString birthday = ui->dateEditEBirth->date().toString("yyyy-MM-dd");
    QString logdate = ui->dateEditEcurrent->date().toString("yyyy-MM-dd");

    if (!ui->tableViewDict->isHidden()) {
        ui->tableViewDict->hide();
    }

    QString pinyin = toChineseSpell(name);

    qDebug() << "name = " << pinyin;
    if (name.isEmpty()) {
        QMessageBox::information(this, "", "贤二,姓名不能为空滴啊!");
        return;
    }


    bool signStat = ifSignedToday(name, gender, phone, logdate);

    if (signStat) {
        QMessageBox::information(this, "", QString("嘿嘿,%1 %2 今天签到已经录进去啦,我们是一天签到一次哦!").arg(name).arg(phone));
        clearEdits();
        return;
    }

    updateDict(name, gender, phone, birthday);

    QString current = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");

    QSqlQuery query;
    query.exec(QString("insert into sign(name, gender, phone, birthday, logdate, current) values ('%1', '%2', '%3', '%4', '%5', '%6')").arg(name).arg(gender).arg(phone).arg(birthday).arg(logdate).arg(current));
    query.exec(QString("replace into pinyin(name, pinyin) values ('%1', '%2') ").arg(name).arg(pinyin));
    modelEdit->setFilter(QString("logdate = '%1'").arg(logdate));
    modelEdit->select();
    ui->tableViewSigns->reset();

    clearEdits();

}