예제 #1
1
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
// -----------------------------------------------------------------------
    ui->setupUi(this);
    QGraphicsScene *scene = new QGraphicsScene(this);
    ui->graphicsView->setScene(scene);
// -----------------------------------------------------------------------
    // kolor pedzla
    QBrush brush = QBrush(Qt::red);
    brush.setStyle(Qt::DiagCrossPattern);
    // tworzymy obiekts
    QGraphicsRectItem *rect = new QGraphicsRectItem(10, 10, 90, 90);
    rect->setBrush(brush);
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
    // definiujemy czas trwania animacji
    QTimeLine *timeLine = new QTimeLine(1000);
    timeLine->setFrameRange(0, 100);

    // definiujemy animacje
    QGraphicsItemAnimation *animation = new QGraphicsItemAnimation();
    animation->setItem(rect);
    animation->setTimeLine(timeLine);

    // animacja
    int odcinek = 100;
    for (int i = 0; i < 100; ++i)
        animation->setPosAt(i / 100.0, QPointF(i, i));

    // uruchamiamy scenę i animację
    scene->addItem(rect);
    timeLine->start();
}
예제 #2
0
MessageBubble::MessageBubble(QGraphicsWidget* parent)
: GraphicsHudWidget(parent)
, d(new MessageBubblePrivate)
{
    d->mWidget = new QGraphicsWidget;
    d->mCountDownWidget = new CountDownWidget;
    d->mCountDownWidget->setValue(1);
    d->mLabel = new GraphicsHudLabel;

    QTimeLine* timeLine = new QTimeLine(TIMEOUT, this);
    connect(timeLine, SIGNAL(valueChanged(qreal)),
            SLOT(slotTimeLineChanged(qreal)));
    connect(timeLine, SIGNAL(finished()),
            SLOT(fadeOut()));
    connect(this, SIGNAL(fadedOut()),
            SLOT(deleteLater()));
    timeLine->start();

    d->mLayout = new QGraphicsLinearLayout(d->mWidget);
    d->mLayout->setContentsMargins(0, 0, 0, 0);
    d->mLayout->addItem(d->mCountDownWidget);
    d->mLayout->addItem(d->mLabel);

    init(d->mWidget, GraphicsHudWidget::OptionCloseButton);
}
예제 #3
0
int main(int argv, char *args[])
{
    QApplication app(argv, args);

//! [0]
    QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);
    
    QTimeLine *timer = new QTimeLine(5000);
    timer->setFrameRange(0, 100);
    
    QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
    animation->setItem(ball);
    animation->setTimeLine(timer);

    for (int i = 0; i < 200; ++i) 
	animation->setPosAt(i / 200.0, QPointF(i, i));
    
    QGraphicsScene *scene = new QGraphicsScene();
    scene->setSceneRect(0, 0, 250, 250);
    scene->addItem(ball);

    QGraphicsView *view = new QGraphicsView(scene);
    view->show();

    timer->start();
