本文整理汇总了C++中QVariantList::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantList::clear方法的具体用法?C++ QVariantList::clear怎么用?C++ QVariantList::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariantList
的用法示例。
在下文中一共展示了QVariantList::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testUpdateNotification
void Ut_CReporterNotifyDialogPlugin::testUpdateNotification()
{
// Test notification update.
QSignalSpy requestCompletedSpy(m_Subject, SIGNAL(requestCompleted()));
m_Subject->initialize(m_Server);
QVariantList args;
args << QString("/media/mmc1/core-dumps/test-1234-11-4321.rcore.lzo");
// Request plugin and show notification.
bool retVal = m_Subject->requestDialog(args);
QVERIFY(retVal == true);
QVERIFY(notificationCreated = true);
QVERIFY(notificationTimeoutSet = true);
notificationTimeoutSet = false;
args.clear();
args << QString("/media/mmc1/core-dumps/application-1234-9-4321.rcore.lzo");
// Request plugin and show notification.
retVal = m_Subject->requestDialog(args);
QVERIFY(retVal == true);
// Notifications are no longer updated but removed and replaced with a new one
//QVERIFY(notificationUpdated == true);
QVERIFY(notificationTimeoutSet == true);
m_Subject->notificationTimeout();
QVERIFY(m_Subject->isActive() == false);
// Now request is not completed until the dialog has disappeared so this cannot be tested here.
//QVERIFY(requestCompletedSpy.count() == 1);
}
示例2: initTables
void QxtWebJsonRPCService::Private::handle(QxtWebRequestEvent *event, QVariant rid, QString action, QVariant argsE)
{
QVariantMap argsM;
QVariantList args;
if (argsE.type() == QVariant::Map) {
argsM = argsE.toMap();
args = argsM.values();
} else {
args = argsE.toList();
}
if (!invokable)
initTables(p);
if (!methods.contains(action.toUtf8() + QByteArray::number(args.count()))) {
QVariantMap res;
res.insert("result", QVariant());
res.insert("error", "no such method or incorrect number of arguments");
res.insert("id", rid);
QxtWebPageEvent *err = new QxtWebPageEvent(event->sessionID, event->requestID,
QxtJSON::stringify(res).toUtf8() + "\r\n");
p->postEvent(err);
return;
}
Method method = methods.value(action.toUtf8() + QByteArray::number(args.count()));
if (argsE.type() == QVariant::Map) {
args.clear();
foreach (const QString &pname, method.meta.parameterNames ()) {
args.append(argsM.value(pname));
}
}
示例3: qDebug
QList<NutshMetaData> NutshSqlSaver::getMetaDatas(const QString& listName) {
//retourne la liste de métadonnée selon une requete
QList<NutshMetaData> metaList;
QVariantList cache;
QSqlQuery requete;
if(listName != QString()){
if(!requete.exec(QString("SELECT * FROM bibliotheque INNER JOIN relationships ON relationships.music_id = bibliotheque.id WHERE (relationships.playlist_id = %1)").arg(crypt(listName)))) {
qDebug() << requete.lastError() << requete.lastQuery();
}
} else {
if(!requete.exec(QString("SELECT * FROM bibliotheque"))) {
qDebug() << requete.lastError() << requete.lastQuery();
}
}
while(requete.next()) {
for(int i = 0;i<NB_CHAMPS_DATABASE;i++) {
cache.append(requete.value(i));
}
metaList.append(NutshMetaData(cache));
cache.clear();
}
return metaList;
}
示例4: updateStatement
QString ScenarioChangeMapper::updateStatement(DomainObject* _subject, QVariantList& _updateValues) const
{
QString updateStatement =
QString("UPDATE " + TABLE_NAME +
" SET uuid = ?, "
" datetime = ?, "
" username = ?, "
" undo_patch = ?, "
" redo_patch = ?, "
" is_draft = ? "
" WHERE id = ? "
);
ScenarioChange* change = dynamic_cast<ScenarioChange*>(_subject);
_updateValues.clear();
_updateValues.append(change->uuid().toString());
_updateValues.append(change->datetime().toString("yyyy-MM-dd hh:mm:ss"));
_updateValues.append(change->user());
_updateValues.append(change->undoPatch());
_updateValues.append(change->redoPatch());
_updateValues.append(change->isDraft() ? "1" : "0");
_updateValues.append(change->id().value());
return updateStatement;
}
示例5: deleteStatement
QString CharacterPhotoMapper::deleteStatement(DomainObject* _subject, QVariantList& _deleteValues) const
{
QString deleteStatement = "DELETE FROM " + TABLE_NAME + " WHERE id = ?";
_deleteValues.clear();
_deleteValues.append(_subject->id().value());
return deleteStatement;
}
示例6: getRecByID
void CRtTable::getRecByID(int keyid,QVariantList& vecValues)
{
vecValues.clear();
QString strSQL = getAllField();
strSQL += " where id = ";
strSQL += QString::number(keyid);
QVector<QVariantList> vecList;
getRecsBySQL(strSQL,vecList);
if (vecList.count() > 0)
{
vecValues = vecList[0];
}
}
示例7: insertStatement
QString CharacterPhotoMapper::insertStatement(DomainObject* _subject, QVariantList& _insertValues) const
{
QString insertStatement =
QString("INSERT INTO " + TABLE_NAME +
" (id, fk_character_id, photo, sort_order) "
" VALUES(?, ?, ?, ?) "
);
CharacterPhoto* photo = dynamic_cast<CharacterPhoto*>(_subject);
_insertValues.clear();
_insertValues.append(photo->id().value());
_insertValues.append(photo->character()->id().value());
_insertValues.append(ImageHelper::bytesFromImage(photo->photo()));
_insertValues.append(photo->sortOrder());
return insertStatement;
}
示例8: toVariant
QVariant QCollectionJsonItem::toVariant() const
{
QVariantMap result;
result[HREF] = href();
QVariantList list;
foreach(const QCollectionJsonData data, d->data) {
list.append(data.toVariant());
}
if(!list.isEmpty()) result[DATA] = list;
list.clear();
foreach(const QCollectionJsonLink link, d->links) {
list.append(link.toVariant());
}
if(!list.isEmpty()) result[LINKS] = list;
return result;
}
示例9: updateStatement
QString CharacterPhotoMapper::updateStatement(DomainObject* _subject, QVariantList& _updateValues) const
{
QString updateStatement =
QString("UPDATE " + TABLE_NAME +
" SET fk_character_id = ?, "
" photo = ?, "
" sort_order = ? "
" WHERE id = ? "
);
CharacterPhoto* photo = dynamic_cast<CharacterPhoto*>(_subject);
_updateValues.clear();
_updateValues.append(photo->character()->id().value());
_updateValues.append(ImageHelper::bytesFromImage(photo->photo()));
_updateValues.append(photo->sortOrder());
_updateValues.append(photo->id().value());
return updateStatement;
}
示例10: insertStatement
QString ScenarioChangeMapper::insertStatement(DomainObject* _subject, QVariantList& _insertValues) const
{
QString insertStatement =
QString("INSERT INTO " + TABLE_NAME +
" (" + COLUMNS + ") "
" VALUES(?, ?, ?, ?, ?, ?, ?) "
);
ScenarioChange* change = dynamic_cast<ScenarioChange*>(_subject );
_insertValues.clear();
_insertValues.append(change->id().value());
_insertValues.append(change->uuid().toString());
_insertValues.append(change->datetime().toString("yyyy-MM-dd hh:mm:ss"));
_insertValues.append(change->user());
_insertValues.append(change->undoPatch());
_insertValues.append(change->redoPatch());
_insertValues.append(change->isDraft() ? "1" : "0");
return insertStatement;
}
示例11: REQUETE
QList<NutshMetaData> NutshSqlSaver::getMostReaden(int display) {
QList<NutshMetaData> metaList;
QVariantList cache;
REQUETE(QString("SELECT * FROM bibliotheque ORDER BY compteur DESC LIMIT 0, %1").arg(display));
while(requete.next()) {
for(int i = 0;i<NB_CHAMPS_DATABASE;i++) {
cache.append(requete.value(i));
}
metaList.append(NutshMetaData(cache));
cache.clear();
}
return metaList;
}
示例12: helpFile
void
PreferencesWidget::showHelp()
{
PropertyEditor propertyEditor;
QMap<QString, QVariantList> plist;
QVariantList vlist;
vlist.clear();
QFile helpFile(":/preferences.help");
if (helpFile.open(QFile::ReadOnly))
{
QTextStream in(&helpFile);
QString line = in.readLine();
while (!line.isNull())
{
if (line == "#begin")
{
QString keyword = in.readLine();
QString helptext;
line = in.readLine();
while (!line.isNull())
{
helptext += line;
helptext += "\n";
line = in.readLine();
if (line == "#end") break;
}
vlist << keyword << helptext;
}
line = in.readLine();
}
}
plist["commandhelp"] = vlist;
QStringList keys;
keys << "commandhelp";
propertyEditor.set("Preferences Help", plist, keys);
propertyEditor.exec();
}
示例13: parseResultsJSON
void DroidStoreAPI::parseResultsJSON(QString jsonString, QString categoryOnly)
{
JsonDataAccess jda;
QVariant jsonDATA = jda.loadFromBuffer(jsonString);
_results = jsonDATA.toMap().value("results").toList();
QVariantList newResults = _results;
if(categoryOnly != "all")
{
newResults.clear();
foreach (QVariant app , _results)
{
if(categoryOnly == "game")
{
if(app.toMap().value("cat_int").toInt() >= 25) // if it's an game type
{
newResults.append(app);
}
}
else if(categoryOnly == "app")
{
if(app.toMap().value("cat_int").toInt() <= 26) // if it's a app type
{
newResults.append(app);
}
}
else
{
if(app.toMap().value("cat_int").toInt() == categoryOnly.toInt()) // if it's a specific type
{
newResults.append(app);
}
}
}
}
示例14: if
//.........这里部分代码省略.........
return true;
}
else if (event->key() == Qt::Key_A)
{
int idx = m_paths[i]->pointPressed();
if (idx > -1)
{
float a = m_paths[i]->getAngle(idx);
if (event->modifiers() & Qt::ShiftModifier)
a--;
else
a++;
m_paths[i]->setAngle(idx, a, m_sameForAll);
return true;
}
}
else if (event->key() == Qt::Key_Delete ||
event->key() == Qt::Key_Backspace ||
event->key() == Qt::Key_Backtab)
{
m_paths[i]->removeFromMouseGrabberPool();
m_paths.removeAt(i);
return true;
}
if (event->key() == Qt::Key_Space)
{
PropertyEditor propertyEditor;
QMap<QString, QVariantList> plist;
QVariantList vlist;
vlist.clear();
vlist << QVariant("double");
vlist << QVariant(m_paths[i]->opacity());
vlist << QVariant(0.0);
vlist << QVariant(1.0);
vlist << QVariant(0.1); // singlestep
vlist << QVariant(1); // decimals
plist["opacity"] = vlist;
vlist.clear();
vlist << QVariant("colorgradient");
QGradientStops stops = m_paths[i]->stops();
for(int s=0; s<stops.size(); s++)
{
float pos = stops[s].first;
QColor color = stops[s].second;
int r = color.red();
int g = color.green();
int b = color.blue();
int a = color.alpha();
vlist << QVariant(pos);
vlist << QVariant(r);
vlist << QVariant(g);
vlist << QVariant(b);
vlist << QVariant(a);
}
plist["color"] = vlist;
vlist.clear();
vlist << QVariant("checkbox");
vlist << QVariant(m_paths[i]->filterPathLen());
plist["filter on length"] = vlist;
示例15: helpFile
bool
ClipObject::commandEditor()
{
PropertyEditor propertyEditor;
QMap<QString, QVariantList> plist;
QVariantList vlist;
vlist.clear();
plist["command"] = vlist;
vlist.clear();
vlist << QVariant("double");
vlist << QVariant(m_opacity);
vlist << QVariant(0.0);
vlist << QVariant(1.0);
vlist << QVariant(0.1); // singlestep
vlist << QVariant(1); // decimals
plist["opacity"] = vlist;
vlist.clear();
vlist << QVariant("color");
Vec pcolor = m_color;
QColor dcolor = QColor::fromRgbF(pcolor.x,
pcolor.y,
pcolor.z);
vlist << dcolor;
plist["color"] = vlist;
vlist.clear();
vlist << QVariant("checkbox");
vlist << QVariant(m_apply);
plist["apply clipping"] = vlist;
vlist.clear();
vlist << QVariant("int");
vlist << QVariant(m_tfset);
vlist << QVariant(-1);
vlist << QVariant(15);
plist["tfset"] = vlist;
vlist.clear();
vlist << QVariant("int");
vlist << QVariant(m_thickness);
vlist << QVariant(0);
vlist << QVariant(200);
plist["thickness"] = vlist;
vlist.clear();
vlist << QVariant("checkbox");
vlist << QVariant(m_solidColor);
plist["solid color"] = vlist;
vlist.clear();
vlist << QVariant("checkbox");
vlist << QVariant(m_showSlice);
plist["show slice"] = vlist;
vlist.clear();
vlist << QVariant("checkbox");
vlist << QVariant(m_showThickness);
plist["show thickness"] = vlist;
vlist.clear();
vlist << QVariant("combobox");
if (m_viewportType)
vlist << QVariant(1);
else
vlist << QVariant(0);
vlist << QVariant("orthographic");
vlist << QVariant("perspective");
plist["camera type"] = vlist;
vlist.clear();
vlist << QVariant("double");
vlist << QVariant(m_stereo);
vlist << QVariant(0.0);
vlist << QVariant(1.0);
vlist << QVariant(0.1); // singlestep
vlist << QVariant(1); // decimals
plist["stereo"] = vlist;
vlist.clear();
vlist << QVariant("checkbox");
vlist << QVariant(m_showOtherSlice);
plist["show other slice"] = vlist;
QString vpstr = QString("%1 %2 %3 %4").\
arg(m_viewport.x()).\
arg(m_viewport.y()).\
arg(m_viewport.z()).\
arg(m_viewport.w());
vlist.clear();
vlist << QVariant("string");
vlist << QVariant(vpstr);
plist["viewport"] = vlist;
vlist.clear();
vlist << QVariant("double");
vlist << QVariant(m_viewportScale);
//.........这里部分代码省略.........