コード例 #1
0
/*!
  \brief Checks if a range of indices is valid and corrects it if necessary
  \param i1 Index 1
  \param i2 Index 2
*/
int QwtCurve::verifyRange(int &i1, int &i2)
{
    int size = dataSize();

    if (size < 1) return 0;

    i1 = qwtLim(i1, 0, size-1);
    i2 = qwtLim(i2, 0, size-1);
    qwtSort(i1, i2, i1, i2);

    return (i2 - i1 + 1);
}
コード例 #2
0
ファイル: qwt_polar_curve.cpp プロジェクト: Ariki/QGIS
static int verifyRange( int size, int &i1, int &i2 )
{
  if ( size < 1 )
    return 0;

  i1 = qwtLim( i1, 0, size - 1 );
  i2 = qwtLim( i2, 0, size - 1 );

  if ( i1 > i2 )
    qSwap( i1, i2 );

  return ( i2 - i1 + 1 );
}
コード例 #3
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();
}
コード例 #4
0
/*!
  \param num Number of arrows
  \param arrowType see Qt::ArowType in the Qt docs.
  \param parent Parent widget
*/
QwtArrowButton::QwtArrowButton(int num,
                               Qt::ArrowType arrowType, QWidget *parent):
    QPushButton(parent)
{
    d_data = new PrivateData;
    d_data->num = qwtLim(num, 1, MaxNum);
    d_data->arrowType = arrowType;

    setAutoRepeat(true);
    setAutoDefault(false);

    switch(d_data->arrowType) {
    case Qt::LeftArrow:
    case Qt::RightArrow:
        setSizePolicy(QSizePolicy::Expanding,
                      QSizePolicy::Fixed);
        break;
    default:
        setSizePolicy(QSizePolicy::Fixed,
                      QSizePolicy::Expanding);
    }
}
コード例 #5
0
/*!
  \brief Specify the visible portion of the wheel.

  You may use this function for fine-tuning the appearance of
  the wheel. The default value is 175 degrees. The value is
  limited from 10 to 175 degrees.

  \param angle Visible angle in degrees
  \sa viewAngle(), setTotalAngle()
*/
void QwtWheel::setViewAngle(double angle)
{
    d_data->viewAngle = qwtLim( angle, 10.0, 175.0 );
    update();
}
コード例 #6
0
/*!
  \brief Adjust the number of grooves in the wheel's surface.

  The number of grooves is limited to 6 <= cnt <= 50.
  Values outside this range will be clipped.
  The default value is 10.

  \param cnt Number of grooves per 360 degrees
  \sa tickCnt()
*/
void QwtWheel::setTickCnt(int cnt)
{
    d_data->tickCnt = qwtLim( cnt, 6, 50 );
    update();
}