//! [0]

    return app.exec();
}
예제 #4
0
PhotoKitView::PhotoKitView(QWidget *parent) :
	QGraphicsView(parent),mPressed(false),mMachine(0),mCanTransform(true),mZoomOnMove(false)
{
	//setDragMode(QGraphicsView::NoDrag);
    //setAlignment(Qt::AlignBottom);
    //setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
    setTransformationAnchor(QGraphicsView::AnchorViewCenter);
    setResizeAnchor(QGraphicsView::AnchorUnderMouse);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //TODO: always on when debug.
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    //setBackgroundBrush(QBrush(Qt::gray));
	mScene = new PhotoKitScene(this);

	setRenderingSystem();
	mScene->setSceneRect(qApp->desktop()->rect());
	setScene(mScene);

	mMachine = new TransformMachine;//QGraphicsItemAnimation;
	connect(mMachine, SIGNAL(transformChanged(QTransform)), SLOT(doTransform(QTransform)));

	QTimeLine *timer = new QTimeLine(kAniDuration);
	timer->setEasingCurve(QEasingCurve::OutQuad);
	timer->setFrameRange(0, 100);
	mMachine->setTimeLine(timer);
}
void smallPictureView::movItemPos(int i){

    allPixItem.at(i)->show();
    QTimeLine *timeLine = new QTimeLine(300);
    timeLine->setFrameRange(0, 300);
    midPixItemFlag->hide();
    scene.setSceneRect(0,widheight-81,widwidth,48);
    //scene.setSceneRect(-widwidth/2, -24,widwidth,48);
    allAnimation.at(i)->setTimeLine(timeLine);
    allAnimation.at(i)->clear();
    allAnimation.at(i)->setItem(allPixItem.at(i));
    if(i<selectedNum){//left
        //将该项目的位置设置为给定的步长值到指定的点。
        allAnimation.at(i)->setPosAt(1, QPointF((36+1)*(i-selectedNum-1)+width()/2.0,widheight-81));
    }else if(i>selectedNum){//right
        //将该项目的位置设置为给定的步长值到指定的点。
        allAnimation.at(i)->setPosAt(1, QPointF(3+(36+1)*(i-selectedNum)+width()/2.0,widheight-81));
    }else{//selected
        if(selectedNum!=oldSelectNum){

            midPixItemFlag->hide();
            oldSelectNum = selectedNum;
        }
        //将该项目的位置设置为给定的步长值到指定的点。
        allAnimation.at(i)->setPosAt(1, QPointF(3-18+(36+1)*(i-selectedNum)+width()/2.0,widheight-81));
        connect(timeLine,SIGNAL(finished()),this,SLOT(timelineFinished()));
    }
    timeLine->start();
}
예제 #6
0
 MarblePhysicsPrivate( MarbleAbstractPresenter *presenter )
     : m_presenter( presenter ),
       m_mode( Instant ),
       m_planetRadius( EARTH_RADIUS )
 {
     m_timeline.setDuration(2000);
     m_timeline.setCurveShape( QTimeLine::EaseInOutCurve );
 }
