示例#1
0
void GPxiBasicAnalogOutput::ChangeSetPoint( double newValue )
{
	if(!gEqual(newValue, m_SetPoint)) 
		m_SetPoint = newValue;

	if(UpdatePhysicalOutput(newValue))
		emit SetPointChanged(newValue);
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
void tSmartTowSaveCreatePage::CreateInputSpinner()
{
    // model deleted by spinner
    if( m_pSetPointSpinner != 0 )
    {
        delete m_pSetPointSpinner;
    }
       
    tMercuryCommand* pCommand = tMercuryDataManager::Instance()->MercuryCommand();
    if( pCommand == 0 )
        return;

    quint16 min;
    quint16 max;
    quint16 cruiseStepSize;
    QString unit;

    quint16 setpoint = pCommand->CruiseSetpointConverted();
    pCommand->CruiseLimitsConverted( min, max );

    if( pCommand->IsCruiseInSpeedMode() )
    {
        cruiseStepSize = 1;
        unit = pCommand->CruiseSpeedUnit();
    }
    else
    {
        cruiseStepSize = 10;
        unit = pCommand->CruiseRpmUnit();
    }
    // setpoint and limits already converted
    if( setpoint < min )
        setpoint = min;
    if( setpoint > max )
        setpoint = max;

    m_pSetPointModel = new tInputSpinnerNumericalModel< quint16 >(  setpoint,
                                                                    min,
                                                                    max,
                                                                    cruiseStepSize, 
                                                                    unit.toLower() );

    QSize inputWidgetSize( AvailableRect().width(), m_SpinnerHeight );   
    m_pSetPointSpinner = new tInputSpinnerLabeled( tr("SET POINT"),
                                                  m_pSetPointModel,
                                                  inputWidgetSize,
                                                  this );
    m_pSetPointSpinner->setPos( AvailableRect().topLeft() );    
    Connect( m_pSetPointModel, SIGNAL( ValueChanged() ), this, SLOT( SetPointChanged() ) );
    
    AddInteractiveItem( m_pSetPointSpinner, true );
}