本文整理汇总了C++中QVariantList::at方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantList::at方法的具体用法?C++ QVariantList::at怎么用?C++ QVariantList::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariantList
的用法示例。
在下文中一共展示了QVariantList::at方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fcnToReal
static QVariant fcnToReal( const QVariantList& values, QgsFeature* , QgsExpression* parent )
{
return QVariant( getDoubleValue( values.at( 0 ), parent ) );
}
示例2: qWarning
ConnSettingsValue *IAPConfPrivate::variantToValue(const QVariant &variant)
{
// Convert variant to ConnSettingsValue
ConnSettingsValue *value = conn_settings_value_new();
if (value == 0) {
qWarning("IAPConf: Unable to create new ConnSettingsValue");
return 0;
}
switch(variant.type()) {
case QVariant::Invalid:
value->type = CONN_SETTINGS_VALUE_INVALID;
break;
case QVariant::String: {
char *valueStr = strdup(QSTRING_TO_CONST_CSTR(variant.toString()));
value->type = CONN_SETTINGS_VALUE_STRING;
value->value.string_val = valueStr;
break;
}
case QVariant::Int:
value->type = CONN_SETTINGS_VALUE_INT;
value->value.int_val = variant.toInt();
break;
case QMetaType::Float:
case QVariant::Double:
value->type = CONN_SETTINGS_VALUE_DOUBLE;
value->value.double_val = variant.toDouble();
break;
case QVariant::Bool:
value->type = CONN_SETTINGS_VALUE_BOOL;
value->value.bool_val = variant.toBool() ? 1 : 0;
break;
case QVariant::ByteArray: {
QByteArray array = variant.toByteArray();
value->type = CONN_SETTINGS_VALUE_BYTE_ARRAY;
value->value.byte_array.len = array.size();
value->value.byte_array.val = (unsigned char *)malloc(array.size());
memcpy(value->value.byte_array.val, array.constData(), array.size());
break;
}
case QVariant::List: {
QVariantList list = variant.toList();
ConnSettingsValue **list_val = (ConnSettingsValue **)malloc(
(list.size() + 1) * sizeof(ConnSettingsValue *));
for (int idx = 0; idx < list.size(); idx++) {
list_val[idx] = variantToValue(list.at(idx));
}
list_val[list.size()] = 0;
value->type = CONN_SETTINGS_VALUE_LIST;
value->value.list_val = list_val;
break;
}
default:
qWarning("IAPConf: Can not handle QVariant of type %d",
variant.type());
conn_settings_value_destroy(value);
return 0;
}
return value;
}
示例3: on_invoked
void Card::on_invoked(const bb::system::InvokeRequest& request)
{
qDebug() << "==== Card::onInvoked() START ====";
emit load_configuration();
QVariantMap metadata = request.metadata();
QString source = request.source().installId() + " - " + request.source().groupId();
QString listId = QString::number(request.listId());
QString action = request.action();
QString target = request.target();
QString uri = request.uri().toString();
QString data = QString::fromUtf8(request.data());
qDebug() << "==== Card::onInvoked(): action: " << action << data << ", uri: " << uri;
if(action == "bb.action.VIEW")
{
JsonDataAccess jda;
QVariantMap objectMap = (jda.loadFromBuffer(data)).toMap();
QVariantMap itemMap = objectMap["attributes"].toMap();
QString messageID1 = itemMap["messageid"].toString();
QString sourceID1 = itemMap["sourceId"].toString();
QString itemsFromJSON = Utilities::get_string_from_file("data/hub_items.json");
QVariantList itemsFromJSONList = jda.loadFromBuffer(itemsFromJSON).toList();
qDebug() << "**** Card::onInvoked: itemsFromJSONList: " << itemsFromJSONList.size() << ", sourceId1: " << sourceID1 << ", messageID1: " << messageID1;
for(int index = 0; index < itemsFromJSONList.size(); index++)
{
QVariantMap attributes = itemsFromJSONList.at(index).toMap();
QString pageName = attributes["thePage"].toString();
QString theData = attributes["theData"].toString();
QString sourceID2 = attributes["sourceId"].toString();
qDebug() << "**** Card::onInvoked: thePage" << pageName << ", theData: " << theData << ", sourceId2: " << sourceID2;
if (sourceID2 == messageID1 || sourceID2 == sourceID1)
{
InvokeRequest request2;
request2.setTarget("com.nemory.Insta10HeadlessService");
request2.setAction("bb.action.MARKREAD");
request2.setMimeType("hub/item");
request2.setUri(QUrl("pim:"));
QByteArray bytes;
jda.saveToBuffer(objectMap, &bytes);
request2.setData(bytes);
InvokeTargetReply *reply = _invoke_manager->invoke(request2);
if (!reply)
{
qDebug() << "**** FAILED Card::onInvoked: " << reply->errorCode();
reply->deleteLater();
}
QmlDocument *pageDocument = QmlDocument::create("asset:///pages/" + pageName).parent(this);
_page = pageDocument->createRootObject<Page>();
_page->setProperty("is_card", true);
//_page->setActionBarVisibility((getSetting("backButton", "false") == "false") ? ChromeVisibility::Hidden : ChromeVisibility::Default);
_navigation_pane->push(_page);
Application::instance()->setScene(_navigation_pane);
emit initialize_card();
emit opened_item(attributes, theData);
break;
}
}
jda.deleteLater();
}
else if(action == "bb.action.COMPOSE")
{
}
else if(action == "bb.action.SHARE")
{
startHeadless();
}
else
{
startHeadless();
}
}
示例4: restore
void QxPreferences::restore(QSettings* settings, int selection)
{
blockSignals(true);
settings->beginGroup("preferences");
Ref<ViewMetrics, Owner> editorDefaults = Edit::defaultMetrics();
Ref<ViewMetrics, Owner> terminalDefaults = QxVideoTerminal::defaultMetrics();
if ((selection & Editor) != 0) {
settings->beginGroup("editor");
setFontFamily(editor_->font_, settings->value("font"), editorDefaults->font_);
editor_->fontSize_->setValue(settings->value("fontSize", editorDefaults->font_.pixelSize()).toInt());
editor_->fontAntialiasing_->setChecked(settings->value("fontAntialiasing", editorDefaults->fontAntialiasing_).toBool());
editor_->subpixelAntialiasing_->setChecked(!settings->value("speedOverQuality", !editorDefaults->subpixelAntialiasing_).toBool());
editor_->lineSpacing_->setValue(settings->value("lineSpacing", editorDefaults->lineSpacing_).toInt());
editor_->showLineNumbers_->setChecked(settings->value("showLineNumbers", editorDefaults->showLineNumbers_).toBool());
editor_->showWhitespace_->setChecked(settings->value("showWhitespace", editorDefaults->showWhitespace_).toBool());
editor_->autoIndent_->setChecked(settings->value("autoIndent", true).toBool());
{
bool on = settings->value("tabIndentMode", true).toBool();
if (on)
editor_->tabIndentMode_->setChecked(true);
else
editor_->spaceIndentMode_->setChecked(true);
}
editor_->tabWidth_->setValue(settings->value("tabWidth", editorDefaults->tabWidth_).toInt());
editor_->indentWidth_->setValue(settings->value("indentWidth", editorDefaults->tabWidth_).toInt());
settings->endGroup();
}
if ((selection & Terminal) != 0) {
settings->beginGroup("terminal");
setFontFamily(terminal_->font_, settings->value("font"), terminalDefaults->font_);
terminal_->fontSize_->setValue(settings->value("fontSize", terminalDefaults->font_.pixelSize()).toInt());
terminal_->fontAntialiasing_->setChecked(settings->value("fontAntialiasing", terminalDefaults->fontAntialiasing_).toBool());
terminal_->subpixelAntialiasing_->setChecked(!settings->value("speedOverQuality", !terminalDefaults->subpixelAntialiasing_).toBool());
terminal_->lineSpacing_->setValue(settings->value("lineSpacing", terminalDefaults->lineSpacing_).toInt());
terminal_->endlessLogging_->setChecked(settings->value("endlessLogging", true).toBool());
terminal_->numberOfLines_->setValue(settings->value("numberOfLines", terminal_->numberOfLines_->maximum()).toInt());
{
Ref<Palette> palette = paletteManager_->paletteByName(settings->value("palette", "Default").toString());
for (int i = 0, n = paletteIndices_.length(); i < n; ++i)
if (paletteManager_->paletteByIndex(paletteIndices_.at(i)) == palette)
terminal_->palette_->setCurrentIndex(i);
}
{
QString title = settings->value("title", "$FG").toString();
int titleIndex = terminal_->title_->findText(title);
if (titleIndex != -1) terminal_->title_->setCurrentIndex(titleIndex);
else terminal_->title_->setEditText(title);
}
settings->endGroup();
}
if ((selection & Printing) != 0) {
settings->beginGroup("printing");
setFontFamily(printing_->font_, settings->value("font"), editorDefaults->font_);
printing_->fontSize_->setValue(settings->value("fontSize", 10).toInt());
printing_->fontAntialiasing_->setChecked(settings->value("fontAntialiasing", editorDefaults->fontAntialiasing_).toBool());
printing_->lineSpacing_->setValue(settings->value("lineSpacing", 1).toInt());
printing_->showLineNumbers_->setChecked(settings->value("showLineNumbers", editorDefaults->showLineNumbers_).toBool());
printing_->showWhitespace_->setChecked(settings->value("showWhitespace", false).toBool());
printing_->pageHeader_->setChecked(settings->value("printingPageHeader", true).toBool());
printing_->pageBorder_->setChecked(settings->value("printingPageBorder", true).toBool());
settings->endGroup();
}
if ((selection & Theme) != 0) {
settings->beginGroup("theme");
if (settings->contains("activeTheme"))
themesView_->setCurrentIndex(themesView_->model()->index(themeManager_->themeIndex(settings->value("activeTheme").toString()), 0));
else
themesView_->setCurrentIndex(themesView_->model()->index(themeManager_->defaultThemeIndex(), 0));
settings->endGroup();
}
if ((selection & Commands) != 0) {
settings->beginGroup("commands");
{
QVariantList list = settings->value("commands", QVariantList()).toList();
commandsList_->clear();
for (int i = 0; i < list.size(); ++i) {
QxCommand* cmd = new QxCommand(parent());
connect(cmd, SIGNAL(triggered(QxCommand*)), this, SIGNAL(commandTriggered(QxCommand*)));
QAction* action = new QAction(parent());
// parentWidget()->addAction(action);
cmd->assignAction(action);
QVariantList al = list.at(i).toList();
cmd->restore(list.at(i).toList());
cmd->updateAction();
commandsList_->append(cmd);
}
// commands_->view_->resizeColumnToContents(0);
}
settings->endGroup();
}
示例5: data
QVariant FeedsViewModel::data(const QVariantList &indexPath) {
return m_resultList.at(indexPath.at(0).toInt());
}
示例6: textValueToString
void MarkerUtils::textValueToString(const QVariantList &value, QString &string) {
string += value.at(0).toString() + " ";
string += value.at(1).toString();
}
示例7: insertOrUpdate
/*! id is the object's row in the database (for updates), or 0 (for inserts).
table is the database table name
colNames is a list of the column names that the values will be inserted under
values is a list of QVariants that provide the values to insert.
(Note that the const& arguments are designed to prevent memory copies, so this should be fast.)
Return value: (IMPORTANT) returns the id of the row that was inserted into or updated, or 0 on failure.
When inserting new objects, make sure to set their id to the return value afterwards, otherwise they will be duplicated on next insert.
Note: This is equivalent to an SQL "INSERT OR REPLACE" (or "REPLACE", in MySQL) command. If a row with \c id exists, it will be replaced completely, so you need to specify ALL column values. To change just some column values, use update().
*/
int AMDatabase::insertOrUpdate(int id, const QString& table, const QStringList& colNames, const QVariantList& values) {
QSqlDatabase db = qdb();
if(!db.isOpen()) {
AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -2, "Could not save to database. (Database is not open.)"));
return 0;
}
// Create the list of columns:
QString cols = colNames.join(", "); // this will become something like "name, number, sampleName, comments, startTime"
QString colPlaceholders;
for(int i=0; i<colNames.count()+1; i++)
colPlaceholders.append("?, ");
colPlaceholders.chop(2); // remove trailing ", " from "?, ?, ?, ?, ...?, "
// placeholders will become something like "?, ?, ?, ?, ?, ?", with enough ? for each column name + the id
// Prepare the query. Todo: sanitize column names and table name. (Can't use binding because it's not an expression here)
QSqlQuery query(db);
query.prepare(QString("INSERT OR REPLACE INTO %1 (id, %2) VALUES (%3)").arg(table).arg(cols).arg(colPlaceholders));
// If we have a unique id already, use that (This will update ourself in the DB)
if(id > 0)
query.bindValue(0, id);
// Otherwise, use NULL for the id. (This will create a new one.)
else
query.bindValue(0, QVariant(QVariant::Int));
// Bind remaining values
for(int i=0; i<colNames.count(); i++)
query.bindValue(i+1, values.at(i));
// Run query. Query failed?
if(!execQuery(query)) {
query.finish(); // make sure that sqlite lock is released before emitting signals
AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -3, QString("database save failed. Could not execute query (%1). The SQL reply was: %2").arg(query.executedQuery()).arg(query.lastError().text())));
return 0;
}
// Query succeeded.
// If we don't have one, set the unique id for this object (now that the database has established it)
if(id < 1) {
QVariant lastId = query.lastInsertId();
query.finish(); // make sure that sqlite lock is released before emitting signals
if(lastId.isValid()) {
emit created(table, lastId.toInt());
return lastId.toInt();
}
else {
query.finish(); // make sure that sqlite lock is released before emitting signals
AMErrorMon::report(AMErrorReport(this, AMErrorReport::Debug, -4, "Database save completed, but could not get the last id after insert. This should never happen."));
emit updated(table, -1);
return 0;
}
}
// else (we already had an id, which was used for successful insert:
else {
query.finish(); // make sure that sqlite lock is released before emitting signals
emit updated(table, id);
return id;
}
}
示例8: invokeSignal
void QDocumentServerContentStorePrivate::invokeSignal( const QDocumentServerMessage &message )
{
const QByteArray signature = message.signature();
const QVariantList arguments = message.arguments();
if( signature == "insertContentIntoSet(int,int,int)" )
{
Q_ASSERT( arguments.count() == 3 );
QDocumentServerContentSetEngine *contentSet = contentSets.value( arguments[ 0 ].toInt(), 0 );
if( contentSet )
{
contentSet->insertContent( arguments[ 1 ].toInt(), arguments[ 2 ].toInt() );
}
}
else if( signature == "removeContentFromSet(int,int,int)" )
{
Q_ASSERT( arguments.count() == 3 );
QDocumentServerContentSetEngine *contentSet = contentSets.value( arguments[ 0 ].toInt(), 0 );
if( contentSet )
{
contentSet->removeContent( arguments[ 1 ].toInt(), arguments[ 2 ].toInt() );
}
}
else if( signature == "contentSetChanged(int,int,int)" )
{
Q_ASSERT( arguments.count() == 3 );
QDocumentServerContentSetEngine *contentSet = contentSets.value( arguments[ 0 ].toInt(), 0 );
if( contentSet )
{
contentSet->refreshContent( arguments[ 1 ].toInt(), arguments[ 2 ].toInt() );
}
}
else if( signature == "contentSetUpdateStarted(int)" )
{
Q_ASSERT( arguments.count() == 1 );
QDocumentServerContentSetEngine *contentSet = contentSets.value( arguments[ 0 ].toInt(), 0 );
if( contentSet )
{
contentSet->updateStarted();
}
}
else if( signature == "contentSetUpdateFinished(int)" )
{
Q_ASSERT( arguments.count() == 1 );
QDocumentServerContentSetEngine *contentSet = contentSets.value( arguments.at( 0 ).toInt(), 0 );
if( contentSet )
{
contentSet->updateFinished();
}
}
}
示例9: parseJson
bool LoadTagsResponseJSON::parseJson(const QByteArray &data)
{
clearContainers();
QJson::Parser parser;
bool ok;
QVariantMap result = parser.parse(data, &ok).toMap();
if (!ok) return false;
result["errno"].toInt(&ok);
if (!ok) return false;
m_errno = result["errno"].toInt(&ok);
QVariantMap rss = result["rss"].toMap();
QVariantMap channelVariant = rss["channels"].toMap();
QVariantList channelsList = channelVariant["items"].toList();
int size = channelsList.size();
for (int i = 0; i < size; i++)
{
QVariantMap channelDesc = channelsList.at(i).toMap();
QVariantList markList = channelDesc["items"].toList();
QString channelName = channelDesc["name"].toString();
QSharedPointer<Channel> channel(new JsonChannel(channelName,"dummy channel[LoadTagsResponse]"));
for(int j=0; j<markList.size(); j++)
{
QVariantMap markMap = markList.at(j).toMap();
QString title = markMap["title"].toString();
QString link = markMap["link"].toString();
QString description = markMap["description"].toString();
double altitude = markMap["altitude"].toString().toDouble(&ok);
if (!ok) return false;
double latitude = markMap["latitude"].toString().toDouble(&ok);
if (!ok) return false;
double longitude = markMap["longitude"].toString().toDouble(&ok);
if (!ok) return false;
QString userName = markMap["user"].toString();
QString timeStr = markMap["pubDate"].toString();
QDateTime time = QDateTime::fromString(timeStr, "dd MM yyyy HH:mm:ss.zzz");
QVector<QSharedPointer<common::User> > v = m_usersContainer->vector();
QSharedPointer<common::User> user(new JsonUser(userName));
m_usersContainer->push_back(user);
QSharedPointer<JsonDataMark> newMark(new JsonDataMark(altitude,
latitude,
longitude,
title,
description,
link,
time));
newMark->setUser(user);
m_hashMap.insert(channel, newMark);
}
}
return true;
}
示例10: updateEditWidget
void TabEdit::updateEditWidget()
{
if (!m_isInitialized) {
return;
}
QStringList filenames = getTemplateNames();
if (filenames.isEmpty()) {
ui_list_edit->setVisible(false);
ui_edit_edit->setVisible(false);
if (m_opt->optimizer()->getNumberOfOptSteps() !=
ui_list_optStep->count()) {
this->populateOptStepList();
}
return;
}
int templateInd = ui_combo_templates->currentIndex();
QString templateName = ui_combo_templates->currentText();
Q_ASSERT(templateInd >= 0 && templateInd < filenames.size());
Q_ASSERT(templateName.compare(filenames.at(templateInd)) == 0);
if (m_opt->optimizer()->getIDString().compare("VASP") == 0 &&
templateName.compare("POTCAR") == 0) {
if (m_opt->optimizer()->getNumberOfOptSteps() !=
ui_list_optStep->count()) {
populateOptStepList();
}
int optStepIndex = ui_list_optStep->currentRow();
Q_ASSERT(optStepIndex >= 0 &&
optStepIndex < m_opt->optimizer()->getNumberOfOptSteps());
// Display appropriate entry widget.
ui_list_edit->setVisible(true);
ui_edit_edit->setVisible(false);
XtalOpt *xtalopt = qobject_cast<XtalOpt*>(m_opt);
VASPOptimizer *vopt = qobject_cast<VASPOptimizer*>(m_opt->optimizer());
// Do we need to update the POTCAR info?
if (!vopt->POTCARInfoIsUpToDate(xtalopt->comp.keys())) {
if (!generateVASP_POTCAR_info()) {
return;
}
vopt->buildPOTCARs();
}
// Build list in GUI
// "POTCAR info" is of type
// QList<QHash<QString, QString> >
// e.g. a list of hashes containing
// [atomic symbol : pseudopotential file] pairs
QVariantList potcarInfo = m_opt->optimizer()->getData("POTCAR info").toList();
QList<QString> symbols = potcarInfo.at(optStepIndex).toHash().keys();
qSort(symbols);
ui_list_edit->clear();
for (int i = 0; i < symbols.size(); i++) {
ui_list_edit->addItem(tr("%1: %2")
.arg(symbols.at(i), 2)
.arg(potcarInfo.at(optStepIndex).toHash()[symbols.at(i)].toString()));
}
}
// Default for all templates using text entry
else {
AbstractEditTab::updateEditWidget();
}
}
示例11: packDataValue
void packDataValue(QVariant_ *var, DataValue *value)
{
QVariant *qvar = reinterpret_cast<QVariant *>(var);
// Some assumptions are made below regarding the size of types.
// There's apparently no better way to handle this since that's
// how the types with well defined sizes (qint64) are mapped to
// meta-types (QMetaType::LongLong).
switch ((int)qvar->type()) {
case QVariant::Invalid:
value->dataType = DTInvalid;
break;
case QMetaType::QUrl:
*qvar = qvar->value<QUrl>().toString();
// fallthrough
case QMetaType::QString:
{
value->dataType = DTString;
QByteArray ba = qvar->toByteArray();
*(char**)(value->data) = local_strdup(ba.constData());
value->len = ba.size();
break;
}
case QMetaType::Bool:
value->dataType = DTBool;
*(qint8*)(value->data) = (qint8)qvar->toInt();
break;
case QMetaType::LongLong:
// Some of these entries will have to be fixed when handling platforms
// where sizeof(long long) != 8 or sizeof(int) != 4.
value->dataType = DTInt64;
*(qint64*)(value->data) = qvar->toLongLong();
break;
case QMetaType::ULongLong:
value->dataType = DTUint64;
*(quint64*)(value->data) = qvar->toLongLong();
break;
case QMetaType::Int:
value->dataType = DTInt32;
*(qint32*)(value->data) = qvar->toInt();
break;
case QMetaType::UInt:
value->dataType = DTUint32;
*(quint32*)(value->data) = qvar->toUInt();
break;
case QMetaType::VoidStar:
value->dataType = DTUintptr;
*(uintptr_t*)(value->data) = (uintptr_t)qvar->value<void *>();
break;
case QMetaType::Double:
value->dataType = DTFloat64;
*(double*)(value->data) = qvar->toDouble();
break;
case QMetaType::Float:
value->dataType = DTFloat32;
*(float*)(value->data) = qvar->toFloat();
break;
case QMetaType::QColor:
value->dataType = DTColor;
*(unsigned int*)(value->data) = qvar->value<QColor>().rgba();
break;
case QMetaType::QVariantList:
{
QVariantList varlist = qvar->toList();
int len = varlist.size();
DataValue *dvlist = (DataValue *) malloc(sizeof(DataValue) * len);
for (int i = 0; i < len; i++) {
packDataValue((void*)&varlist.at(i), &dvlist[i]);
}
value->dataType = DTValueList;
value->len = len;
*(DataValue**)(value->data) = dvlist;
}
break;
case QMetaType::QVariantMap:
{
QVariantMap varmap = qvar->toMap();
int len = varmap.size() * 2;
DataValue *dvlist = (DataValue *) malloc(sizeof(DataValue) * len);
QMapIterator<QString, QVariant> it(varmap);
for (int i = 0; i < len; i += 2) {
if (!it.hasNext()) {
panicf("QVariantMap mutated during iteration");
}
it.next();
QVariant key = it.key();
QVariant val = it.value();
packDataValue((void*)&key, &dvlist[i]);
packDataValue((void*)&val, &dvlist[i+1]);
}
value->dataType = DTValueMap;
value->len = len;
*(DataValue**)(value->data) = dvlist;
}
break;
default:
if (qvar->type() == (int)QMetaType::QObjectStar || qvar->canConvert<QObject *>()) {
QObject *qobject = qvar->value<QObject *>();
GoValue *goValue = dynamic_cast<GoValue *>(qobject);
if (goValue) {
//.........这里部分代码省略.........
示例12: onNetworkReply
void Updater::onNetworkReply(QNetworkReply *reply)
{
if (reply != m_reply) {
// Reply not for the latest request. Ignore it.
reply->deleteLater();
setBusy(false);
return;
}
m_reply = NULL;
if (reply->error() == QNetworkReply::OperationCanceledError) {
// Operation was canceled by us, ignore this error.
reply->deleteLater();
setBusy(false);
return;
}
if (reply->error() != QNetworkReply::NoError) {
qWarning() << reply->errorString();
emit error(reply->errorString());
reply->deleteLater();
setBusy(false);
return;
}
const QVariantList releases = parseJson(reply->readAll());
reply->deleteLater();
if (releases.isEmpty()) {
setBusy(false);
return;
}
int k = 0;
QVariantMap release = releases.at(0).toMap();
while (release.value("prerelease").toBool()
|| release.value("draft").toBool()
|| (release.value("tag_name").toString().contains("-")
&& !release.value("tag_name").toString().endsWith("-" + m_variant))) {
release = releases.at(++k).toMap();
}
const QString name = release.value("tag_name").toString();
const QString title = release.value("name").toString();
const QString changeLog = release.value("body").toString();
const int version = parseVersion(name);
if (version < 0) {
emit error(tr("Couldn't parse release version"));
setBusy(false);
return;
}
m_numericLatestVersion = parseVersion(name);
if (m_latestRelease)
delete m_latestRelease;
m_latestRelease = new Release(name, title, changeLog, this);
emit latestReleaseChanged();
if (!m_latestReleaseValid) {
m_latestReleaseValid = true;
emit latestReleaseValidChanged();
}
setUpdateAvailable(m_numericCurrentVersion < m_numericLatestVersion);
setBusy(false);
}
示例13: fcnLength
static QVariant fcnLength( const QVariantList& values, QgsFeature* , QgsExpression* parent )
{
QString str = getStringValue( values.at( 0 ), parent );
return QVariant( str.length() );
}
示例14: fcnToString
static QVariant fcnToString( const QVariantList& values, QgsFeature* , QgsExpression* parent )
{
return QVariant( getStringValue( values.at( 0 ), parent ) );
}
示例15: timerEvent
/**
* timer is running with 50 ms speed
*/
void MutexKnobData::timerEvent(QTimerEvent *)
{
double diff, repRate;
char units[40];
char fec[40];
char dataString[1024];
struct timeb now;
if(blockProcess) return;
ftime(&now);
//qDebug() << "============================================";
for(int i=0; i < GetMutexKnobDataSize(); i++) {
knobData *kPtr = (knobData*) &KnobData[i];
if(kPtr->index != -1) {
diff = ((double) now.time + (double) now.millitm / (double)1000) -
((double) kPtr->edata.lastTime.time + (double) kPtr->edata.lastTime.millitm / (double)1000);
if(kPtr->edata.repRate < 1) repRate = 1;
else repRate = kPtr->edata.repRate;
}
// update all graphical items for this soft pv when a value changes
if(kPtr->index != -1 && kPtr->soft && (diff >= (1.0/(double)repRate))) {
int indx;
//qDebug() << "I am a soft channel" << kPtr->pv << kPtr->dispName << kPtr->edata.rvalue << kPtr->index;
// get for this soft pv the index of the corresponding caCalc into the knobData array where the data were updated
if(getSoftPV(kPtr->pv, &indx, (QWidget*) kPtr->thisW)) {
// get value from (updated) QMap variable list
knobData *ptr = (knobData*) &KnobData[indx];
kPtr->edata.rvalue = ptr->edata.rvalue;
kPtr->edata.fieldtype = caDOUBLE;
kPtr->edata.connected = true;
kPtr->edata.accessW = true;
kPtr->edata.accessR = true;
//increase monitor count when value has changed
if(kPtr->edata.oldsoftvalue != ptr->edata.rvalue) {
//qDebug() << kPtr->pv << kPtr->dispName << "will be updated with value=" << ptr->edata.rvalue << "from" << ptr->pv << "index=" << ptr->index << "oldvalue=" << kPtr->edata.oldsoftvalue;
kPtr->edata.monitorCount++;
}
// when any monitors for calculation increase monitorcount
QWidget *w1 = (QWidget*) kPtr->dispW;
QVariant var = w1->property("MonitorList");
QVariantList list = var.toList();
if(list.size() > 0) {
int nbMonitors = list.at(0).toInt();
if(nbMonitors > 0) {
kPtr->edata.monitorCount++;
}
}
kPtr->edata.oldsoftvalue = ptr->edata.rvalue;
QWidget *ww = (QWidget *)kPtr->dispW;
if (caTextEntry *widget = qobject_cast<caTextEntry *>(ww)) {
widget->setAccessW(kPtr->edata.accessW);
}
}
}
// use specified repetition rate (normally 5Hz)
if( ((kPtr->index != -1) && (kPtr->edata.monitorCount > kPtr->edata.displayCount) && (diff >= (1.0/(double)repRate)))){
/*
printf("<%s> index=%d mcount=%d dcount=%d value=%f datasize=%d valuecount=%d\n", kPtr->pv, kPtr->index, kPtr->edata.monitorCount,
kPtr->edata.displayCount, kPtr->edata.rvalue,
kPtr->edata.dataSize, kPtr->edata.valueCount);
*/
if((myUpdateType == UpdateTimed) || kPtr->soft) {
QMutexLocker locker(&mutex);
int index = kPtr->index;
QWidget *dispW = (QWidget*) kPtr->dispW;
dataString[0] = '\0';
strcpy(units, kPtr->edata.units);
strcpy(fec, kPtr->edata.fec);
int caFieldType= kPtr->edata.fieldtype;
if((caFieldType == DBF_STRING || caFieldType == DBF_ENUM || caFieldType == DBF_CHAR) && kPtr->edata.dataB != (void*) 0) {
if(kPtr->edata.dataSize < 1024) {
memcpy(dataString, (char*) kPtr->edata.dataB, kPtr->edata.dataSize);
dataString[kPtr->edata.dataSize] = '\0';
} else {
memcpy(dataString, (char*) kPtr->edata.dataB, 1024);
dataString[1023] = '\0';
}
}
kPtr->edata.displayCount = kPtr->edata.monitorCount;
locker.unlock();
UpdateWidget(index, dispW, units, fec, dataString, KnobData[index]);
kPtr->edata.lastTime = now;
kPtr->edata.initialize = false;
displayCount++;
}
} else if ((kPtr->index != -1) && (diff >= (1.0/(double)repRate))) {
if( (!kPtr->edata.connected)) {
//.........这里部分代码省略.........