예제 #7
0
파일: pong.cpp 프로젝트: andpei/pong
Pong::Pong() {
    // players
    player1 = new QGraphicsRectItem(0, 0, PADDLE, PADDLE * 3);
    player1->setPos(PADDLE, (HEIGHT - PADDLE * 3) / 2);
    player1->setBrush(QBrush(Qt::gray));
    addItem(player1);
    player2 = new QGraphicsRectItem(0, 0, PADDLE, PADDLE * 3);
    player2->setPos(WIDTH - PADDLE * 2, (HEIGHT - PADDLE * 3) / 2);
    player2->setBrush(QBrush(Qt::gray));
    addItem(player2);

    // ball
    ball = new QGraphicsEllipseItem(0, 0, PADDLE, PADDLE);
    ball->setPos((WIDTH - PADDLE) / 2, (HEIGHT - PADDLE) / 2);
    ball->setBrush(QBrush(Qt::gray));
    addItem(ball);

    // score
    tscore1 = new QGraphicsSimpleTextItem();
    tscore1->setText("0");
    tscore1->setFont(QFont("Times", 36, QFont::Bold));
    tscore1->setPos(WIDTH / 2 - PADDLE - 24, PADDLE);
    tscore1->setBrush(QBrush(Qt::gray));
    addItem(tscore1);
    tscore2 = new QGraphicsSimpleTextItem();
    tscore2->setText("0");
    tscore2->setFont(QFont("Times", 36, QFont::Bold));
    tscore2->setPos(WIDTH / 2 + PADDLE, PADDLE);
    tscore2->setBrush(QBrush(Qt::gray));
    addItem(tscore2);

    // line
    int h = 0;
    int pointSize = PADDLE / 4;
    while (h < HEIGHT) {
        QGraphicsRectItem *linePoint = new QGraphicsRectItem(0, 0, pointSize, pointSize);
        linePoint->setBrush(QBrush(Qt::gray));
        linePoint->setPos((WIDTH - pointSize) / 2, h);
        addItem(linePoint);
        h += pointSize * 2;
    }

    score1 = 0;
    score2 = 0;
    dx = -1;
    dy = -1;
    speedUpCounter = 0;
    ballSpeed = 0.2;
    setSceneRect(0, 0, WIDTH, HEIGHT);
    setBackgroundBrush(QBrush(Qt::black));

    QTimeLine *timer = new QTimeLine();
    timer->setFrameRange(0, 100);
    timer->setLoopCount(10000);
    timer->start();

    connect(timer, SIGNAL(frameChanged(int)), this, SLOT(value_changed(int)));
}
void LinkDialogProcessorGraphicsItem::animationStart() {
    animateExpansion_ = 0.1f;

    QTimeLine* anim = new QTimeLine(50, this);
    anim->setUpdateInterval(20);
    connect(anim, SIGNAL(valueChanged(qreal)), SLOT(animate(qreal)));
    connect(anim, SIGNAL(finished()), SLOT(animationEnd()));
    anim->start();
}
예제 #9
0
void EditorView::startAnimation(char const *slot)
{
    QTimeLine *anim = new QTimeLine(zoomAnimationTimes * zoomAnimationInterval, this);
    anim->setUpdateInterval(zoomAnimationInterval);

    connect(anim, SIGNAL(valueChanged(qreal)), this, slot);
    connect(anim, SIGNAL(finished()), this, SLOT(animFinished()));
    anim->start();
}
예제 #10
0
void OnOffButton::animate(int xStart, int xEnd)
{
    QTimeLine *timeLine = new QTimeLine(300, this);
    timeLine->setFrameRange(xStart, xEnd);
    connect(timeLine, SIGNAL(frameChanged(int)), this, SLOT(updateAnimation(int)));
    timeLine->start();


}
예제 #11
0
void LinkDialogGraphicsScene::wheelAction(float offset) {
    currentScrollSteps_ = offset;

    QTimeLine* anim = new QTimeLine(750, this);
    anim->setUpdateInterval(20);
    connect(anim, SIGNAL(valueChanged(qreal)), SLOT(executeTimeLine(qreal)));
    connect(anim, SIGNAL(finished()), SLOT(terminateTimeLine()));
    anim->start();
}
예제 #12
0
파일: main.cpp 프로젝트: Xambey/learning
int main (int argc, char** argv)
{
    QApplication app(argc, argv);

    QGraphicsView view;
    QGraphicsScene *scene = new QGraphicsScene(&view);
    scene->setItemIndexMethod(QGraphicsScene::NoIndex);

    Line *left, *right, *right2;

    int of = pos_x;

    for(int i = 0; i < c; i++)
    {
        Line* ball = new Line(QPoint(of, -2));
        scene->addItem(ball);
        of += size;
        if(i==0)
            left = ball;
        else if(i == c - 1)
            right = ball;
        else if(i == c - 2)
            right2 = ball;
    }

    QTimeLine *LeftTimerTo      = newAnim(left,0,45,QEasingCurve::OutQuart);
    QTimeLine *LeftTimerReturn    = newAnim(left,45,0,QEasingCurve::InQuart);
    QTimeLine *RightTimerTo     = newAnim(right,0,-45,QEasingCurve::OutQuart);
    QTimeLine *RightTimerBack   = newAnim(right,-45,0,QEasingCurve::InQuart);
    QTimeLine *RightTimerTo2     = newAnim(right2,0,-45,QEasingCurve::OutQuart);
    QTimeLine *RightTimerBack2   = newAnim(right2,-45,0,QEasingCurve::InQuart);



    scene->setSceneRect(0, 0, 940, 460);

    view.setCacheMode(QGraphicsView::CacheBackground);
    view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    view.setScene(scene);
    view.resize(960, 480);
    view.show();

    QObject::connect(LeftTimerTo,   SIGNAL(finished()), LeftTimerReturn,  SLOT(start()));
    QObject::connect(LeftTimerReturn, SIGNAL(finished()), RightTimerTo,   SLOT(start()));
    QObject::connect(LeftTimerReturn, SIGNAL(finished()), RightTimerTo2,   SLOT(start()));
    QObject::connect(RightTimerTo,  SIGNAL(finished()), RightTimerBack, SLOT(start()));
    QObject::connect(RightTimerTo2,  SIGNAL(finished()), RightTimerBack2, SLOT(start()));
    QObject::connect(RightTimerBack,SIGNAL(finished()), LeftTimerTo,    SLOT(start()));

    LeftTimerReturn->start();

    return app.exec();
}
예제 #13
0
파일: main.cpp 프로젝트: Xambey/learning
QTimeLine* newAnim(Line* ball, int in, int to, QEasingCurve curve)
{
    QTimeLine *NewTimer = new QTimeLine(speed);
    NewTimer->setEasingCurve(curve);

    QGraphicsItemAnimation* anim = new QGraphicsItemAnimation();
    anim->setItem(ball);
    anim->setTimeLine(NewTimer);
    anim->setRotationAt(0, in);
    anim->setRotationAt(1, to);

    return NewTimer;
}
예제 #14
0
 void updateOpacity()
 {
     QPoint pos = q->parentWidget()->mapFromGlobal(QCursor::pos());
     QRect opaqueRect = q->geometry();
     bool opaqueCollapser = opaqueRect.contains(pos);
     int frame = mOpacityTimeLine->currentFrame();
     if (opaqueCollapser && frame == mOpacityTimeLine->startFrame()) {
         mOpacityTimeLine->setDirection(QTimeLine::Forward);
         startTimeLine();
     } else if (!opaqueCollapser && frame == mOpacityTimeLine->endFrame()) {
         mOpacityTimeLine->setDirection(QTimeLine::Backward);
         startTimeLine();
     }
 }
