Exemplo n.º 1
0
void QwtDial::initDial()
{
    d_data = new PrivateData;

    setFocusPolicy( Qt::TabFocus );

    QPalette p = palette();
    for ( int i = 0; i < QPalette::NColorGroups; i++ )
    {
        const QPalette::ColorGroup cg = ( QPalette::ColorGroup )i;

        // Base: background color of the circle inside the frame.
        // WindowText: background color of the circle inside the scale

        p.setColor( cg, QPalette::WindowText,
            p.color( cg, QPalette::Base ) );
    }
    setPalette( p );

    d_data->scaleDraw = new QwtDialScaleDraw( this );
    d_data->scaleDraw->setRadius( 0 );

    setScaleArc( 0.0, 360.0 ); // scale as a full circle
    setRange( 0.0, 360.0, 1.0, 10 ); // degrees as default
}
SpeedoMeter::SpeedoMeter(QWidget *parent):
    QwtDial(parent),
    d_label("km/h")
{
    setWrapping(false);
    setReadOnly(true);

    setOrigin(135.0);
    setScaleArc(0.0, 270.0);
    scaleDraw()->setSpacing(8);

    QwtDialSimpleNeedle *needle = new QwtDialSimpleNeedle(
            QwtDialSimpleNeedle::Arrow, true, Qt::red, 
            QColor(Qt::gray).light(130));
    setNeedle(needle);

    setScaleOptions(ScaleTicks | ScaleLabel);
    setScaleTicks(0, 4, 8);
}
Exemplo n.º 3
0
Arquivo: dial.cpp Projeto: z80/avrusb
Dial::Dial( QWidget * parent )
: QwtDial( parent ),
  d_label( "[a.u.]" )
{
    setWrapping( false );
    setReadOnly( true );

    setOrigin( 135.0 );
    setScaleArc( 0.0, 270.0 );
    scaleDraw()->setSpacing( 8 );

    QwtDialSimpleNeedle * needle = new QwtDialSimpleNeedle(
            QwtDialSimpleNeedle::Arrow, true, Qt::red, 
            QColor( Qt::gray ).light( 130 ) );
    setNeedle( needle );

    setScaleComponents( 
        QwtAbstractScaleDraw::Ticks | QwtAbstractScaleDraw::Labels );
    setScaleTicks( 0, 4, 8 );
}
Exemplo n.º 4
0
QwtDial::QwtDial(QWidget* parent, const char* name):
        QwtSliderBase(Qt::Horizontal, parent, name, 
            Qt::WRepaintNoErase|Qt::WResizeNoErase),
    d_visibleBackground(FALSE),
    d_frameShadow(Sunken),
    d_lineWidth(0),
    d_mode(RotateNeedle),
    d_origin(90.0),
    d_minScaleArc(0.0),
    d_maxScaleArc(0.0),
    d_scaleDraw(0),
    d_maxMajIntv(36),
    d_maxMinIntv(10),
    d_scaleStep(0.0),
    d_needle(0)
{
    setBackgroundMode(NoBackground);
    setFocusPolicy(QWidget::TabFocus);

    QPalette p = palette();
    for ( int i = 0; i < QPalette::NColorGroups; i++ )
    {
        const QPalette::ColorGroup cg = (QPalette::ColorGroup)i;

        // Base: background color of the circle inside the frame.
        // Foreground: background color of the circle inside the scale

        p.setColor(cg, QColorGroup::Foreground, 
            p.color(cg, QColorGroup::Base));
    }
    setPalette(p);

    d_scaleDraw = new QwtDialScaleDraw(this);
    d_scaleDraw->setGeometry(0, 0, 0, QwtScaleDraw::Round);

    setScaleArc(0.0, 360.0); // scale as a full circle
    setRange(0.0, 360.0, 1.0, 10); // degrees as deafult
}