Example #1
0
/**
* Set a new min value and update the widget.
* @param value :: The new value
*/
void ColorMapWidget::setMinValue(double value) {
  setMinValueText(value);
  updateScale();
  if (!m_minValueBox->signalsBlocked()) {
    minValueChanged();
  }
}
int LabeledSlider::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: slot_horizontalSlider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: on_txtMin_textChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: on_txtMax_textChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 4;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = name(); break;
        case 1: *reinterpret_cast< int*>(_v) = minValueText(); break;
        case 2: *reinterpret_cast< int*>(_v) = maxValueText(); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setName(*reinterpret_cast< QString*>(_v)); break;
        case 1: setMinValueText(*reinterpret_cast< int*>(_v)); break;
        case 2: setMaxValueText(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 3;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #3
0
/**
* Respond to mouse move event. If the left button is down change the min or max.
*/
void ColorMapWidget::mouseMoveEvent(QMouseEvent *e) {
  if (!m_dragging)
    return;

  double minValue = m_minValueBox->displayText().toDouble();
  double maxValue = m_maxValueBox->displayText().toDouble();

  if (m_dtype == Bottom) {
    minValue += double(e->y() - m_y) / height() * (maxValue - minValue);
    setMinValueText(minValue);
  } else {
    maxValue += double(e->y() - m_y) / height() * (maxValue - minValue);
    setMaxValueText(maxValue);
  }
  m_y = e->y();
  updateScale();
}