예제 #15
0
animate::animate()
{
     setPixmap(QPixmap(":/animate/dancer/dancer_2a1.png"));

     QTimeLine *timeline = new QTimeLine(2000);

     timeline->setFrameRange(0,16);

     connect(timeline,SIGNAL(frameChanged(int)),SLOT(setpic(int)));

     timeline->start();



}
예제 #16
0
void MyQGraphicsView::wheelEvent ( QWheelEvent * event )
{
    int numDegrees = event->delta() / 8;
    int numSteps = numDegrees / 15;  // see QWheelEvent documentation
    _numScheduledScalings += numSteps;
    if (_numScheduledScalings * numSteps < 0)  // if user moved the wheel in another direction, we reset previously scheduled scalings
        _numScheduledScalings = numSteps;
 
    QTimeLine *anim = new QTimeLine(350, this);
    anim->setUpdateInterval(50);
 
    connect(anim, SIGNAL(valueChanged(qreal)), SLOT(scalingTime(qreal)));
    connect(anim, SIGNAL(finished()), SLOT(animFinished()));
    anim->start();
}
예제 #17
0
void PathologyViewer::zoom(float numSteps) {
  if (!_img) {
    return;
  }
  _numScheduledScalings += numSteps;
  if (_numScheduledScalings * numSteps < 0)  {
    _numScheduledScalings = numSteps;
  }

  QTimeLine *anim = new QTimeLine(300, this);
  anim->setUpdateInterval(5);

  connect(anim, SIGNAL(valueChanged(qreal)), SLOT(scalingTime(qreal)));
  connect(anim, SIGNAL(finished()), SLOT(zoomFinished()));
  anim->start();
}
예제 #18
0
    void smoothScrollTo(const QModelIndex& index)
    {
        if (!index.isValid()) {
            return;
        }

        const QRect rect = q->visualRect(index);

        int oldValue = scrollBar()->value();
        int newValue = scrollToValue(rect);
        if (mTimeLine->state() == QTimeLine::Running) {
            mTimeLine->stop();
        }
        mTimeLine->setFrameRange(oldValue, newValue);
        mTimeLine->start();
    }
