本文整理汇总了C++中QColor::yellow方法的典型用法代码示例。如果您正苦于以下问题:C++ QColor::yellow方法的具体用法?C++ QColor::yellow怎么用?C++ QColor::yellow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QColor
的用法示例。
在下文中一共展示了QColor::yellow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateYellowValues
void SlidersController::updateYellowValues(QColor color) {
slidersView->ui->ySlider->setY(color);
yellowSpinManualEdit = false;
slidersView->ui->spYellow->setValue(color.yellow());
slidersView->ui->cSlider->changeYellow(color);
slidersView->ui->mSlider->changeYellow(color);
slidersView->ui->kSlider->changeYellow(color);
}
示例2: add
void ContinuousColorRange::add(const QVariant &v)
{
if ( contains(v))
return;
QColor clr = toColor(v, defaultColorModel());
if ( !clr.isValid())
return;
if ( defaultColorModel() == ColorRangeBase::cmRGBA){
_limit1.setRed(std::min(_limit1.red(), clr.red()));
_limit1.setGreen(std::min(_limit1.green(), clr.green()));
_limit1.setBlue(std::min(_limit1.blue(), clr.blue()));
_limit1.setAlpha(std::min(_limit1.alpha(), clr.alpha()));
_limit2.setRed(std::max(_limit2.red(), clr.red()));
_limit2.setGreen(std::max(_limit2.green(), clr.green()));
_limit2.setBlue(std::max(_limit2.blue(), clr.blue()));
_limit2.setAlpha(std::max(_limit2.alpha(), clr.alpha()));
}else if (defaultColorModel() == ColorRangeBase::cmHSLA) {
_limit1.setHsl(std::min(_limit1.hue(), clr.hue()),
std::min(_limit1.saturation(), clr.saturation()),
std::min(_limit1.lightness(), clr.lightness()));
_limit1.setAlpha(std::min(_limit1.alpha(), clr.alpha()));
_limit2.setHsl(std::max(_limit2.hue(), clr.hue()),
std::max(_limit2.saturation(), clr.saturation()),
std::max(_limit2.lightness(), clr.lightness()));
_limit2.setAlpha(std::max(_limit2.alpha(), clr.alpha()));
}
else if ( defaultColorModel() == ColorRangeBase::cmCYMKA){
_limit1.setCmyk(std::min(_limit1.cyan(), clr.cyan()),
std::min(_limit1.magenta(), clr.magenta()),
std::min(_limit1.yellow(), clr.yellow()),
std::min(_limit1.black(), clr.black()));
_limit1.setAlpha(std::min(_limit1.alpha(), clr.alpha()));
_limit2.setCmyk(std::max(_limit2.cyan(), clr.cyan()),
std::max(_limit2.magenta(), clr.magenta()),
std::max(_limit2.yellow(), clr.yellow()),
std::max(_limit2.black(), clr.black()));
_limit2.setAlpha(std::max(_limit2.alpha(), clr.alpha()));
}
}
示例3: storeColor
void ColorRangeBase::storeColor(const QColor& clr, QDataStream &stream)
{
switch (defaultColorModel()){
case ColorRangeBase::cmRGBA:
stream << clr.red() << clr.green() << clr.blue() << clr.alpha();
break;
case ColorRangeBase::cmHSLA:
stream << clr.hue() << clr.saturation() << clr.lightness() << clr.alpha();
break;
case ColorRangeBase::cmCYMKA:
stream << clr.yellow() << clr.magenta() << clr.cyan() << clr.black();
break;
case ColorRangeBase::cmGREYSCALE:
stream << clr.red();
default:
break;
}
}
示例4: setCmyk
void tst_QColor::setCmyk()
{
QColor color;
for (int A = 0; A <= USHRT_MAX; ++A) {
{
// 0-255
int a = A >> 8;
color.setCmyk(0, 0, 0, 0, a);
QCOMPARE(color.alpha(), a);
int c, m, y, k, a2;
color.getCmyk(&c, &m, &y, &k, &a2);
QCOMPARE(a2, a);
}
{
// 0.0-1.0
qreal a = A / qreal(USHRT_MAX);
color.setCmykF(0.0, 0.0, 0.0, 0.0, a);
QCOMPARE(color.alphaF(), a);
qreal c, m, y, k, a2;
color.getCmykF(&c, &m, &y, &k, &a2);
QCOMPARE(a2, a);
}
}
for (int C = 0; C <= USHRT_MAX; ++C) {
{
// 0-255
int c = C >> 8;
color.setCmyk(c, 0, 0, 0, 0);
QCOMPARE(color.cyan(), c);
int c2, m, y, k, a;
color.getCmyk(&c2, &m, &y, &k, &a);
QCOMPARE(c2, c);
}
{
// 0.0-1.0
qreal c = C / qreal(USHRT_MAX);
color.setCmykF(c, 0.0, 0.0, 0.0, 0.0);
QCOMPARE(color.cyanF(), c);
qreal c2, m, y, k, a;
color.getCmykF(&c2, &m, &y, &k, &a);
QCOMPARE(c2, c);
}
}
for (int M = 0; M <= USHRT_MAX; ++M) {
{
// 0-255
int m = M >> 8;
color.setCmyk(0, m, 0, 0, 0);
QCOMPARE(color.magenta(), m);
int c, m2, y, k, a;
color.getCmyk(&c, &m2, &y, &k, &a);
QCOMPARE(m2, m);
}
{
// 0.0-1.0
qreal m = M / qreal(USHRT_MAX);
color.setCmykF(0.0, m, 0.0, 0.0, 0.0);
QCOMPARE(color.magentaF(), m);
qreal c, m2, y, k, a;
color.getCmykF(&c, &m2, &y, &k, &a);
QCOMPARE(m2, m);
}
}
for (int Y = 0; Y <= USHRT_MAX; ++Y) {
{
// 0-255
int y = Y >> 8;
color.setCmyk(0, 0, y, 0, 0);
QCOMPARE(color.yellow(), y);
int c, m, y2, k, a;
color.getCmyk(&c, &m, &y2, &k, &a);
QCOMPARE(y2, y);
}
{
// 0.0-1.0
qreal y = Y / qreal(USHRT_MAX);
color.setCmykF(0.0, 0.0, y, 0.0, 0.0);
QCOMPARE(color.yellowF(), y);
qreal c, m, y2, k, a;
color.getCmykF(&c, &m, &y2, &k, &a);
QCOMPARE(y2, y);
}
}
//.........这里部分代码省略.........
示例5: writeDMXLevel
void VCSlider::writeDMXLevel(MasterTimer* timer, UniverseArray* universes)
{
Q_UNUSED(timer);
m_levelValueMutex.lock();
uchar modLevel = m_levelValue;
int r = 0, g = 0, b = 0, c = 0, m = 0, y = 0;
if (m_cngType == ClickAndGoWidget::RGB)
{
float f = 0;
if (m_slider)
f = SCALE(float(m_levelValue), float(m_slider->minimum()),
float(m_slider->maximum()), float(0), float(200));
if ((uchar)f != 0)
{
QColor modColor = m_cngRGBvalue.lighter((uchar)f);
r = modColor.red();
g = modColor.green();
b = modColor.blue();
}
}
else if (m_cngType == ClickAndGoWidget::CMY)
{
float f = 0;
if (m_slider)
f = SCALE(float(m_levelValue), float(m_slider->minimum()),
float(m_slider->maximum()), float(0), float(200));
if ((uchar)f != 0)
{
QColor modColor = m_cngRGBvalue.lighter((uchar)f);
c = modColor.cyan();
m = modColor.magenta();
y = modColor.yellow();
}
}
QListIterator <LevelChannel> it(m_levelChannels);
while (it.hasNext() == true)
{
LevelChannel lch(it.next());
Fixture* fxi = m_doc->fixture(lch.fixture);
if (fxi != NULL)
{
const QLCChannel* qlcch = fxi->channel(lch.channel);
if (qlcch == NULL)
continue;
if (qlcch->group() != QLCChannel::Intensity &&
m_levelValueChanged == false)
{
/* Value has not changed and this is not an intensity channel.
LTP in effect. */
continue;
}
if (qlcch->group() == QLCChannel::Intensity)
{
if (m_cngType == ClickAndGoWidget::RGB)
{
if (qlcch->colour() == QLCChannel::Red)
modLevel = (uchar)r;
else if (qlcch->colour() == QLCChannel::Green)
modLevel = (uchar)g;
else if (qlcch->colour() == QLCChannel::Blue)
modLevel = (uchar)b;
}
else if (m_cngType == ClickAndGoWidget::CMY)
{
if (qlcch->colour() == QLCChannel::Cyan)
modLevel = (uchar)c;
else if (qlcch->colour() == QLCChannel::Magenta)
modLevel = (uchar)m;
else if (qlcch->colour() == QLCChannel::Yellow)
modLevel = (uchar)y;
}
}
quint32 dmx_ch = fxi->channelAddress(lch.channel);
universes->write(dmx_ch, modLevel, qlcch->group());
}
}
m_levelValueChanged = false;
m_levelValueMutex.unlock();
}