本文整理汇总了C++中models::ArtworkMetadata::appendKeywords方法的典型用法代码示例。如果您正苦于以下问题:C++ ArtworkMetadata::appendKeywords方法的具体用法?C++ ArtworkMetadata::appendKeywords怎么用?C++ ArtworkMetadata::appendKeywords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models::ArtworkMetadata
的用法示例。
在下文中一共展示了ArtworkMetadata::appendKeywords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: modifyArtworksItem
std::shared_ptr<Commands::ICommandResult> Commands::PasteKeywordsCommand::execute(const ICommandManager *commandManagerInterface) const {
LOG_INFO << "Pasting" << m_KeywordsList.length() << "keywords to" << m_MetadataElements.size() << "item(s)";
CommandManager *commandManager = (CommandManager*)commandManagerInterface;
QVector<int> indicesToUpdate;
std::vector<UndoRedo::ArtworkMetadataBackup> artworksBackups;
QVector<Models::ArtworkMetadata*> itemsToSave;
size_t size = m_MetadataElements.size();
indicesToUpdate.reserve((int)size);
artworksBackups.reserve(size);
itemsToSave.reserve((int)size);
for (size_t i = 0; i < size; ++i) {
const Models::MetadataElement &element = m_MetadataElements.at(i);
Models::ArtworkMetadata *metadata = element.getOrigin();
indicesToUpdate.append(element.getOriginalIndex());
artworksBackups.emplace_back(metadata);
metadata->appendKeywords(m_KeywordsList);
itemsToSave.append(metadata);
}
if (size > 0) {
commandManager->submitForSpellCheck(itemsToSave);
commandManager->submitForWarningsCheck(itemsToSave);
commandManager->saveArtworksBackups(itemsToSave);
std::unique_ptr<UndoRedo::IHistoryItem> modifyArtworksItem(new UndoRedo::ModifyArtworksHistoryItem(artworksBackups, indicesToUpdate,
UndoRedo::PasteModificationType));
commandManager->recordHistoryItem(modifyArtworksItem);
} else {
LOG_WARNING << "Pasted zero real words!";
}
std::shared_ptr<PasteKeywordsCommandResult> result(new PasteKeywordsCommandResult(indicesToUpdate));
return result;
}