Esempio n. 1
0
// show but don't set into selColor, nor emit colorSelected
void KColorDialog::showColor( const KColor &color, const TQString &name )
{
  d->bRecursion = true;

  if (name.isEmpty())
     d->colorName->setText( i18n("-unnamed-"));
  else
     d->colorName->setText( name );

  d->patch->setColor( color );

  setRgbEdit( color );
  setHsvEdit( color );
  setHtmlEdit( color );

  int h, s, v;
  color.hsv( &h, &s, &v );
  d->hsSelector->setValues( h, s );
  d->valuePal->blockSignals(true);
  d->valuePal->setHue( h );
  d->valuePal->setSaturation( s );
  d->valuePal->setValue( v );
  d->valuePal->updateContents();
  d->valuePal->blockSignals(false);
  d->valuePal->repaint( false );
  d->bRecursion = false;
}
Esempio n. 2
0
// show but don't set into selColor, nor emit colorSelected
void KColorDialog::KColorDialogPrivate::showColor(const QColor &color, const QString &name)
{
    bRecursion = true;

    if (name.isEmpty())
        colorName->setText(tr("-unnamed-"));
    else
        colorName->setText(name);

    patch->setColor(color);

    setRgbEdit(color);
    setHsvEdit(color);
    setHtmlEdit(color);


    switch (chooserMode()) {
    case ChooserSaturation:
        hsSelector->setValues(color.hue(), color.value());
        valuePal->setValue(color.saturation());
        break;
    case ChooserValue:
        hsSelector->setValues(color.hue(), color.saturation());
        valuePal->setValue(color.value());
        break;
    case ChooserRed:
        hsSelector->setValues(color.green(), color.blue());
        valuePal->setValue(color.red());
        break;
    case ChooserGreen:
        hsSelector->setValues(color.red(), color.blue());
        valuePal->setValue(color.green());
        break;
    case ChooserBlue:
        hsSelector->setValues(color.green(), color.red());
        valuePal->setValue(color.blue());
        break;
    case ChooserHue:
    default:
        hsSelector->setValues(color.saturation(), color.value());
        valuePal->setValue(color.hue());
        break;

    }

    bool blocked = valuePal->blockSignals(true);

    valuePal->setHue(color.hue());
    valuePal->setSaturation(color.saturation());
    valuePal->setColorValue(color.value());
    valuePal->updateContents();
    valuePal->blockSignals(blocked);
    valuePal->repaint();

    blocked = hsSelector->blockSignals(true);

    hsSelector->setHue(color.hue());
    hsSelector->setSaturation(color.saturation());
    hsSelector->setColorValue(color.value());
    hsSelector->updateContents();
    hsSelector->blockSignals(blocked);
    hsSelector->repaint();

    bRecursion = false;
}