本文整理汇总了C++中ScColor::setRgbColor方法的典型用法代码示例。如果您正苦于以下问题:C++ ScColor::setRgbColor方法的具体用法?C++ ScColor::setRgbColor怎么用?C++ ScColor::setRgbColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScColor
的用法示例。
在下文中一共展示了ScColor::setRgbColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: importFile
bool PaletteLoader_Autocad_acb::importFile(const QString& fileName, bool /*merge*/)
{
QByteArray docBytes;
loadRawText(fileName, docBytes);
QString docText = QString::fromUtf8(docBytes);
QDomDocument docu("scridoc");
if (!docu.setContent(docText))
return false;
ScColor lf;
int oldCount = m_colors->count();
QDomElement elem = docu.documentElement();
QDomNode PAGE = elem.firstChild();
while (!PAGE.isNull())
{
QDomElement pg = PAGE.toElement();
if (pg.tagName() == "colorPage")
{
QDomNode colNode = pg.firstChild();
while (!colNode.isNull())
{
QDomElement cg = colNode.toElement();
if (cg.tagName() == "colorEntry")
{
int r (0), g(0), b(0);
QString colorName = "";
QDomNode colEntry = cg.firstChild();
while (!colEntry.isNull())
{
QDomElement cc = colEntry.toElement();
if (cc.tagName() == "colorName")
colorName = cc.text();
else if (cc.tagName() == "RGB8")
{
QDomNode colVal = cc.firstChild();
while (!colVal.isNull())
{
QDomElement cv = colVal.toElement();
if (cv.tagName() == "red")
r = cv.text().toInt();
else if (cv.tagName() == "green")
g = cv.text().toInt();
else if (cv.tagName() == "blue")
b = cv.text().toInt();
colVal = colVal.nextSibling();
}
}
colEntry = colEntry.nextSibling();
}
if (!colorName.isEmpty())
{
lf.setRgbColor(r, g, b);
lf.setSpotColor(false);
lf.setRegistrationColor(false);
m_colors->tryAddColor(colorName, lf);
}
}
colNode = colNode.nextSibling();
}
}
PAGE = PAGE.nextSibling();
}
return (m_colors->count() != oldCount);
}
示例2: if
CWDialog::CWDialog(QWidget* parent, ScribusDoc* doc, const char* name, bool modal)
: QDialog (parent),
m_Doc(doc)
{
setupUi(this);
setObjectName(name);
setModal(modal);
int h, s, v;
ScColor color;
QString colorName;
connectSlots(false);
// setup combobox
typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Monochromatic), colorWheel->Monochromatic);
typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Analogous), colorWheel->Analogous);
typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Complementary), colorWheel->Complementary);
typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Split), colorWheel->Split);
typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Triadic), colorWheel->Triadic);
typeCombo->addItem(colorWheel->getTypeDescription(colorWheel->Tetradic), colorWheel->Tetradic);
// defects
defectCombo->addItem(CommonStrings::trVisionNormal);
defectCombo->addItem(CommonStrings::trVisionProtanopia);
defectCombo->addItem(CommonStrings::trVisionDeuteranopia);
defectCombo->addItem(CommonStrings::trVisionTritanopia);
defectCombo->addItem(CommonStrings::trVisionFullColorBlind);
// document colors
documentColorList->setPixmapType(ColorListBox::fancyPixmap);
documentColorList->setColors(m_Doc->PageColors, false);
// preferences
prefs = PrefsManager::instance()->prefsFile->getPluginContext("colorwheel");
typeCombo->setCurrentIndex(prefs->getInt("cw_type", 0));
angleSpin->setValue(prefs->getInt("cw_angle", 15));
colorList->setPixmapType(ColorListBox::fancyPixmap);
colorWheel->currentDoc = m_Doc;
colorWheel->angle = angleSpin->value();
colorWheel->baseAngle = prefs->getInt("cw_baseangle", 0);
colorspaceTab->setCurrentIndex(prefs->getInt("cw_space", 0));
color.setNamedColor(prefs->get("cw_color", "#00000000"));
// Handle color previously selected in the document tab
if (colorspaceTab->currentWidget() == tabDocument)
{
colorName = prefs->get("cw_colorname", "");
if (!colorName.isEmpty() && m_Doc->PageColors.contains(colorName))
color = m_Doc->PageColors[colorName];
else
color.setRgbColor(0, 0, 0); //Trigger use of defaults
}
// Handle achromatic colors
QColor rgb = ScColorEngine::getRGBColor(color, m_Doc);
rgb.getHsv(&h, &s, &v);
if (h == -1)
{ // Reset to defaults
colorWheel->baseAngle = 0;
colorWheel->currentColorSpace = colorModelCMYK;
colorWheel->actualColor = colorWheel->colorByAngle(0);
colorspaceTab->setCurrentIndex(0);
}
else if (colorspaceTab->currentWidget() == tabDocument)
{
colorWheel->actualColor = color;
QStringList results = documentColorList->findColors(colorName, Qt::MatchFixedString|Qt::MatchCaseSensitive);
if (results.count() > 0)
documentColorList->setCurrentColor(results[0]);
}
else
colorWheel->actualColor = color;
resize(QSize(prefs->getInt("cw_width", 640),
prefs->getInt("cw_height", 480)).expandedTo(minimumSizeHint()));
previewLabel->resize(prefs->getInt("cw_samplex", 300), prefs->getInt("cw_sampley", 100));
// setup
colorspaceTab_currentChanged(colorspaceTab->currentIndex());
// signals and slots that cannot be in ui file
connect(colorWheel, SIGNAL(clicked(int, const QPoint&)),
this, SLOT(colorWheel_clicked(int, const QPoint&)));
connect(documentColorList, SIGNAL(currentTextChanged(const QString &)),
this, SLOT(documentColorList_currentChanged(const QString &)));
connect(colorList, SIGNAL(currentTextChanged(const QString &)),
this, SLOT(colorList_currentChanged(const QString &)));
connect(angleSpin, SIGNAL(valueChanged(int)),
this, SLOT(angleSpin_valueChanged(int)));
connect(colorspaceTab, SIGNAL(currentChanged(int)),
this, SLOT(colorspaceTab_currentChanged(int)));
connect(typeCombo, SIGNAL(activated(int)), this, SLOT(typeCombo_activated(int)));
connect(defectCombo, SIGNAL(activated(int)), this, SLOT(defectCombo_activated(int)));
connect(addButton, SIGNAL(clicked()), this, SLOT(addButton_clicked()));
connect(replaceButton, SIGNAL(clicked()), this, SLOT(replaceButton_clicked()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButton_clicked()));
connectSlots(true);
}
示例3: importColorsFromFile
//.........这里部分代码省略.........
loadRawText(fileName, docBytes);
QString docText("");
docText = QString::fromUtf8(docBytes);
QDomDocument docu("scridoc");
docu.setContent(docText);
ScColor lf = ScColor();
QDomElement elem = docu.documentElement();
QString dTag = "";
dTag = elem.tagName();
QString nameMask = "%1";
nameMask = elem.attribute("mask", "%1");
QDomNode PAGE = elem.firstChild();
while (!PAGE.isNull())
{
QDomElement pg = PAGE.toElement();
if (pg.tagName()=="COLOR" && pg.attribute("NAME")!=CommonStrings::None)
{
if (pg.hasAttribute("SPACE"))
{
QString space = pg.attribute("SPACE");
if (space == "CMYK")
{
double c = pg.attribute("C", "0").toDouble() / 100.0;
double m = pg.attribute("M", "0").toDouble() / 100.0;
double y = pg.attribute("Y", "0").toDouble() / 100.0;
double k = pg.attribute("K", "0").toDouble() / 100.0;
lf.setCmykColorF(c, m, y, k);
}
else if (space == "RGB")
{
double r = pg.attribute("R", "0").toDouble() / 255.0;
double g = pg.attribute("G", "0").toDouble() / 255.0;
double b = pg.attribute("B", "0").toDouble() / 255.0;
lf.setRgbColorF(r, g, b);
}
else if (space == "Lab")
{
double L = pg.attribute("L", "0").toDouble();
double a = pg.attribute("A", "0").toDouble();
double b = pg.attribute("B", "0").toDouble();
lf.setLabColor(L, a, b);
}
}
else if (pg.hasAttribute("CMYK"))
lf.setNamedColor(pg.attribute("CMYK"));
else if (pg.hasAttribute("RGB"))
lf.fromQColor(QColor(pg.attribute("RGB")));
else
{
double L = pg.attribute("L", "0").toDouble();
double a = pg.attribute("A", "0").toDouble();
double b = pg.attribute("B", "0").toDouble();
lf.setLabColor(L, a, b);
}
if (pg.hasAttribute("Spot"))
lf.setSpotColor(static_cast<bool>(pg.attribute("Spot").toInt()));
else
lf.setSpotColor(false);
if (pg.hasAttribute("Register"))
lf.setRegistrationColor(static_cast<bool>(pg.attribute("Register").toInt()));
else
lf.setRegistrationColor(false);
EditColors.tryAddColor(pg.attribute("NAME"), lf);
}
else if (pg.tagName() == "Gradient")
{