コード例 #1
0
QScriptValue PHIBaseItem::pos( const QScriptValue &x, const QScriptValue &y )
{
    if ( !x.isValid() ) {
        QPointF p=adjustedPos();
        QScriptValue v=scriptEngine()->newObject();
        v.setProperty( L1( "left" ), qRound( realX()+p.x() ) );
        v.setProperty( L1( "top" ), qRound( realY()+p.y() ) );
        v.setProperty( L1( "x" ), qRound( realX() ) );
        v.setProperty( L1( "y" ), qRound( realY() ) );
        return v;
    }
    setPos( x.toNumber(), y.toNumber() );
    return self();
}
コード例 #2
0
QScriptValue PHIBaseItem::moveBy( qint32 left, qint32 top, qint32 width, qint32 height, qint32 start, qint32 duration, const QString &ease )
{
    QEasingCurve::Type curve=PHI::toEasingCurveType( ease );
    _effect->setMoveBy( start, duration, left, top, width, height, curve );
    if ( !isClientItem() ) return self();
    QParallelAnimationGroup *group=new QParallelAnimationGroup( this );
    QPropertyAnimation *l=new QPropertyAnimation( this, BL( "_x" ), group );
    l->setEndValue( PHIBOUND(left)+qRound( realX() ) );
    l->setDuration( duration );
    l->setEasingCurve( curve );
    QPropertyAnimation *t=new QPropertyAnimation( this, BL( "_y" ), group );
    t->setEndValue( PHIBOUND(top)+qRound( realY() ) );
    t->setDuration( duration );
    t->setEasingCurve( curve );
    QPropertyAnimation *w=new QPropertyAnimation( this, BL( "_width" ), group );
    w->setEndValue( PHIBOUND(width)+qRound( realWidth() ) );
    w->setDuration( duration );
    w->setEasingCurve( curve );
    QPropertyAnimation *h=new QPropertyAnimation( this, BL( "_height" ), group );
    h->setEndValue( PHIBOUND(height)+qRound( realHeight() ) );
    h->setDuration( duration );
    h->setEasingCurve( curve );
    group->addAnimation( l );
    group->addAnimation( t );
    group->addAnimation( w );
    group->addAnimation( h );
    connect( group, &QAbstractAnimation::finished, group, &QAbstractAnimation::deleteLater );
    QTimer::singleShot( start, group, SLOT( start() ) );
    return self();
}
コード例 #3
0
ファイル: DSRCCar.cpp プロジェクト: nightfly19/renyang-learn
bool DSRCCar::BrLocation()
{
	int channel = -1;
	if( AccLevel() == BRAKE_EMERG || backBulb() == BULB_RED){
		if( ChChMode() == CHCH_POLL ){
			channel = ChannelWarnPolling();
		}else if( ChChMode() == CHCH_ID_POLL ){
			channel = ChannelWarnPollingMod2(); 
		}
	}else{
		if( ChChMode() == CHCH_POLL ){
			channel = ChannelPolling();
		}else if( ChChMode() == CHCH_ID_POLL ){
			channel = ChannelPollingMod4(); 
		}
	}

	if( channel == -1 )	return false;
	InfoPacket *p = new InfoPacket(  realX(), realY() , nodeID(), realVelocity() );

//	debug("DSRCCar BrLocation::  (%e,%e)",p->X(),p->Y());

	return ni1 . BrSend( p , channel);
}
コード例 #4
0
QScriptValue PHIBaseItem::left( const QScriptValue &v )
{
    if ( !v.isValid() ) return qRound( realX()+adjustedPos().x() );
    setX( v.toNumber()-adjustedPos().x() );
    return self();
}
コード例 #5
0
QScriptValue PHIBaseItem::x( const QScriptValue &v )
{
    if ( !v.isValid() ) return qRound( realX() );
    setX( v.toNumber() );
    return self();
}