/*!
    \reimp
 */
void QxtSpanSlider::mouseMoveEvent(QMouseEvent* event)
{
    if (qxt_d().lowerPressed != QStyle::SC_SliderHandle && qxt_d().upperPressed != QStyle::SC_SliderHandle)
    {
        event->ignore();
        return;
    }

    QStyleOptionSlider opt;
    qxt_d().initStyleOption(&opt);
    const int m = style()->pixelMetric(QStyle::PM_MaximumDragDistance, &opt, this);
    int newPosition = qxt_d().pixelPosToRangeValue(qxt_d().pick(event->pos()) - qxt_d().offset);
    if (m >= 0)
    {
        const QRect r = rect().adjusted(-m, -m, m, m);
        if (!r.contains(event->pos()))
        {
            newPosition = qxt_d().position;
        }
    }

    // pick the preferred handle on the first movement
    if (qxt_d().firstMovement)
    {
        if (qxt_d().lower == qxt_d().upper)
        {
            if (newPosition < lowerValue())
            {
                qxt_d().swapControls();
                qxt_d().firstMovement = false;
            }
        }
        else
        {
            qxt_d().firstMovement = false;
        }
    }

    if (qxt_d().lowerPressed == QStyle::SC_SliderHandle)
    {
        if (qxt_d().movement == NoCrossing)
            newPosition = qMin(newPosition, upperValue());
        else if (qxt_d().movement == NoOverlapping)
            newPosition = qMin(newPosition, upperValue() - 1);

        setLowerPosition(newPosition);
    }
    else if (qxt_d().upperPressed == QStyle::SC_SliderHandle)
    {
        if (qxt_d().movement == NoCrossing)
            newPosition = qMax(newPosition, lowerValue());
        else if (qxt_d().movement == NoOverlapping)
            newPosition = qMax(newPosition, lowerValue() + 1);

        setUpperPosition(newPosition);
    }
    event->accept();
}
void MyIntervalSlider::setUpperValue(int value)
{
	int oldValue = upperValue();
	options->setUpperValue(value);
	if (value != oldValue) {
		emit upperValueChanged(upperValue());
		emit valueChanged(upperValue());
	}
}
Exemplo n.º 3
0
/*!
    Returns a deep-copied clone of the QMofStructuralFeature.
*/
QModelingElement *QMofStructuralFeature::clone() const
{
    QMofStructuralFeature *c = new QMofStructuralFeature;
    c->asQModelingObject()->setObjectName(this->asQModelingObject()->objectName());
    c->asQModelingObject()->setProperty("role", this->asQModelingObject()->property("role"));
    foreach (QMofComment *element, ownedComments())
        c->addOwnedComment(dynamic_cast<QMofComment *>(element->clone()));
    c->setName(name());
    c->setVisibility(visibility());
    c->setLeaf(isLeaf());
    c->setStatic(isStatic());
    c->setOrdered(isOrdered());
    c->setUnique(isUnique());
    if (lowerValue())
        c->setLowerValue(dynamic_cast<QMofValueSpecification *>(lowerValue()->clone()));
    if (upperValue())
        c->setUpperValue(dynamic_cast<QMofValueSpecification *>(upperValue()->clone()));
    c->setReadOnly(isReadOnly());
    return c;
}
void QmitkFloatingPointSpanSlider::setRange(double min, double max)
{
  if (m_IntMode)
  {
    this->QxtSpanSlider::setRange(min, max);
    m_Minimum = minimum();
    m_Maximum = maximum();
    m_LowerValue = lowerValue();
    m_UpperValue = upperValue();
    return;
  }

  if (min > max)
  {
    min = max;
  }
  m_Minimum = min;
  m_Maximum = max;

  if (m_LowerValue > m_Maximum)
  {
    m_LowerValue = m_Maximum;
    this->QxtSpanSlider::setLowerValue(scaleValue(m_LowerValue));
  }
  else if (m_LowerValue < m_Minimum)
  {
    m_LowerValue = m_Minimum;
    this->QxtSpanSlider::setLowerValue(scaleValue(m_LowerValue));
  }

  if (m_UpperValue > m_Maximum)
  {
    m_UpperValue = m_Maximum;
    this->QxtSpanSlider::setUpperValue(scaleValue(m_UpperValue));
  }
  else if (m_UpperValue < m_Minimum)
  {
    m_UpperValue = m_Minimum;
    this->QxtSpanSlider::setUpperValue(scaleValue(m_UpperValue));
  }

  scaleSliderToInt();
}
Exemplo n.º 5
0
void DoubleSpanSlider::update(double min, double max)
{
    apex_assert_hard(step_ != 0.0);

    int mini = double2int(min, min);
    int maxi = double2int(max, min);

    if (minimum() != mini || maximum() != maxi) {
        double low = int2double(lowerValue());
        double up = int2double(upperValue());

        apex_assert_hard(int2double(maxi, min) == max);
        apex_assert_hard(int2double(mini, min) == min);

        min_ = min;
        max_ = max;

        QxtSpanSlider::setRange(mini, maxi);

        setLowerValue(double2int(low));
        setUpperValue(double2int(up));
    }
}
bool QgsRendererRangeV2::operator<( const QgsRendererRangeV2 &other ) const
{
  return
    lowerValue() < other.lowerValue() ||
    ( lowerValue() == other.lowerValue() && upperValue() < other.upperValue() );
}
Exemplo n.º 7
0
bool QgsRendererRange::operator<( const QgsRendererRange &other ) const
{
  return
    lowerValue() < other.lowerValue() ||
    ( qgsDoubleNear( lowerValue(), other.lowerValue() ) && upperValue() < other.upperValue() );
}
Exemplo n.º 8
0
double DoubleSpanSlider::upperDoubleValue() const
{
    return int2double(upperValue());
}