Esempio n. 1
0
void TimelineWidget::layout(bool update_geometry)
{
   if(mpD->mpController == NULL)
   {
      setScaleDraw(new QwtScaleDraw);
      setRange(0.0, 1.0);
      mpD->animCount = 0;
      return;
   }
   if(mpD->mpController->getFrameType() == FRAME_TIME)
   {
      setScaleDraw(new QwtTimeScaleDraw);
   }
   else
   {
      setScaleDraw(new QwtScaleDraw);
   }
   setRange(mpD->mpController->getStartFrame(), mpD->mpController->getStopFrame());
   mpD->animCount = mpD->mpController->getNumAnimations();

   QRect r = rect();
   int d1, d2;
   scaleDraw()->getBorderDistHint(font(), d1, d2);
   int mbd = qwtMax(d1, d2);
   int scaleHeight = scaleDraw()->extent(QPen(), font());

   mpD->animRect.setRect(
      r.x() + mbd + mpD->borderWidth,
      r.y() + scaleHeight + mpD->borderWidth + mpD->scaleDist,
      r.width() - 2 * (mpD->borderWidth + mbd),
      mpD->animCount * (mpD->animHeight + mpD->animSpacing));
   scaleDraw()->setAlignment(QwtScaleDraw::TopScale);
   scaleDraw()->move(mpD->animRect.x(), mpD->animRect.y() - mpD->scaleDist);
   scaleDraw()->setLength(mpD->animRect.width());

   // paint the scale in this area
   mpD->map.setPaintInterval(mpD->animRect.x(), mpD->animRect.x() + mpD->animRect.width() - 1);

   if(update_geometry)
   {
      updateGeometry();
      update();
   }
}
Esempio n. 2
0
void QwtKnob::initKnob()
{
    d_data = new PrivateData;

    setScaleDraw( new QwtRoundScaleDraw() );

    setUpdateTime( 50 );
    setTotalAngle( 270.0 );
    recalcAngle();
    setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );

    setRange( 0.0, 10.0, 1.0 );
    setValue( 0.0 );
}
Esempio n. 3
0
/*!
  \brief Constructor

  Construct a knob with an angle of 270°. The style is
  QwtKnob::Raised and the marker style is QwtKnob::Notch.
  The width of the knob is set to 50 pixels.

  \param parent Parent widget

  \sa setTotalAngle()
*/
QwtKnob::QwtKnob( QWidget* parent ):
    QwtAbstractSlider( parent )
{
    d_data = new PrivateData;

    setScaleDraw( new QwtRoundScaleDraw() );

    setTotalAngle( 270.0 );

    setScale( 0.0, 10.0 );
    setValue( 0.0 );

    setSizePolicy( QSizePolicy::MinimumExpanding,
        QSizePolicy::MinimumExpanding );
}
Esempio n. 4
0
/*!
  \brief Constructor
  \param parent Parent widget

  Create a compass widget with a scale, no needle and no rose.
  The default origin is 270.0 with no valid value. It accepts
  mouse and keyboard inputs and has no step size. The default mode
  is QwtDial::RotateNeedle.
*/
QwtCompass::QwtCompass( QWidget* parent ):
    QwtDial( parent )
{
    d_data = new PrivateData;

    setScaleDraw( new QwtCompassScaleDraw() );

    setOrigin( 270.0 );
    setWrapping( true );

    setScaleMaxMajor( 36 );
    setScaleMaxMinor( 10 );

    setScale( 0.0, 360.0 ); // degrees as default
    setTotalSteps( 360 );
}
Esempio n. 5
0
void QwtKnob::initKnob()
{
#if QT_VERSION < 0x040000
    setWFlags(Qt::WNoAutoErase);
#endif

    d_data = new PrivateData;

    setScaleDraw(new QwtRoundScaleDraw());

    setUpdateTime(50);
    setTotalAngle( 270.0 );
    recalcAngle();
    setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));

    setRange(0.0, 10.0, 1.0);
    setValue(0.0);
}
Esempio n. 6
0
/*!
  A wrapper method for accessing the scale draw.

  \param components Scale components
  \sa QwtAbstractScaleDraw::enableComponent()
*/
void QwtDial::setScaleComponents(
    QwtAbstractScaleDraw::ScaleComponents components )
{
    if ( components == 0 )
        setScaleDraw( NULL );

    QwtDialScaleDraw *sd = d_data->scaleDraw;
    if ( sd == NULL )
        return;

    sd->enableComponent( QwtAbstractScaleDraw::Backbone,
        components & QwtAbstractScaleDraw::Backbone );

    sd->enableComponent( QwtAbstractScaleDraw::Ticks,
        components & QwtAbstractScaleDraw::Ticks );

    sd->enableComponent( QwtAbstractScaleDraw::Labels,
        components & QwtAbstractScaleDraw::Labels );
}
Esempio n. 7
0
/*!
  A wrapper method for accessing the scale draw. 

  - options == 0\n
    No visible scale: setScaleDraw(NULL)
  - options & ScaleBackbone\n
    En/disable the backbone of the scale.
  - options & ScaleTicks\n
    Don´t change anything. Otherwise set all tick lengths to 0. 
  - options & ScaleLabel\n
    En/disable scale labels
    
  \sa QwtScaleDraw:.setOptions, QwtScaleDraw::setTickLength, 
      QwtDialScaleDraw::showLabels
*/
void QwtDial::setScaleOptions(int options)
{
    if ( options == 0 )
        setScaleDraw(NULL);

    if ( d_scaleDraw == NULL )
        return;

    int flags = d_scaleDraw->options();
    if ( options & ScaleBackbone )
        flags |= QwtScaleDraw::Backbone;
    else
        flags &= ~QwtScaleDraw::Backbone;
    d_scaleDraw->setOptions(flags);

    if ( !(options & ScaleTicks) )
        d_scaleDraw->setTickLength(0, 0, 0);

    d_scaleDraw->showLabels(options & ScaleLabel);
}