예제 #19
0
ItemAnimation::ItemAnimation(QGraphicsItem *item, QObject *parent) :
	QObject(parent),mHide(false),mFade(None)
{
	mMachine = new TransformMachine;//QGraphicsItemAnimation;
	QTimeLine *timer = new QTimeLine(1000);
	timer->setEasingCurve(QEasingCurve::OutQuad);
	timer->setFrameRange(0, 100);
	mMachine->setTimeLine(timer);
	connect(mMachine, SIGNAL(transformChanged(QTransform)), this, SLOT(setTransform(QTransform)));
	connect(mMachine, SIGNAL(zValueChanged(qreal)), this, SLOT(setZValue(qreal)));
	connect(mMachine, SIGNAL(posChanged(QPointF)), this, SLOT(setItemPos(QPointF)));
	connect(mMachine->timeLine(), SIGNAL(finished()), this, SLOT(tryHide()));
	connect(mMachine->timeLine(), SIGNAL(finished()), this, SIGNAL(finished()));

	setItem(item);
}
예제 #20
0
void SCFadeCrossStrategy::setup(const SCPageEffect::Data &data, QTimeLine &timeLine)
{
    timeLine.setFrameRange(0, 1000); // TODO might not be needed
    data.m_oldPageItem->setZValue(1);
    data.m_newPageItem->setZValue(2);
    data.m_newPageItem->setOpacity(0);
    data.m_oldPageItem->show();
    data.m_newPageItem->show();
}
void MainWindow::slotAddAnimationItem() //在场景中加入一个动画星星
{
    StartItem *item = new StartItem;
    QGraphicsItemAnimation *anim = new QGraphicsItemAnimation;
    anim->setItem(item);
    QTimeLine *timeLine = new QTimeLine(4000);
    timeLine->setCurveShape(QTimeLine::SineCurve);
    timeLine->setLoopCount(0);

    anim->setTimeLine(timeLine);

    int y =(qrand()%400)-200;
    for(int i=0; i<400; i++)
    {
        anim->setPosAt(i/400.0,QPointF(i-200,y));
    }
    timeLine->start();
    scene->addItem(item);
}
void KPrFadeOverColorStrategy::setup(const KPrPageEffect::Data &data, QTimeLine &timeLine)
{
    timeLine.setFrameRange(0, 1000); // TODO might not be needed
    data.m_graphicsView->setBackgroundBrush(m_fadeColor);
    data.m_oldPageItem->setZValue(1);
    data.m_newPageItem->setZValue(2);
    data.m_newPageItem->setOpacity(0);
    data.m_oldPageItem->show();
    data.m_newPageItem->show();
}
예제 #23
0
void GraphBase::UpDateStrategy(QString strategyName)
{

    //存入原来的位置
    this->mAnimationStartPosition.clear();
    for (NodeBase *node : mNodes)
    {
        node->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, false);
        mAnimationStartPosition.push_back(node->scenePos());
    }

    if (strategyName == "Circular")
    {
        vtkSmartPointer<vtkCircularLayoutStrategy> circularStrategy
            = vtkSmartPointer<vtkCircularLayoutStrategy>::New();
        mStoredLayout->SetLayoutStrategy(circularStrategy);
    }
    if (strategyName == "ForceDirected")
    {
        vtkSmartPointer<vtkForceDirectedLayoutStrategy> forceStrategy
            = vtkSmartPointer<vtkForceDirectedLayoutStrategy>::New();
        mStoredLayout->SetLayoutStrategy(forceStrategy);
    }
    if (strategyName == "Fast2D")
    {
        vtkSmartPointer<vtkFast2DLayoutStrategy> fastStrategy
            = vtkSmartPointer<vtkFast2DLayoutStrategy>::New();
        mStoredLayout->SetLayoutStrategy(fastStrategy);
    }

    mStoredLayout->Update();
    mOutPutGraph = mStoredLayout->GetOutput();


    UpdateEndPosition(strategyName);
    QTimeLine *animation = new QTimeLine();
    animation->setUpdateInterval(50);
    connect(animation, SIGNAL(valueChanged(qreal)), this, SLOT(OnAnimation(qreal)));
    connect(animation, SIGNAL(finished()), this, SLOT(OnAnimationEnd()));
    
    animation->start();
}
예제 #24
0
void MainWindow::createProgressBar()
{
	QxtProgressLabel* label = new QxtProgressLabel(statusBar());

	QProgressBar* bar = new QProgressBar(statusBar());
	bar->setMaximumWidth(label->sizeHint().width() * 2);
	bar->setRange(0, 120);

	QTimeLine* timeLine = new QTimeLine(120000, this);
	timeLine->setFrameRange(0, 120);

	connect(timeLine, SIGNAL(frameChanged(int)), bar, SLOT(setValue(int)));
	connect(timeLine, SIGNAL(finished()), label, SLOT(restart()));
	connect(bar, SIGNAL(valueChanged(int)), label, SLOT(setValue(int)));
	timeLine->start();

    statusBar()->addPermanentWidget(new QLabel(tr("Dummy Progress:"), this));
	statusBar()->addPermanentWidget(bar);
	statusBar()->addPermanentWidget(label);
}
예제 #25
0
Pong::Pong()
{
	this->setSceneRect(0, 0, WIDTH, HEIGHT);
	this->p1 = new QGraphicsRectItem(0, 0,
					 PADDLE,
					 PADDLE*3);
	this->p2 = new QGraphicsRectItem(0, 0,
					 PADDLE,
					 PADDLE*3);

	this->p1->setPos(PADDLE, (HEIGHT-PADDLE*3)/2);
	this->p2->setPos(WIDTH-PADDLE*2, (HEIGHT-PADDLE*3)/2);
	this->p1->setBrush(QBrush(Qt::red));
	this->p2->setBrush(QBrush(Qt::blue));

	/* ball */
	this->ball = new QGraphicsEllipseItem(0, 0, PADDLE, PADDLE);
	this->ball->setPos((WIDTH-PADDLE)/2, (HEIGHT-PADDLE)/2);
	this->ball->setBrush(QBrush(Qt::black));
	
	this->setFocusItem(p1);

	this->dx = -1;
	this->dy = -1;

	QTimeLine *timer = new QTimeLine(5000);
	timer->setFrameRange(0, 100);
	
	this->addItem(ball);
	this->addItem(p1);
	this->addItem(p2);

	timer->setLoopCount(10000);
	timer->start();
	connect(timer,
		SIGNAL(frameChanged(int)),
		this,
		SLOT(value_changed(int)));
	}
