本文整理汇总了C++中DataContainer::image方法的典型用法代码示例。如果您正苦于以下问题:C++ DataContainer::image方法的具体用法?C++ DataContainer::image怎么用?C++ DataContainer::image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataContainer
的用法示例。
在下文中一共展示了DataContainer::image方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareImages
void FontDocument::prepareImages(Settings::Presets::Preset *preset, const QStringList &orderedKeys, QMap<QString, Parsing::ParsedImageData *> *images, const Parsing::TagsList &tags) const
{
DataContainer *data = this->dataContainer();
// collect ParsedImageData
{
QListIterator<QString> it(orderedKeys);
it.toFront();
while (it.hasNext()) {
const QString key = it.next();
QImage image = QImage(*data->image(key));
Parsing::ParsedImageData *data = new Parsing::ParsedImageData(preset, &image, tags);
images->insert(key, data);
}
}
// collect other info
{
bool useBom = preset->font()->bom();
QString encoding = preset->font()->encoding();
QListIterator<QString> it(orderedKeys);
it.toFront();
while (it.hasNext()) {
QString key = it.next();
Parsing::ParsedImageData *imageData = images->value(key);
if (imageData != nullptr) {
QString charCode = this->hexCode(key, encoding, useBom);
imageData->tags()->setTagValue(Parsing::TagsList::Tag::OutputCharacterCode, charCode);
imageData->tags()->setTagValue(Parsing::TagsList::Tag::OutputCharacterText, Parsing::Conversion::FontHelper::escapeControlChars(key));
}
}
}
// find duplicates
{
// map of same character keys by hash
QMap<uint, Parsing::ParsedImageData *> similarMap;
QListIterator<QString> it(orderedKeys);
it.toFront();
while (it.hasNext()) {
QString key = it.next();
Parsing::ParsedImageData *imageData = images->value(key);
if (imageData != nullptr) {
// detect same characters
Parsing::ParsedImageData *similarImageData = similarMap.value(imageData->hash(), nullptr);
if (similarImageData != nullptr) {
QString similarCode = similarImageData->tags()->tagValue(Parsing::TagsList::Tag::OutputCharacterCode);
QString similarText = similarImageData->tags()->tagValue(Parsing::TagsList::Tag::OutputCharacterText);
imageData->tags()->setTagValue(Parsing::TagsList::Tag::OutputCharacterCodeSimilar, similarCode);
imageData->tags()->setTagValue(Parsing::TagsList::Tag::OutputCharacterTextSimilar, similarText);
} else {
similarMap.insert(imageData->hash(), imageData);
imageData->tags()->setTagValue(Parsing::TagsList::Tag::OutputCharacterCodeSimilar, QString());
imageData->tags()->setTagValue(Parsing::TagsList::Tag::OutputCharacterTextSimilar, QString());
}
}
}
}
}