本文整理汇总了C++中QVariantList::removeAt方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantList::removeAt方法的具体用法?C++ QVariantList::removeAt怎么用?C++ QVariantList::removeAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariantList
的用法示例。
在下文中一共展示了QVariantList::removeAt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rmDevice
QVariantMap RmDeviceOperation::rmDevice(const QVariantMap &map, const QString &id)
{
QVariantMap result = map;
QVariantMap dmMap = map.value(QLatin1String(DEVICEMANAGER_ID)).toMap();
bool found = false;
QVariantList devList = GetOperation::get(dmMap, QLatin1String(DEVICE_LIST_ID)).toList();
for (int i = 0; i < devList.count(); ++i) {
QVariant value = devList.at(i);
if (value.type() != QVariant::Map)
continue;
QVariantMap deviceData = value.toMap();
QString devId = deviceData.value(QLatin1String(DEVICE_ID_ID)).toString();
if (devId == id) {
found = true;
devList.removeAt(i);
break;
}
}
dmMap.insert(QLatin1String(DEVICE_LIST_ID), devList);
result.insert(QLatin1String(DEVICEMANAGER_ID), dmMap);
if (!found)
std::cerr << "Device " << qPrintable(id) << " not found." << std::endl;
return result;
}
示例2: scanImageInformation
void ImageScanner::scanImageInformation()
{
DatabaseFields::ImageInformation dbFields = DatabaseFields::ImageInformationAll;
QVariantList infos;
if (m_scanMode == NewScan || m_scanMode == Rescan)
{
MetadataFields fields;
fields << MetadataInfo::Rating
<< MetadataInfo::CreationDate
<< MetadataInfo::DigitizationDate
<< MetadataInfo::Orientation;
QVariantList metadataInfos = m_metadata.getMetadataFields(fields);
// creation date: fall back to file system property
if (metadataInfos[1].isNull() || !metadataInfos[1].toDateTime().isValid())
{
metadataInfos[1] = creationDateFromFilesystem(m_fileInfo);
}
// Some fields should only be overwritten if set in metadata
if (m_scanMode == Rescan)
{
if (metadataInfos[0].isNull() || metadataInfos[0].toInt() == -1)
{
dbFields &= ~DatabaseFields::Rating;
metadataInfos.removeAt(0);
}
}
infos << metadataInfos;
}
QSize size = m_img.size();
infos << size.width()
<< size.height()
<< detectFormat()
<< m_img.originalBitDepth()
<< m_img.originalColorModel();
if (m_scanMode == NewScan)
{
DatabaseAccess().db()->addImageInformation(m_scanInfo.id, infos, dbFields);
}
else if (m_scanMode == Rescan)
{
DatabaseAccess().db()->changeImageInformation(m_scanInfo.id, infos, dbFields);
}
else // ModifiedScan
{
// Does _not_ update rating and orientation!
DatabaseAccess().db()->changeImageInformation(m_scanInfo.id, infos,
DatabaseFields::Width |
DatabaseFields::Height |
DatabaseFields::Format |
DatabaseFields::ColorDepth |
DatabaseFields::ColorModel);
}
}
示例3: removeAccountAt
void AccountList::removeAccountAt(int i)
{
JsonDataAccess jda;
QVariantList list = jda.load(this->file).value<QVariantList>();
list.removeAt(i);
jda.save(QVariant(list), this->file);
loadAccounts();
}
示例4: scanItemInformation
void ItemScanner::scanItemInformation()
{
d->commit.commitItemInformation = true;
if (d->scanMode == NewScan || d->scanMode == Rescan)
{
d->commit.imageInformationFields = DatabaseFields::ItemInformationAll;
MetadataFields fields;
fields << MetadataInfo::Rating
<< MetadataInfo::CreationDate
<< MetadataInfo::DigitizationDate
<< MetadataInfo::Orientation;
QVariantList metadataInfos = d->metadata.getMetadataFields(fields);
checkCreationDateFromMetadata(metadataInfos[1]);
if (!checkRatingFromMetadata(metadataInfos.at(0)))
{
d->commit.imageInformationFields &= ~DatabaseFields::Rating;
metadataInfos.removeAt(0);
}
d->commit.imageInformationInfos = metadataInfos;
}
else
{
// Does _not_ update rating and orientation (unless dims were exchanged)!
/*
int orientation = d->metadata.getItemOrientation();
QVariantList data = CoreDbAccess().db()->getItemInformation(d->scanInfo.id,
DatabaseFields::Width |
DatabaseFields::Height |
DatabaseFields::Orientation);
if (data.size() == 3 && data[2].isValid() && data[2].toInt() != orientation)
{
// be careful not to overwrite our value set in the database
// But there is a special case: if the dims were
}
*/
d->commit.imageInformationFields =
DatabaseFields::Width |
DatabaseFields::Height |
DatabaseFields::Format |
DatabaseFields::ColorDepth |
DatabaseFields::ColorModel;
}
QSize size = d->img.size();
d->commit.imageInformationInfos
<< size.width()
<< size.height()
<< detectImageFormat()
<< d->img.originalBitDepth()
<< d->img.originalColorModel();
}
示例5: editAccount
void AccountList::editAccount(int i, QString name, int start, int stop)
{
JsonDataAccess jda;
QVariantList list = jda.load(this->file).value<QVariantList>();
QVariantMap acc;
acc["name"] = QVariant(name);
acc["start"] = QVariant(start);
acc["stop"] = QVariant(stop);
list.removeAt(i);
list.insert(i, QVariant(acc));
jda.save(QVariant(list), this->file);
loadAccounts();
}
示例6: removeExtensionsThatDoNotMustBeOpened
/*!
\param extsToDetect List of extensions to detect.
*/
void TNxSpooler::removeExtensionsThatDoNotMustBeOpened(QStringList &extsToDetect) const
{
QDEBUG_METHOD_NAME;
// List of "booleans" that indicate if the extension must be opened only if found inside a container file, a ".nxspooler-open" file
QVariantList onlyInsideContainer = m_settings.value("onlyInsideContainer").toList();
int quant_exts = extsToDetect.size();
for (int i = 0; i < quant_exts && quant_exts > 0; i++)
{
if (onlyInsideContainer.value(i).toBool() == true)
{
extsToDetect.removeAt(i);
onlyInsideContainer.removeAt(i);
// We change the loop variables to get the correct next item
i--;
quant_exts--;
}
}
}
示例7: setting_changed_list
void Settings::setting_changed_list(QListWidgetItem* item)
{
QObject* sender = this->sender();
QListWidget* listw = dynamic_cast<QListWidget*>(sender);
if (listw)
{
const QString module_name = sender->parent()->objectName();
const int index = listw->row(item);
QVariantList list = map_[module_name][sender->objectName()].toList();
if (item->text().isEmpty())
list.removeAt(index);
else
{
if (index >= list.size())
list.push_back(QVariant(item->text()));
else
list[index] = QVariant(item->text());
}
map_[module_name][sender->objectName()] = QVariant(list);
}
}