コード例 #1
0
ファイル: qwt_double_range.cpp プロジェクト: einnas/epics
/*!
  \brief Specify  range and step size

  \param vmin   lower boundary of the interval
  \param vmax   higher boundary of the interval
  \param vstep  step width
  \param pageSize  page size in steps
  \warning
  \li A change of the range changes the value if it lies outside the
      new range. The current value
      will *not* be adjusted to the new step raster.
  \li vmax < vmin is allowed.
  \li If the step size is left out or set to zero, it will be
      set to 1/100 of the interval length.
  \li If the step size has an absurd value, it will be corrected
      to a better one.
*/
void QwtDoubleRange::setRange(double vmin, double vmax, double vstep, int pageSize)
{
    bool rchg = ((d_maxValue != vmax) || (d_minValue != vmin));

    if (rchg)
    {
        d_minValue = vmin;
        d_maxValue = vmax;
    }

    //
    // look if the step width has an acceptable
    // value or otherwise change it.
    //
    setStep(vstep);

    //
    // limit page size
    //
    d_pageSize = qwtLim(pageSize,0,
                        int(qwtAbs((d_maxValue - d_minValue) / d_step)));

    //
    // If the value lies out of the range, it
    // will be changed. Note that it will not be adjusted to
    // the new step width.
    setNewValue(d_value, false);

    // call notifier after the step width has been
    // adjusted.
    if (rchg)
        rangeChange();
}
コード例 #2
0
ファイル: qslider.cpp プロジェクト: kthxbyte/QT2-Linaro
/*!\reimp
*/
void QSlider::resizeEvent( QResizeEvent * )
{
    rangeChange();
    initTicks();
    if ( autoMask() )
	updateMask();
}
コード例 #3
0
void
QvisOpacitySlider::resizeEvent(QResizeEvent *)
{
    rangeChange();
    initTicks();

    // Delete the gradient pixmap so it will be regenerated before the next
    // paint event.
    deleteGradientImage();
}
コード例 #4
0
void
QvisOpacitySlider::setValue(int value)
{
    int v = value;
    if(v < minimum())
        v = minimum();
    if(v > maximum())
        v = maximum();
    QAbstractSlider::setValue(v);
    rangeChange();
}
コード例 #5
0
ファイル: scrollbar.cpp プロジェクト: ShuoLearner/COPASI
void ScrollBar::moveSlider(double min, double max)
{
  if (mLogScale)
    {
      min = log(min);
      max = log(max);
    }

  int sliderTicks;
  sliderTicks = qRound((max - min) /
                       (d_maxBase - d_minBase) * d_baseTicks);

  // setRange initiates a valueChanged of the scrollbars
  // in some situations. So we block
  // and unblock the signals.

  blockSignals(true);

  setRange(sliderTicks / 2, d_baseTicks - sliderTicks / 2);
  int steps = sliderTicks / 200;

  if (steps <= 0)
    steps = 1;

#if QT_VERSION < 0x040000
  setSteps(steps, sliderTicks);
#else
  setSingleStep(steps);
  setPageStep(sliderTicks);
#endif

  int tick;
  tick = mapToTick(min + (max - min) / 2);

  if (isInverted())
    tick = d_baseTicks - tick;

#if QT_VERSION < 0x040000
  directSetValue(tick);
  rangeChange();
#else
  setSliderPosition(tick);
#endif
  blockSignals(false);
}
コード例 #6
0
void QRangeControl::setRange( int minValue, int maxValue )
{
    if ( minValue > maxValue ) {
#if defined(QT_CHECK_RANGE)
	qWarning( "QRangeControl::setRange: minValue %d > maxValue %d",
		  minValue, maxValue );
#endif
	maxValue = minValue;
    }
    if ( minValue == minVal && maxValue == maxVal )
	return;
    minVal = minValue;
    maxVal = maxValue;
    int tmp = bound( val );
    rangeChange();
    if ( tmp != val ) {
	prevVal = val;
	val = tmp;
	valueChange();
    }
}
コード例 #7
0
ファイル: drange.cpp プロジェクト: muse-sequencer/muse
void DoubleRange::setRange(double vmin, double vmax, double vstep, int pageSize, ConversionMode mode)
      {
      vmin = convertFrom(vmin, mode);
      vmax = convertFrom(vmax, mode);
      bool rchg = ((d_maxValue != vmax) || (d_minValue != vmin));

      if(!rchg && vstep == d_step && pageSize == d_pageSize)    // p4.0.45
        return;
      
      if (rchg) {
            d_minValue = vmin;
            d_maxValue = vmax;
            }

      //
      // look if the step width has an acceptable
      // value or otherwise change it.
      //
      setStep(vstep);

      //
      // limit page size
      //
      d_pageSize = MusECore::qwtLim(pageSize,0, int(MusECore::qwtAbs((d_maxValue - d_minValue) / d_step)));

      //
      // If the value lies out of the range, it
      // will be changed. Note that it will not be adjusted to
      // the new step width.
      setNewValue(d_value, false);

      // call notifier after the step width has been
      // adjusted.
      if (rchg)
            rangeChange();
      }
コード例 #8
0
ファイル: qslider.cpp プロジェクト: kthxbyte/QT2-Linaro
void QSlider::setOrientation( Orientation orientation )
{
    orient = orientation;
    rangeChange();
    update();
}