本文整理汇总了C++中colorlist::Iterator类的典型用法代码示例。如果您正苦于以下问题:C++ Iterator类的具体用法?C++ Iterator怎么用?C++ Iterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Iterator类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: showTextColors
void PropertyWidget_TextColor::showTextColors(QString p, QString b, double shp, double shb)
{
if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
return;
ColorList::Iterator it;
int c = 0;
fillShade->setValue(qRound(shb));
strokeShade->setValue(qRound(shp));
if ((b != CommonStrings::None) && (!b.isEmpty()))
{
c++;
for (it = m_doc->PageColors.begin(); it != m_doc->PageColors.end(); ++it)
{
if (it.key() == b)
break;
c++;
}
}
fillColor->setCurrentIndex(c);
c = 0;
if ((p != CommonStrings::None) && (!p.isEmpty()))
{
for (it = m_doc->PageColors.begin(); it != m_doc->PageColors.end(); ++it)
{
if (it.key() == p)
break;
c++;
}
}
strokeColor->setCurrentIndex(c);
}
开发者ID:davinirjr,项目名称:scribus,代码行数:31,代码来源:propertywidget_textcolor.cpp
示例2: fillFillColorCombo
void SMCellStyleWidget::fillFillColorCombo(ColorList &colors)
{
fillColor->clear();
fillColor->addItem(CommonStrings::tr_NoneColor);
ColorList::Iterator itEnd = colors.end();
ScribusDoc* doc = colors.document();
for (ColorList::Iterator it = colors.begin(); it != itEnd; ++it)
{
fillColor->insertFancyItem(it.value(), doc, it.key());
}
fillColor->view()->setMinimumWidth(fillColor->view()->maximumViewportSize().width()+24);
}
开发者ID:JLuc,项目名称:scribus,代码行数:13,代码来源:smcellstylewidget.cpp
示例3: insertFancyPixmapItems
void ColorListBox::insertFancyPixmapItems(ColorList& list)
{
ColorList::Iterator it;
ScribusDoc* doc = list.document();
for (it = list.begin(); it != list.end(); ++it)
{
if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
continue;
addItem( new ColorPixmapItem(it.value(), doc, it.key()) );
}
if (itemDelegate())
delete itemDelegate();
setItemDelegate(new ColorFancyItemDelegate());
}
开发者ID:pvanek,项目名称:scribus-cuba-1.5.0,代码行数:14,代码来源:colorlistbox.cpp
示例4: ColorAPI
/**
* Scripter.colors
* Property
* returns a color object
*/
QList<QVariant> ScripterImpl::colors()
{
QList<QVariant> l;
ColorList names = PrefsManager::instance()->colorSet();
ColorList::Iterator it;
for (it = names.begin(); it != names.end(); ++it)
{
ScColor *value = &(names[it.key()]);
ColorAPI *color = new ColorAPI(value, it.key());
l.append(qVariantFromValue((QObject *)(color)));
}
return l;
}
开发者ID:QuLogic,项目名称:scribus-plugin-scripter,代码行数:19,代码来源:scripterimpl.cpp
示例5: ColorAPI
/**
* Scripter.activeDocument.colors
* Property
* Colors of activeDocument
*/
QList<QVariant> DocumentAPI::colors()
{
QList<QVariant> l;
ColorList names = ScCore->primaryMainWindow()->doc->PageColors;
ColorList::Iterator it;
for (it = names.begin(); it != names.end(); ++it)
{
ScColor *value = &(names[it.key()]);
ColorAPI *color = new ColorAPI(value, it.key());
l.append(qVariantFromValue((QObject *)(color)));
}
return l;
}
开发者ID:JLuc,项目名称:scribus,代码行数:19,代码来源:api_document.cpp
示例6: initColorList
void ColorCombo::initColorList(ColorList *colorList, ScribusDoc *doc, QString colorValue)
{
clear();
addItem(CommonStrings::tr_NoneColor, CommonStrings::None);
if (colorValue == CommonStrings::None)
setCurrentIndex(count()-1);
ColorList::Iterator endOfColorList(colorList->end());
for (ColorList::Iterator itc = colorList->begin(); itc != endOfColorList; ++itc)
{
insertFancyItem( itc.value(), doc, itc.key() );
if (itc.key() == colorValue)
setCurrentIndex(count()-1);
}
}
开发者ID:pvanek,项目名称:scribus-cuba-trunk,代码行数:14,代码来源:colorcombo.cpp
示例7: ensureWhite
void ColorList::ensureWhite(void)
{
bool addWhite = true;
ColorList::Iterator itw = find("White");
if (itw != end())
{
ScColor& white = itw.value();
colorModel model = white.getColorModel();
if (model == colorModelCMYK)
{
int c, m, y, k;
white.getCMYK(&c, &m, &y, &k);
if (c == 0 && m == 0 && y == 0 && k == 0)
addWhite = false;
}
}
if (addWhite)
insert("White", ScColor(0, 0, 0, 0));
}
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:19,代码来源:sccolor.cpp
示例8: ensureBlack
void ColorList::ensureBlack(void)
{
bool addBlack = true;
ColorList::Iterator itb = find("Black");
if (itb != end())
{
ScColor& black = itb.value();
colorModel model = black.getColorModel();
if (model == colorModelCMYK)
{
int c, m, y, k;
black.getCMYK(&c, &m, &y, &k);
if (c == 0 && m == 0 && y == 0 && k == 255)
addBlack = false;
}
}
if (addBlack)
insert("Black", ScColor(0, 0, 0, 255));
}
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:19,代码来源:sccolor.cpp
示例9: tryAddColor
QString ColorList::tryAddColor(QString name, ScColor col)
{
if (contains(name))
return name;
bool found = false;
QString ret = name;
ColorList::Iterator it;
for (it = begin(); it != end(); ++it)
{
if (it.value() == col)
{
ret = it.key();
found = true;
break;
}
}
if (!found)
insert(name, col);
return ret;
}
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:20,代码来源:sccolor.cpp
示例10: parseColor
QString gtAction::parseColor(const QString &s)
{
QString ret = CommonStrings::None;
if (s == CommonStrings::None)
return ret; // don't want None to become Black or any color
bool found = false;
ColorList::Iterator it;
for (it = textFrame->doc()->PageColors.begin(); it != textFrame->doc()->PageColors.end(); ++it)
{
if (it.key() == s)
{
ret = it.key();
found = true;
}
}
if (!found)
{
QColor c;
if( s.startsWith( "rgb(" ) )
{
QString parse = s.trimmed();
QStringList colors = parse.split(',', QString::SkipEmptyParts);
QString r = colors[0].right( ( colors[0].length() - 4 ) );
QString g = colors[1];
QString b = colors[2].left( ( colors[2].length() - 1 ) );
if( r.contains( "%" ) )
{
r.chop(1);
r = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(r) ) / 100.0 ) ) );
}
if( g.contains( "%" ) )
{
g.chop(1);
g = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(g) ) / 100.0 ) ) );
}
if( b.contains( "%" ) )
{
b.chop(1);
b = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(b) ) / 100.0 ) ) );
}
c = QColor(r.toInt(), g.toInt(), b.toInt());
}
else
{
QString rgbColor = s.trimmed();
if( rgbColor.startsWith( "#" ) )
c.setNamedColor( rgbColor );
else
c = parseColorN( rgbColor );
}
found = false;
for (it = textFrame->doc()->PageColors.begin(); it != textFrame->doc()->PageColors.end(); ++it)
{
if (c == ScColorEngine::getRGBColor(it.value(), textFrame->doc()))
{
ret = it.key();
found = true;
}
}
if (!found)
{
ScColor tmp;
tmp.fromQColor(c);
textFrame->doc()->PageColors.insert("FromGetText"+c.name(), tmp);
m_ScMW->propertiesPalette->updateColorList();
ret = "FromGetText"+c.name();
}
}
return ret;
}
开发者ID:WOF-Softwares,项目名称:ScribusCTL,代码行数:70,代码来源:gtaction.cpp
示例11: serializeObjects
void Serializer::serializeObjects(const Selection& selection, SaxHandler& outputhandler)
{
Xml_attr attr;
UniqueID handler( & outputhandler );
handler.beginDoc();
handler.begin("SCRIBUSFRAGMENT", attr);
ScribusDoc* doc = selection.itemAt(0)->doc();
QMap<QString,int>::Iterator itf;
for (itf = doc->UsedFonts.begin(); itf != doc->UsedFonts.end(); ++itf)
{
attr["name"] = itf.key();
handler.beginEnd("font", attr);
}
ColorList usedColors;
doc->getUsedColors(usedColors, false);
ColorList::Iterator itc;
for (itc = usedColors.begin(); itc != usedColors.end(); ++itc)
{
Xml_attr cattr;
cattr["name"] = itc.key();
if (doc->PageColors[itc.key()].getColorModel() == colorModelRGB)
cattr["RGB"] = doc->PageColors[itc.key()].nameRGB();
else
cattr["CMYK"] = doc->PageColors[itc.key()].nameCMYK();
cattr["Spot"] = toXMLString(doc->PageColors[itc.key()].isSpotColor());
cattr["Register"] = toXMLString(doc->PageColors[itc.key()].isRegistrationColor());
handler.beginEnd("color", cattr);
}
ResourceCollection lists;
for (int i=0; i < doc->Items->count(); ++i)
doc->Items->at(i)->getNamedResources(lists);
QList<QString>::Iterator it;
QList<QString> names = lists.styleNames();
for (it = names.begin(); it != names.end(); ++it)
doc->paragraphStyles().get(*it).saxx(handler);
names = lists.charStyleNames();
for (it = names.begin(); it != names.end(); ++it)
doc->charStyles().get(*it).saxx(handler);
names = lists.lineStyleNames();
for (it = names.begin(); it != names.end(); ++it)
{
Xml_attr multiattr;
multiattr["Name"] = *it;
handler.begin("MultiLine", multiattr);
multiLine ml = doc->MLineStyles[*it];
multiLine::Iterator itMU2;
for (itMU2 = ml.begin(); itMU2 != ml.end(); ++itMU2)
{
Xml_attr lineattr;
lineattr["Color"] = (*itMU2).Color;
lineattr["Shade"] = toXMLString((*itMU2).Shade);
lineattr["Dash"] = toXMLString((*itMU2).Dash);
lineattr["LineEnd"] = toXMLString((*itMU2).LineEnd);
lineattr["LineJoin"] = toXMLString((*itMU2).LineJoin);
lineattr["Width"] = toXMLString((*itMU2).Width);
handler.beginEnd("SubLine", lineattr);
}
handler.end("MultiLine");
}
/* names = lists.patterns();
for (it = names.begin(); it != names.end(); ++it)
doc->patterns[*it].saxx(handler);
*/
/*
QStringList patterns = doc->getUsedPatternsSelection((Selection*)&selection);
for (int c = 0; c < patterns.count(); ++c)
{
ScPattern& pa = doc->docPatterns[patterns[c]];
Xml_attr cattr;
cattr["Name"] = patterns[c];
cattr["scaleX"] = toXMLString(pa.scaleX);
cattr["scaleY"] = toXMLString(pa.scaleY);
cattr["width"] = toXMLString(pa.width);
cattr["height"] = toXMLString(pa.height);
cattr["xoffset"] = toXMLString(pa.xoffset);
cattr["yoffset"] = toXMLString(pa.yoffset);
handler.begin("Pattern", cattr);
for (int o = 0; o < pa.items.count(); o++)
{
pa.items.at(o)->saxx(handler);
}
handler.end("Pattern");
}
*/
for (int i=0; i < doc->Items->count(); ++i)
{
int k = selection.findItem(doc->Items->at(i));
if (k >=0)
doc->Items->at(i)->saxx(handler);
}
//.........这里部分代码省略.........
开发者ID:moceap,项目名称:scribus,代码行数:101,代码来源:serializer.cpp
示例12: import
//.........这里部分代码省略.........
baseY = 0;
if (!interactive || (flags & LoadSavePlugin::lfInsertPage))
{
m_Doc->setPage(b-x, h-y, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
m_Doc->view()->addPage(0, true);
baseX = 0;
baseY = 0;
}
else
{
if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
{
m_Doc=ScCore->primaryMainWindow()->doFileNew(b-x, h-y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
ScCore->primaryMainWindow()->HaveNewDoc();
ret = true;
baseX = 0;
baseY = 0;
}
}
if ((!ret) && (interactive))
{
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
if ((ret) || (!interactive))
{
if (b-x > h-y)
m_Doc->setPageOrientation(1);
else
m_Doc->setPageOrientation(0);
m_Doc->setPageSize("Custom");
}
ColorList::Iterator it;
for (it = CustColors.begin(); it != CustColors.end(); ++it)
{
if (!m_Doc->PageColors.contains(it.key()))
m_Doc->PageColors.insert(it.key(), it.value());
}
boundingBoxRect.addRect(0, 0, b-x, h-y);
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
if (convert(fName, x, y, b, h))
{
// m_Doc->m_Selection->clear();
tmpSel->clear();
QDir::setCurrent(CurDirP);
// if ((Elements.count() > 1) && (interactive))
if (Elements.count() > 1)
m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
if ((Elements.count() > 0) && (!ret) && (interactive))
{
if (flags & LoadSavePlugin::lfScripted)
{
bool loadF = m_Doc->isLoading();
开发者ID:gyuris,项目名称:scribus,代码行数:67,代码来源:importps.cpp
示例13: importColorsFromFile
bool importColorsFromFile(QString fileName, ColorList &EditColors, QHash<QString, VGradient> *dialogGradients, bool merge)
{
if (fileName.isEmpty())
return false;
int oldCount = EditColors.count();
QFileInfo fi = QFileInfo(fileName);
QString ext = fi.suffix().toLower();
if (extensionIndicatesEPSorPS(ext))
{
PaletteLoader_PS psPalLoader;
psPalLoader.setupTargets(&EditColors, dialogGradients);
return psPalLoader.importFile(fileName, merge);
}
else
{
QStringList allFormatsV = LoadSavePlugin::getExtensionsForColors();
if (allFormatsV.contains(ext))
{
FileLoader fl(fileName);
int testResult = fl.testFile();
if (testResult != -1)
{
ColorList LColors;
if (fl.readColors(LColors))
{
ColorList::Iterator it;
for (it = LColors.begin(); it != LColors.end(); ++it)
{
EditColors.tryAddColor(it.key(), it.value());
}
return (EditColors.count() != oldCount);
}
}
}
if (ext == "acb") // Adobe color book format
{
PaletteLoader_Adobe_acb adobePalLoader;
if (adobePalLoader.isFileSupported(fileName))
{
adobePalLoader.setupTargets(&EditColors, dialogGradients);
return adobePalLoader.importFile(fileName, merge);
}
PaletteLoader_Autocad_acb autocadPalLoder;
if (autocadPalLoder.isFileSupported(fileName))
{
autocadPalLoder.setupTargets(&EditColors, dialogGradients);
return autocadPalLoder.importFile(fileName, merge);
}
return false;
}
else if (ext == "aco") // Adobe color swatch format
{
PaletteLoader_Adobe_aco adobePalLoader;
if (adobePalLoader.isFileSupported(fileName))
{
adobePalLoader.setupTargets(&EditColors, dialogGradients);
return adobePalLoader.importFile(fileName, merge);
}
return false;
}
else if (ext == "ase") // Adobe swatch exchange format
{
PaletteLoader_Adobe_ase adobePalLoader;
if (adobePalLoader.isFileSupported(fileName))
{
adobePalLoader.setupTargets(&EditColors, dialogGradients);
return adobePalLoader.importFile(fileName, merge);
}
return false;
}
else if (ext == "cxf") // Adobe swatch exchange format
{
PaletteLoader_CxF cxfLoader;
if (cxfLoader.isFileSupported(fileName))
{
cxfLoader.setupTargets(&EditColors, dialogGradients);
return cxfLoader.importFile(fileName, merge);
}
return false;
}
else if (ext == "skp") // Sk1 palette
{
PaletteLoader_sK1 sk1PalLoader;
if (sk1PalLoader.isFileSupported(fileName))
{
sk1PalLoader.setupTargets(&EditColors, dialogGradients);
return sk1PalLoader.importFile(fileName, merge);
}
return false;
}
else if (ext == "sbz")
{
PaletteLoader_Swatchbook swatchbookLoader;
if (swatchbookLoader.isFileSupported(fileName))
{
swatchbookLoader.setupTargets(&EditColors, dialogGradients);
return swatchbookLoader.importFile(fileName, merge);
}
//.........这里部分代码省略.........
开发者ID:HOST-Oman,项目名称:scribus,代码行数:101,代码来源:util_color.cpp
示例14: mouseReleaseEvent
void CanvasMode_EyeDropper::mouseReleaseEvent(QMouseEvent *m)
{
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
m->accept();
// m_view->stopDragTimer();
releaseMouse();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
QPixmap pm = QPixmap::grabWindow( QApplication::desktop()->winId(), m->globalPos().x(), m->globalPos().y(), 1, 1);
QImage i = pm.toImage();
QColor selectedColor=i.pixel(0, 0);
bool found=false;
ColorList::Iterator it;
for (it = m_doc->PageColors.begin(); it != m_doc->PageColors.end(); ++it)
{
if (selectedColor== ScColorEngine::getRGBColor(it.value(), m_doc))
{
found=true;
break;
}
}
QString colorName=QString::null;
if (found)
colorName=it.key();
else
{
bool ok;
bool nameFound=false;
QString questionString="<qt>"+ tr("The selected color does not exist in the document's color set. Please enter a name for this new color.")+"</qt>";
do
{
colorName = QInputDialog::getText(m_ScMW, tr("Color Not Found"), questionString, QLineEdit::Normal, QString::null, &ok);
if (ok)
{
if (m_doc->PageColors.contains(colorName))
questionString="<qt>"+ tr("The name you have selected already exists. Please enter a different name for this new color.")+"</qt>";
else
nameFound=true;
}
} while (!nameFound && ok);
if ( ok && !colorName.isEmpty() )
{
ScColor newColor(selectedColor.red(), selectedColor.green(), selectedColor.blue());
m_doc->PageColors[colorName]=newColor;
m_doc->changed();
m_ScMW->updateColorLists();
}
else
colorName=QString::null;
}
uint docSelectionCount=m_doc->m_Selection->count();
if (!colorName.isNull() && docSelectionCount > 0)
{
for (uint i = 0; i < docSelectionCount; ++i)
{
PageItem *currItem=m_doc->m_Selection->itemAt(i);
if (currItem!=NULL)
{
if ((m->modifiers() & Qt::ControlModifier) && (currItem->asTextFrame() || currItem->asPathText()))
m_doc->itemSelection_SetFillColor(colorName); //Text colour
else
if (m->modifiers() & Qt::AltModifier) //Line colour
m_doc->itemSelection_SetItemPen(colorName);
else
m_doc->itemSelection_SetItemBrush(colorName); //Fill colour
}
}
}
m_view->requestMode(modeNormal);
}
开发者ID:OpenDTP,项目名称:ScribusServer,代码行数:74,代码来源:canvasmode_eyedropper.cpp
注:本文中的colorlist::Iterator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论