本文整理汇总了C++中QwtLinearScaleEngine::setTransformation方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtLinearScaleEngine::setTransformation方法的具体用法?C++ QwtLinearScaleEngine::setTransformation怎么用?C++ QwtLinearScaleEngine::setTransformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtLinearScaleEngine
的用法示例。
在下文中一共展示了QwtLinearScaleEngine::setTransformation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTransformation
void Plot::setTransformation( QwtTransform *transform )
{
QwtLinearScaleEngine *scaleEngine = new QwtLinearScaleEngine();
scaleEngine->setTransformation( transform );
setAxisScaleEngine( QwtAxis::xBottom, scaleEngine );
// we have to reassign the axis settinge, because they are
// invalidated, when the scale engine has changed
QwtScaleDiv scaleDiv =
axisScaleEngine( QwtAxis::xBottom )->divideScale( 10.0, 1000.0, 8, 10 );
QList<double> ticks;
ticks += 10.0;
ticks += scaleDiv.ticks( QwtScaleDiv::MajorTick );
scaleDiv.setTicks( QwtScaleDiv::MajorTick, ticks );
setAxisScaleDiv( QwtAxis::xBottom, scaleDiv );
replot();
}
示例2: QwtWheel
QWidget *WheelBox::createBox(
Qt::Orientation orientation, int type )
{
d_wheel = new QwtWheel();
d_wheel->setValue( 80 );
d_wheel->setWheelWidth( 20 );
d_wheel->setMass( 1.0 );
d_thermo = new QwtThermo();
if ( orientation == Qt::Horizontal )
{
d_thermo->setOrientation( orientation, QwtThermo::TopScale );
d_wheel->setOrientation( Qt::Vertical );
}
else
{
d_thermo->setOrientation( orientation, QwtThermo::LeftScale );
d_wheel->setOrientation( Qt::Horizontal );
}
switch( type )
{
case 0:
{
QwtLinearColorMap *colorMap = new QwtLinearColorMap();
colorMap->setColorInterval( Qt::blue, Qt::red );
d_thermo->setColorMap( colorMap );
break;
}
case 1:
{
QwtLinearColorMap *colorMap = new QwtLinearColorMap();
colorMap->setMode( QwtLinearColorMap::FixedColors );
int idx = 4;
colorMap->setColorInterval( Qt::GlobalColor( idx ),
Qt::GlobalColor( idx + 10 ) );
for ( int i = 1; i < 10; i++ )
{
colorMap->addColorStop( i / 10.0,
Qt::GlobalColor( idx + i ) );
}
d_thermo->setColorMap( colorMap );
break;
}
case 2:
{
d_wheel->setRange( 10, 1000 );
d_wheel->setSingleStep( 1.0 );
d_thermo->setScaleEngine( new QwtLogScaleEngine );
d_thermo->setScaleMaxMinor( 10 );
d_thermo->setFillBrush( Qt::darkCyan );
d_thermo->setAlarmBrush( Qt::magenta );
d_thermo->setAlarmLevel( 500.0 );
d_wheel->setValue( 800 );
break;
}
case 3:
{
d_wheel->setRange( -1000, 1000 );
d_wheel->setSingleStep( 1.0 );
d_wheel->setPalette( QColor( "Tan" ) );
QwtLinearScaleEngine *scaleEngine = new QwtLinearScaleEngine();
scaleEngine->setTransformation( new QwtPowerTransform( 2 ) );
d_thermo->setScaleMaxMinor( 5 );
d_thermo->setScaleEngine( scaleEngine );
QPalette pal = palette();
pal.setColor( QPalette::Base, Qt::darkGray );
pal.setColor( QPalette::ButtonText, QColor( "darkKhaki" ) );
d_thermo->setPalette( pal );
break;
}
case 4:
{
break;
}
}
d_thermo->setScale( d_wheel->minimum(), d_wheel->maximum() );
d_thermo->setValue( d_wheel->value() );
connect( d_wheel, SIGNAL( valueChanged( double ) ),
d_thermo, SLOT( setValue( double ) ) );
QWidget *box = new QWidget();
QBoxLayout *layout;
if ( orientation == Qt::Horizontal )
//.........这里部分代码省略.........
示例3: name
QwtSlider * createSlider (int sliderType)
{
QwtSlider * slider = new QwtSlider();
switch( sliderType )
{
case 0:
{
slider->setOrientation( Qt::Horizontal );
slider->setScalePosition( QwtSlider::TrailingScale );
slider->setTrough( true );
slider->setGroove( false );
slider->setSpacing( 0 );
slider->setHandleSize( QSize( 30, 16 ) );
slider->setScale( 10.0, -10.0 );
slider->setTotalSteps( 8 );
slider->setSingleSteps( 1 );
slider->setPageSteps( 1 );
slider->setWrapping( true );
break;
}
case 1:
{
slider->setOrientation( Qt::Horizontal );
slider->setScalePosition( QwtSlider::NoScale );
slider->setTrough( true );
slider->setGroove( true );
slider->setScale( 0.0, 1.0 );
slider->setTotalSteps( 100 );
slider->setSingleSteps( 1 );
slider->setPageSteps( 5 );
break;
}
case 2:
{
slider->setOrientation( Qt::Horizontal );
slider->setScalePosition( QwtSlider::LeadingScale );
slider->setTrough( false );
slider->setGroove( true );
slider->setHandleSize( QSize( 12, 25 ) );
slider->setScale( 1000.0, 3000.0 );
slider->setTotalSteps( 200.0 );
slider->setSingleSteps( 2 );
slider->setPageSteps( 10 );
break;
}
case 3:
{
slider->setOrientation( Qt::Horizontal );
slider->setScalePosition( QwtSlider::TrailingScale );
slider->setTrough( true );
slider->setGroove( true );
QwtLinearScaleEngine *scaleEngine = new QwtLinearScaleEngine( 2 );
scaleEngine->setTransformation( new QwtPowerTransform( 2 ) );
slider->setScaleEngine( scaleEngine );
slider->setScale( 0.0, 128.0 );
slider->setTotalSteps( 100 );
slider->setStepAlignment( false );
slider->setSingleSteps( 1 );
slider->setPageSteps( 5 );
break;
}
}
if (slider)
{
QString name( "Slider %1" );
slider->setObjectName( name.arg( sliderType ) );
}
return slider;
}