예제 #26
0
//cppcheck-suppress unusedFunction
void VMainGraphicsView::wheelEvent(QWheelEvent *event)
{
    int numSteps = event->delta() / 8 / 15;  // see QWheelEvent documentation

    _numScheduledScalings += numSteps;
    if (_numScheduledScalings * numSteps < 0)
    {  // if user moved the wheel in another direction, we reset
        _numScheduledScalings = numSteps;       // previously scheduled scalings
    }

    QTimeLine *anim = new QTimeLine(300, this);
    anim->setUpdateInterval(20);

    if (QApplication::keyboardModifiers() == Qt::ControlModifier)
    {// If you press CTRL this code will be executed
        connect(anim, &QTimeLine::valueChanged, this, &VMainGraphicsView::scalingTime);
    }
    else
    {
        connect(anim, &QTimeLine::valueChanged, this, &VMainGraphicsView::scrollingTime);
    }
    connect(anim, &QTimeLine::finished, this, &VMainGraphicsView::animFinished);
    anim->start();
}
예제 #27
0
    qreal suggestedRange(qreal t) const
    {
        Q_ASSERT( m_mode == Linear || m_mode == Jump);
        Q_ASSERT( 0 <= t && t <= 1.0 );

        if (m_mode == Linear) {
            qreal in = m_source.range();
            qreal out = m_target.range();

            return in + t * (out-in);
        }
        else if (m_mode == Jump) {
            qreal jumpDuration = m_timeline.duration();

            // Purely cinematic approach to calculate the jump path        
            qreal g = qMin(m_source.range(), m_target.range()); // Min altitude
            qreal k = qMax(m_source.range(), m_target.range()); // Base altitude
            qreal d = t > 0.5 ? m_source.range() - g : m_target.range() - g; // Base difference
            qreal c = d * 2 * qAbs(t - 0.5); // Correction factor
            qreal h = qMin(1000*3000.0, totalDistance() / 2.0); // Jump height

            // Parameters for the parabolic function that has the maximum at
            // the point H ( 0.5 * m_jumpDuration, g + h )
            qreal a = - h / ( (qreal)( 0.25 * jumpDuration * jumpDuration ) );
            qreal b = 2.0 * h / (qreal)( 0.5 * jumpDuration );

            qreal x = jumpDuration * t;
            qreal y = ( a * x + b ) * x + k - c;       // Parabolic function

            return y;
        }
        else {
            qWarning("Unhandled FlyTo mode, no camera distance interpolation.");
            return m_target.range();
        }
    }
