Exemplo n.º 1
0
void Ducker_Global::setValue(float newValue)
{
    if (newValue==m_value)
        return;

    m_value = newValue;
    Log(QString("setValue: %1").arg(m_value));
    emit valueSet(m_value);
}
Exemplo n.º 2
0
void DoubleInput::handleValueChange()
{
	bool ok;
	double vtmp = text().toDouble(&ok);
	if (ok && vtmp != v){
		v=vtmp;
		emit valueSet(v);
	}
}
ColorPropertyToolEditor::ColorPropertyToolEditor(QColorButton *btn, QObject *parent)
    : PropertyToolEditor(btn, parent)
{
    connect(btn, SIGNAL(selected(QColor)),
            this, SLOT(changeColor(QColor)));
    connect(this, SIGNAL(valueSet(QVariant)),
            this, SLOT(setColor(QVariant)));

    setValue(QVariant::fromValue(btn->color()));
}
NumberPropertyToolEditor::NumberPropertyToolEditor(QObject *parent)
    : PropertyToolEditor(new NumberSelector(), parent)
{
    m_ns = static_cast<NumberSelector*>(widget());

    connect(m_ns, SIGNAL(numberChanged(int)),
            this, SLOT(changeNumber(int)));
    connect(this, SIGNAL(valueSet(QVariant)),
            this, SLOT(setNumber(QVariant)));

    m_ns->setNumber(1);
}
QWidget *QtGuiLineEdit::create(QWidget* parent, QLayout* layout)
{
  qDebug("QtGuiLineEdit::create\n");
  data_->create(parent,layout);
  variableGet();
  if (data_->isSet(*(data_->argdict_),"val")) 
    valueSet(data_->getString(*(data_->argdict_),"val"));
  else
  	switch (data_->type_) {
  	case QtGuiLineEditPrivate::DOUBLE:
  		valueSet("0.0");
  		break;
    case QtGuiLineEditPrivate::INT:
    	valueSet("0");
    	break;
  	}
  connect(data_->lineedit_,SIGNAL(returnPressed()),
	  this,SLOT(stateChanged()));
  if (data_->getBool(*(data_->argdict_),"update",false)) {
    connect(data_->lineedit_,SIGNAL(textChanged(const QString&)),
    	  this,SLOT(stateChanged()));
  }
Exemplo n.º 6
0
void DoubleInput::setValue(double val)
{
	QString t;
	// Checking whether v has changed prevents an infinite loop
	// that can occur if this widget is bound up with another widget
	// like a slider
	if (v != val){
		if (val >= validator->bottom() && val <= validator->top()){
			setText(t.setNum(val));
			v=val;
			emit valueSet(v);
		}
	}
}
Exemplo n.º 7
0
ScalePropertyToolEditor::ScalePropertyToolEditor(QSlider *slider, QObject *parent)
    : PropertyToolEditor(slider->parentWidget(), parent),
      m_slider(slider)
{
    connect(m_slider, SIGNAL(valueChanged(int)),
            this, SLOT(changeScale(int)));
    connect(this, SIGNAL(valueSet(QVariant)),
            this, SLOT(setSliderValue(QVariant)));


    Scale scale(m_slider->minimum(), m_slider->maximum());
    scale.setValue(m_slider->sliderPosition());
    setValue(QVariant::fromValue(scale));
}
Exemplo n.º 8
0
void DoubleInput::keyPressEvent ( QKeyEvent * ev )
{
	if (Qt::Key_Escape == ev->key())
	{
		ev->accept();
		delete this;
	}
	else if ( Qt::Key_Return == ev->key() || Qt::Key_Enter == ev->key())
	{
		emit valueSet(value());
		ev->accept();
		delete this;
	}
	else
		QLineEdit::keyPressEvent(ev);
}
Exemplo n.º 9
0
int PokerHandEvaluator::evaluate(Hand hand){
    //logic and some code taken from here: http://www.mathcs.emory.edu/~cheung/Courses/170/Syllabus/10/pokerValue.html
    std::vector<Card*> cards = hand.getCards();
    std::sort(cards.begin(), cards.end(), Compare());

    if (isFlush(cards) && isStraight(cards)) return valueStraightFlush(cards);
    else if (is4s(cards)) return valueFourOfAKind(cards);
    else if (isFullHouse(cards)) return valueFullHouse(cards);
    else if (isFlush(cards)) return valueFlush(cards);
    else if (isStraight(cards)) return valueStraight(cards);
    else if (is3s(cards)) return valueSet(cards);
    else if (is22s(cards)) return valueTwoPairs(cards);
    else if (is2s(cards)) return valueOnePair(cards);
    else return valueHighCard(cards);   // Lowest Poker hand;


}
Exemplo n.º 10
0
void ClientDataRef::setValue(double _newValue, int index) {
    if(_values.size() < index + 1)
        _values.reserve(index+1);
    _values[index] = QString::number(_newValue);
    emit valueSet(this);
}