예제 #1
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);
}
예제 #2
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;
}
예제 #3
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);
}