本文整理汇总了C++中QVariantHash::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantHash::clear方法的具体用法?C++ QVariantHash::clear怎么用?C++ QVariantHash::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariantHash
的用法示例。
在下文中一共展示了QVariantHash::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onSocketReadyRead
void Asterisk::onSocketReadyRead()
{
// qDebug("<ready-read>");
QVariantHash headers;
while (socket.canReadLine()) {
QByteArray line = socket.readLine();
// qDebug() << "Line:" << line;
if (line != "\r\n") {
QStringList header = QString(line.trimmed()).split(':');
headers.insertMulti(header[0], decodeValue(header[1].trimmed()));
} else {
if (headers.contains("Response"))
responses.insert(headers.take("ActionID").toString(), headers);
else if (headers.contains("Event"))
emit eventReceived(headers.take("Event").toString(), headers);
headers.clear();
}
}
// qDebug("</ready-read>");
}
示例2: if
void
HatchetAccountConfig::login()
{
tLog() << Q_FUNC_INFO;
const ButtonAction action = static_cast< ButtonAction>( m_ui->loginButton->property( "action" ).toInt() );
if ( action == Login )
{
// Log in mode
tLog() << Q_FUNC_INFO << "Logging in...";
m_account->loginWithPassword( m_ui->usernameEdit->text(), m_ui->passwordEdit->text(), m_ui->otpEdit->text() );
}
else if ( action == Logout )
{
// TODO
m_ui->usernameEdit->clear();
m_ui->passwordEdit->clear();
m_ui->otpEdit->clear();
QVariantHash creds = m_account->credentials();
creds.clear();
m_account->setCredentials( creds );
m_account->sync();
m_account->deauthenticate();
}
}
示例3: modelToJson
QJsonArray jsonHandler::modelToJson(QStandardItemModel *model, QStringList *list)
{
QJsonArray jArray;
QVariant modelValue;
QVariantHash valueMap;
for(int row = 0; row < model->rowCount(); ++row)
{
for(int col = 0; col < list->count(); ++col)
{
valueMap.insert(list->at(col),model->data(model->index(row,col)));
}
jArray.insert(row,QJsonObject::fromVariantHash(valueMap));
valueMap.clear();
}
return jArray;
}