本文整理汇总了C++中MatchData::getModifycounts方法的典型用法代码示例。如果您正苦于以下问题:C++ MatchData::getModifycounts方法的具体用法?C++ MatchData::getModifycounts怎么用?C++ MatchData::getModifycounts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatchData
的用法示例。
在下文中一共展示了MatchData::getModifycounts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
ui->setFirstTxt(jsondata->getNickname());
ui->setSecondTxt(memoname);
ui->setVersion(jsondata->getVersion());
ui->setThirdTxt(jsondata->getGsoapip());
ui->setIntroduceTxt(jsondata->getFeel());
ui->showAnimation();
// ui->activateWindow();
ui->move(mapToGlobal(this->pos()).x() - 360, QCursor::pos().y() - 50);
connect(emoji, &EmojiLabel::leaveEmoji, ui, [=] () {
// disconnect(emoji, &EmojiLabel::leaveEmoji, 0, 0);
ui->hideAnimation();
});
});
menu = new SelfMenu(this);
connect(menu->addAction(cns("备注名")), &QAction::triggered, this, [=] () {
bool ok;
QString name = InputBox::GetInput(cns("输入备注名"), &ok);
if (!ok)
return;
if (name.trimmed().isEmpty())
{
MsgBox::ShowMsgBox(cn("提示"), cn("不能为空"), cn("确定"));
return;
}
if (name.trimmed().length() >= 18)
{
MsgBox::ShowMsgBox(cn("错误"), cn("昵称长度18限制"), cn("确定"));
return;
}
QString er;
SqlDB *db = Sql::instance()->open(er);
if (!db)
{
MsgBox::ShowMsgBox(cn("失败"), cn("数据库错误\n") + er, cn("确定"));
return;
}
QString sql = "SELECT * FROM "+ MatchData().objectName() +
" WHERE uid = '" + uid + "'";
int rlt;
QList<QObject *> objs = db->executeQuery(sql,
MatchData().metaObject(),
rlt, er);
if (rlt != 0)
{
MsgBox::ShowMsgBox(cn("失败"), cn("数据库读取错误\n") + er, cn("确定"));
return;
}
bool b = true;
if (objs.isEmpty())
{
// insert
MatchData md;
md.setUid(uid);
md.setEditname(name);
md.setNickname(jsondata->getNickname());
md.setEdittime(QDateTime::currentDateTime().toTime_t());
md.setIp(jsondata->getGsoapip());
md.setModifycounts(1);
b = db->insert(&md, er);
}
else
{
// update
MatchData *md = qobject_cast<MatchData *>(objs.first());
if (md)
{
md->setEditname(name);
md->setNickname(jsondata->getNickname());
md->setEdittime(QDateTime::currentDateTime().toTime_t());
md->setIp(jsondata->getGsoapip());
md->setModifycounts(md->getModifycounts() + 1);
b = db->update(md, "uid", er);
}
else
{
b = false;
er = cn("无法修改,读取错误!!!");
}
auto it = objs.begin();
while (it != objs.end())
{
QObject *obj = *it;
delete obj;
obj = nullptr;
++it;
}
}
db->close();
if (!b)
{
MsgBox::ShowMsgBox(cn("修改失败"), er, cn("确定"));
}
else
{
memoname = name;
}
showMemoName();
});
}