예제 #28
0
void ZigZagWipeStrategy::setup(const SCPageEffect::Data &data, QTimeLine &timeLine)
{
    Q_UNUSED(data);
    timeLine.setFrameRange(0, StepCount);
}
예제 #29
0
void PinDialog::init( PinFlags flags, const QString &title, TokenData::TokenFlags token )
{
	setMinimumWidth( 350 );
	setWindowModality( Qt::ApplicationModal );

	QLabel *label = new QLabel( this );
	QVBoxLayout *l = new QVBoxLayout( this );
	l->addWidget( label );

	QString _title = title;
	QString text;

	if( token & TokenData::PinFinalTry )
		text += "<font color='red'><b>" + tr("PIN will be locked next failed attempt") + "</b></font><br />";
	else if( token & TokenData::PinCountLow )
		text += "<font color='red'><b>" + tr("PIN has been entered incorrectly one time") + "</b></font><br />";

	text += QString( "<b>%1</b><br />" ).arg( title );
	if( flags & Pin2Type )
	{
		_title = tr("Signing") + " - " + title;
		text += tr("Selected action requires sign certificate.") + "<br />" +
			(flags & PinpadFlag ?
				tr("For using sign certificate enter PIN2 with pinpad") :
				tr("For using sign certificate enter PIN2") );
		regexp.setPattern( "\\d{5,12}" );
	}
	else
	{
		_title = tr("Authendicating") + " - " + title;
		text += tr("Selected action requires auth certificate.") + "<br />" +
			(flags & PinpadFlag ?
				tr("For using auth certificate enter PIN1 with pinpad") :
				tr("For using auth certificate enter PIN1") );
		regexp.setPattern( "\\d{4,12}" );
	}
	setWindowTitle( _title );
	label->setText( text );

	if( flags & PinpadFlag )
	{
		setWindowFlags( (windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowCloseButtonHint );
		QProgressBar *progress = new QProgressBar( this );
		progress->setRange( 0, 30 );
		progress->setValue( progress->maximum() );
		progress->setTextVisible( false );
		l->addWidget( progress );
		QTimeLine *statusTimer = new QTimeLine( progress->maximum() * 1000, this );
		statusTimer->setCurveShape( QTimeLine::LinearCurve );
		statusTimer->setFrameRange( progress->maximum(), progress->minimum() );
		connect( statusTimer, SIGNAL(frameChanged(int)), progress, SLOT(setValue(int)) );
		connect( this, SIGNAL(startTimer()), statusTimer, SLOT(start()) );
	}
	else
	{
		m_text = new QLineEdit( this );
		m_text->setEchoMode( QLineEdit::Password );
		m_text->setFocus();
		m_text->setValidator( new QRegExpValidator( regexp, m_text ) );
		connect( m_text, SIGNAL(textEdited(QString)), SLOT(textEdited(QString)) );
		l->addWidget( m_text );

		QDialogButtonBox *buttons = new QDialogButtonBox(
			QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, this );
		ok = buttons->button( QDialogButtonBox::Ok );
		ok->setAutoDefault( true );
		connect( buttons, SIGNAL(accepted()), SLOT(accept()) );
		connect( buttons, SIGNAL(rejected()), SLOT(reject()) );
		l->addWidget( buttons );

		textEdited( QString() );
	}
}
예제 #30
0
 void startTimeLine()
 {
     if (mOpacityTimeLine->state() != QTimeLine::Running) {
         mOpacityTimeLine->start();
     }
 }