void CAdvancedLineEditWidget::update() { const QString _text = text(); m_currentLength = _text.size(); bool oldValid = m_valid; m_valid = true; if (m_currentLength < m_minLength) { m_valid = false; } if (m_valid && !_text.isEmpty()) { for (int i = 0; i < m_currentLength; ++i) { if (!testCharacter(_text[i])) { m_valid = false; break; } } } refreshColor(); if (oldValid != m_valid) Q_EMIT validityChanged(m_valid); }
void ColorPicker::setColor(const ColorRGBA &color) { if (_currentColor == color) return; _currentColor = color; setSpinsColor(); refreshColor(); onColorChange(); }
void AtomButton::setAtomColor() { QColor color = QColorDialog::getColor(); if(color.isValid()) { Preferences::_colorChanges[_label] = color; _canvas->updateAtomColors(Preferences::_colorChanges); refreshColor(); } }
ColorPicker::ColorPicker(const scv::Point &p1) : Panel(p1, Point(p1.x + 360, p1.y + 155)), MatrixTemplate<ColorRGBA>(360, 102, ColorRGBA(0,255,0,255)) { _isHResizable = _isVResizable = false; _currentColor = ColorRGBA(0,0,0,255); _pickerWaitingColor = false; _cpTexture = NULL; _rgbs[0] = new Spinner(Point(20 ,106),50,0,255,0,1); _rgbs[1] = new Spinner(Point(90 ,106),50,0,255,0,1); _rgbs[2] = new Spinner(Point(160,106),50,0,255,0,1); _rgbs[3] = new Spinner(Point(230,106),50,0,100,100,5); _btPicker = new EyeDropper(this); _saturation = 100; Panel::addChild(_rgbs[0]); Panel::addChild(_rgbs[1]); Panel::addChild(_rgbs[2]); Panel::addChild(_rgbs[3]); Panel::addChild(_btPicker); Panel::addChild(new Label(Point( 8, 109), "R:")); Panel::addChild(new Label(Point( 78, 109), "G:")); Panel::addChild(new Label(Point(148, 109), "B:")); Panel::addChild(new Label(Point(218, 109), "S:")); // initial color _currentColorPosition = Point(0, MatrixTemplate<ColorRGBA>::getHeight() - 1); _type = COLORPICKER; refreshColor(); createTexture(); setMaximumSize(getPreferredSize()); setMinimumSize(getPreferredSize()); }
void ColorPicker::display(void) { static ColorScheme *scheme = ColorScheme::getInstance(); if (_cpTexture == NULL || _isVisible == false) return; Panel::display(); Point currPosition = getAbsolutePosition(); refreshColor(); _cpTexture->enable(); scheme->applyDefaultModulate(); // colorful area _cpTexture->display(currPosition.x, currPosition.y,0, MatrixTemplate<ColorRGBA>::getWidth(), MatrixTemplate<ColorRGBA>::getHeight()); // selected color glColor3f(_currentColor[0]/255.f, _currentColor[1]/255.f, _currentColor[2]/255.f); _cpTexture->display(currPosition.x + 5, currPosition.y + 130, 1, MatrixTemplate<ColorRGBA>::getWidth() - 11, 20); _cpTexture->disable(); }
void ColorPicker::setSpinsColor(void) { _rgbs[0]->setValue(_currentColor[0]); _rgbs[1]->setValue(_currentColor[1]); _rgbs[2]->setValue(_currentColor[2]); refreshColor(); }
void CAdvancedLineEditWidget::refreshColor() { refreshColor(m_valid); }