Exemplo n.º 1
0
void CardItem::goBack(bool kieru){
    if(home_pos == pos()){
        if(kieru)
            setOpacity(0.0);
        return;
    }

    QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
    goback->setEndValue(home_pos);
    goback->setEasingCurve(QEasingCurve::OutQuart);
    goback->setDuration(300);

    if(kieru){
        QParallelAnimationGroup *group = new QParallelAnimationGroup;

        QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
        disappear->setStartValue(0.0);
        disappear->setKeyValueAt(0.2, 1.0);
        disappear->setKeyValueAt(0.8, 1.0);
        disappear->setEndValue(0.0);

        goback->setDuration(1000);
        disappear->setDuration(1000);

        group->addAnimation(goback);
        group->addAnimation(disappear);

        // prevent the cover face bug
        setEnabled(false);

        group->start(QParallelAnimationGroup::DeleteWhenStopped);
    }else
        goback->start(QPropertyAnimation::DeleteWhenStopped);
}
Exemplo n.º 2
0
void UnseenEpisodeWidget::animateNextEpisode()
{
    _currentWidget->setEnabled(false);
    _nextWidget = _makeWidget();

    if (_nextWidget) {
        layout()->addWidget(_nextWidget);

        _currentWidget->setMinimumWidth(_currentWidget->width());
        _nextWidget->setMinimumWidth(_currentWidget->width());

        QPoint finalPos = _currentWidget->pos();
        int duration = 600;

        QPropertyAnimation *slideOut = new QPropertyAnimation(_currentWidget, "pos", this);
        slideOut->setDuration(duration);
        slideOut->setStartValue(finalPos);
        slideOut->setEndValue(QPoint(finalPos.x() - _currentWidget->width(), finalPos.y()));
        slideOut->setEasingCurve(QEasingCurve::OutQuart);

        QPropertyAnimation *slideIn = new QPropertyAnimation(_nextWidget, "pos", this);
        slideIn->setDuration(duration);
        slideIn->setStartValue(QPoint(finalPos.x() + _currentWidget->width(), finalPos.y()));
        slideIn->setEndValue(finalPos);
        slideIn->setEasingCurve(QEasingCurve::OutQuart);

        QParallelAnimationGroup *group = new QParallelAnimationGroup(_currentWidget);
        group->addAnimation(slideOut);
        group->addAnimation(slideIn);

        group->start(QAbstractAnimation::DeleteWhenStopped);
        group->connect(group, SIGNAL(finished()), this, SLOT(setupNewCurrent()));
    }
}
Exemplo n.º 3
0
void LinkSelectionItem::appear(const QPointF& animStartPos, const QRectF& linkRect) 
{
    QGraphicsBlurEffect* blur = new QGraphicsBlurEffect();
    blur->setBlurHints(QGraphicsBlurEffect::PerformanceHint);
    blur->setBlurRadius(15);
    setGraphicsEffect(blur);

    QPropertyAnimation* rectAnimation = new QPropertyAnimation(this, "rect");
    rectAnimation->setDuration(s_appearAnimDuration);

    rectAnimation->setStartValue(QRectF(animStartPos, QSize(3, 3)));
    rectAnimation->setEndValue(linkRect);    

    rectAnimation->setEasingCurve(QEasingCurve::OutExpo);

    QPropertyAnimation* opacityAnimation = new QPropertyAnimation(this, "opacity");
    opacityAnimation->setDuration(s_disappearAnimDuration);

    opacityAnimation->setStartValue(s_linkOpacity);
    opacityAnimation->setEndValue(0.0);

    opacityAnimation->setEasingCurve(QEasingCurve::InExpo);
    
    m_linkSelectiogroup.addAnimation(rectAnimation);
    m_linkSelectiogroup.addAnimation(opacityAnimation);
    m_linkSelectiogroup.start();
}
Exemplo n.º 4
0
void Photo::setEmotion(const QString &emotion, bool permanent) {
    if (emotion == ".") {
        hideEmotion();
        return;
    }

    QString path = QString("image/system/emotion/%1.png").arg(emotion);
    if (QFile::exists(path)) {
        QPixmap pixmap = QPixmap(path);
        emotion_item->setPixmap(pixmap);
        emotion_item->setPos((G_PHOTO_LAYOUT.m_normalWidth - pixmap.width()) / 2,
                             (G_PHOTO_LAYOUT.m_normalHeight - pixmap.height()) / 2);
        _layBetween(emotion_item, _m_chainIcon, _m_roleComboBox);

        QPropertyAnimation *appear = new QPropertyAnimation(emotion_item, "opacity");
        appear->setStartValue(0.0);
        if (permanent) {
            appear->setEndValue(1.0);
            appear->setDuration(500);
        } else {
            appear->setKeyValueAt(0.25, 1.0);
            appear->setKeyValueAt(0.75, 1.0);
            appear->setEndValue(0.0);
            appear->setDuration(2000);
        }
        appear->start(QAbstractAnimation::DeleteWhenStopped);
    } else {
        PixmapAnimation::GetPixmapAnimation(this, emotion);
    }
}
Exemplo n.º 5
0
void
StatsGauge::setValue( int v )
{
    if ( maximum() == 0 || v == 0 )
        return;
    if ( v == m_targetValue )
        return;

    m_targetValue = v;
    {
        QPropertyAnimation* a = new QPropertyAnimation( (QProgressBar*)this, "value" );
        a->setEasingCurve( QEasingCurve( QEasingCurve::OutQuad ) );
        a->setStartValue( value() > 0 ? value() : 1 );
        a->setEndValue( v );
        a->setDuration( 2000 );

        connect( a, SIGNAL( finished() ), a, SLOT( deleteLater() ) );
        a->start();
    }
    {
        QPropertyAnimation* a = new QPropertyAnimation( (QProgressBar*)this, "percentage" );
        a->setEasingCurve( QEasingCurve( QEasingCurve::OutQuad ) );
        a->setStartValue( (float)0 );
        a->setEndValue( (float)v / (float)maximum() );
        a->setDuration( 2000 );

        connect( a, SIGNAL( finished() ), a, SLOT( deleteLater() ) );
        a->start();
    }
}
Exemplo n.º 6
0
void DockModeWindow::setPrepareAddedToWindowManager() {
	m_prepareAddedToWm = true;
	if (G_LIKELY(s_dockGlow == 0)) {
		QString path(Settings::LunaSettings()->lunaSystemResourcesPath.c_str());
		path.append("/dockmode/dock-loading-glow.png");
		s_dockGlow = new QPixmap(path);
		if(s_dockGlow)
			s_dockGlowRefCount++;
		if (!s_dockGlow || s_dockGlow->isNull()) {
			g_critical("%s: Failed to load image '%s'", __PRETTY_FUNCTION__, qPrintable(path));
		}
	} else {
		s_dockGlowRefCount++;
	}

	ApplicationDescription* appDesc = static_cast<Window*>(this)->appDescription();
	int size = Settings::LunaSettings()->splashIconSize;
	m_icon.load(appDesc->splashIconName().c_str());
	if (!m_icon.isNull()) {
		// scale splash icon to fit the devices screen dimensions
		m_icon = m_icon.scaled(size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
	}
	else {
		// just use the launcher icon
		m_icon = appDesc->getDefaultLaunchPoint()->icon();
		int newWidth = qMin((int)(m_icon.width()*1.5), size);
		int newHeight = qMin((int)(m_icon.height()*1.5), size);
		m_icon = m_icon.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
	}
	

	// set up the pulsing animation
	QPropertyAnimation* pulseIn = new QPropertyAnimation(this, "pulseOpacity");
	pulseIn->setDuration(AS(cardLoadingPulseDuration));
	pulseIn->setEasingCurve(AS_CURVE(cardLoadingPulseCurve));
	pulseIn->setEndValue(1.0);

	QPropertyAnimation* pulseOut = new QPropertyAnimation(this, "pulseOpacity");
	pulseOut->setDuration(AS(cardLoadingPulseDuration));
	pulseOut->setEasingCurve(AS_CURVE(cardLoadingPulseCurve));
	pulseOut->setEndValue(0.0);

	QSequentialAnimationGroup* pulseGroup = new QSequentialAnimationGroup;
	pulseGroup->addAnimation(pulseIn);
	pulseGroup->addAnimation(pulseOut);
	pulseGroup->setLoopCount(-1);

	m_pulseAnimation.addPause(AS(cardLoadingTimeBeforeShowingPulsing));
	m_pulseAnimation.addAnimation(pulseGroup);

	m_loadingOverlayEnabled = true;
	m_pulseAnimation.start();

	update();
}
/*!
 *  \internal
 */
void QtMaterialRaisedButtonPrivate::init()
{
    Q_Q(QtMaterialRaisedButton);

    shadowStateMachine = new QStateMachine(q);
    normalState        = new QState;
    pressedState       = new QState;
    effect             = new QGraphicsDropShadowEffect;

    effect->setBlurRadius(7);
    effect->setOffset(QPointF(0, 2));
    effect->setColor(QColor(0, 0, 0, 75));

    q->setBackgroundMode(Qt::OpaqueMode);
    q->setMinimumHeight(42);
    q->setGraphicsEffect(effect);
    q->setBaseOpacity(0.3);

    shadowStateMachine->addState(normalState);
    shadowStateMachine->addState(pressedState);

    normalState->assignProperty(effect, "offset", QPointF(0, 2));
    normalState->assignProperty(effect, "blurRadius", 7);

    pressedState->assignProperty(effect, "offset", QPointF(0, 5));
    pressedState->assignProperty(effect, "blurRadius", 29);

    QAbstractTransition *transition;

    transition = new QEventTransition(q, QEvent::MouseButtonPress);
    transition->setTargetState(pressedState);
    normalState->addTransition(transition);

    transition = new QEventTransition(q, QEvent::MouseButtonDblClick);
    transition->setTargetState(pressedState);
    normalState->addTransition(transition);

    transition = new QEventTransition(q, QEvent::MouseButtonRelease);
    transition->setTargetState(normalState);
    pressedState->addTransition(transition);

    QPropertyAnimation *animation;

    animation = new QPropertyAnimation(effect, "offset", q);
    animation->setDuration(100);
    shadowStateMachine->addDefaultAnimation(animation);

    animation = new QPropertyAnimation(effect, "blurRadius", q);
    animation->setDuration(100);
    shadowStateMachine->addDefaultAnimation(animation);

    shadowStateMachine->setInitialState(normalState);
    shadowStateMachine->start();
}
Exemplo n.º 8
0
void ShortLocater::on_ShortCalib_2_clicked()
{
    m_objoffset=new offset(IDMMLib,this);
    QPropertyAnimation *animation = new QPropertyAnimation(m_objoffset, "geometry");
    animation->setDuration(10000);
    animation->setStartValue(QRect(300, 200, 50, 50));
    animation->setEndValue(QRect(300, 300, 240, 170));
    animation->setEasingCurve(QEasingCurve::Linear);
    animation->setDuration(1000);
    animation->start();
    m_objoffset->show();
}
Exemplo n.º 9
0
void IconButton::animateShow(bool visible) {
    if (visible) {
        QPropertyAnimation *animation = new QPropertyAnimation(this, "iconOpacity");
        animation->setDuration(FADE_TIME);
        animation->setEndValue(1.0);
        animation->start(QAbstractAnimation::DeleteWhenStopped);
    } else {
        QPropertyAnimation *animation = new QPropertyAnimation(this, "iconOpacity");
        animation->setDuration(FADE_TIME);
        animation->setEndValue(0.0);
        animation->start(QAbstractAnimation::DeleteWhenStopped);
    }
}
Exemplo n.º 10
0
QAbstractAnimation* CardItem::goBack(bool kieru,bool fadein,bool fadeout){
    if(home_pos == pos()){
        if(kieru && home_pos != QPointF(-6, 8))
            setOpacity(0.0);
        return NULL;
    }

    QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
    goback->setEndValue(home_pos);
    goback->setEasingCurve(QEasingCurve::OutQuad);
    goback->setDuration(500);

    if(kieru){
        QParallelAnimationGroup *group = new QParallelAnimationGroup;

        QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
        if(fadein)disappear->setStartValue(0.0);
        disappear->setEndValue(1.0);
        if(fadeout)disappear->setEndValue(0.0);

        disappear->setKeyValueAt(0.2, 1.0);
        disappear->setKeyValueAt(0.8, 1.0);


        qreal dx = home_pos.x()-pos().x();
        qreal dy = home_pos.y()-pos().y();
        int length = sqrt(dx*dx+dy*dy);


        length = qBound(500/3,length,400);

        goback->setDuration(length*3);
        disappear->setDuration(length*3);

        group->addAnimation(goback);
        group->addAnimation(disappear);

        // prevent the cover face bug
        setEnabled(false);

        group->start(QParallelAnimationGroup::DeleteWhenStopped);
        return group;
    }else
    {
        setOpacity(this->isEnabled() ? 1.0 : 0.7);
        goback->start(QPropertyAnimation::DeleteWhenStopped);
        return goback;
    }
}
Exemplo n.º 11
0
void DProgressFrame::slideUsbSeclect() {
    if (m_Active) {
        return;
    }
    else {
        m_Active=true;
    }
    this->layout()->setEnabled(false);
    m_TopShadow->show();
    m_ProcessLabel->setPixmap(QPixmap(""));
    emit changedUsbSeclet();

    int offsetx=frameRect().width(); //inherited from mother
    int offsety=frameRect().height();//inherited from mother
    m_SecondWidget->setGeometry(0, 0, offsetx, offsety);
    offsetx=0;
    //offsety=offsety;

    //re-position the next widget outside/aside of the display area
    QPoint pnext=m_SecondWidget->pos();
    QPoint pnow=m_FirstWidget->pos();
    m_FirstWidget->move(pnow.x(), pnow.y()- offsety + 64+ 36);
    m_SecondWidget->move(pnext.x(), pnext.y() + 64+ 36);
    //make it visible/show
    m_SecondWidget->show();
    m_SecondWidget->raise();
    m_TopShadow->raise();
    //animate both, the now and next widget to the side, using movie framework
    QPropertyAnimation *animnow = new QPropertyAnimation(m_FirstWidget, "pos");
    animnow->setDuration(m_Speed);
    animnow->setEasingCurve(QEasingCurve::OutBack);
    animnow->setStartValue(QPoint(pnow.x(), pnow.y()));
    animnow->setEndValue(QPoint(offsetx+pnow.x(), -offsety+pnow.y() + 64 + 36));

    QPropertyAnimation *animnext = new QPropertyAnimation(m_SecondWidget, "pos");
    animnext->setDuration(m_Speed);
    animnext->setEasingCurve(QEasingCurve::OutBack);
    animnext->setStartValue(QPoint(pnext.x(), offsety+pnext.y()));
    animnext->setEndValue(QPoint(pnext.x(), pnext.y() + 64+ 36));

    m_AnimGroup = new QParallelAnimationGroup;
    m_AnimGroup->addAnimation(animnow);
    m_AnimGroup->addAnimation(animnext);

    connect(m_AnimGroup, SIGNAL(finished()),this,SLOT(slideUsbDone()));

    m_Active=true;
    m_AnimGroup->start();
}
Exemplo n.º 12
0
void Canvas::spinTo(float new_yaw, float new_pitch)
{
    QPropertyAnimation* a = new QPropertyAnimation(this, "_yaw", this);
    a->setDuration(100);
    a->setStartValue(yaw);
    a->setEndValue(new_yaw);

    QPropertyAnimation* b = new QPropertyAnimation(this, "_pitch", this);
    b->setDuration(100);
    b->setStartValue(pitch);
    b->setEndValue(new_pitch);

    a->start(QPropertyAnimation::DeleteWhenStopped);
    b->start(QPropertyAnimation::DeleteWhenStopped);
}
Exemplo n.º 13
0
void Unite::animationDeplacement(vector<Case *> chemin ) {
    this->setSelected(false);
     float decalageX,decalageY;
     Case* caseActu=chemin[0];
     QSequentialAnimationGroup *group = new QSequentialAnimationGroup();
     QSequentialAnimationGroup *animPm = new QSequentialAnimationGroup();
     QParallelAnimationGroup *groupPara = new QParallelAnimationGroup();

     QPointF OS = offset();
     int anim;
     int j=1;

     for (unsigned int i=1;i<chemin.size(); i++) {
         QPropertyAnimation *animation = new QPropertyAnimation(this, "offset");
         animation->setDuration(200);

         decalageX = (chemin[i]->getX()-caseActu->getX())*SIZE;
         decalageY = (chemin[i]->getY()-caseActu->getY())*SIZE;

         if (decalageX>0)
             anim=30;
         else if (decalageX<0)
             anim=20;
         else if (decalageY<0)
             anim=10;
         else if (decalageY>0)
             anim=0;

         QPropertyAnimation *animPix = new QPropertyAnimation(this, "pixmap");
         animPix->setDuration(200);
         animPix->setStartValue(anim);
         animPix->setEndValue(anim+7);
         animPm->addAnimation(animPix);

         animation->setStartValue(OS);
         OS=QPointF(OS.x()+decalageX,OS.y()+decalageY);
         animation->setEndValue(OS);
         group->addAnimation(animation);

         j++;
         caseActu=chemin[i];
     }

     groupPara->addAnimation(group);
     groupPara->addAnimation(animPm);
     groupPara->start();
     this->setSelected(true);
}
Exemplo n.º 14
0
void QocViewWidget::rebuildChart()
{
	QPushButton *pb = qobject_cast<QPushButton *>(sender());
//	QParallelAnimationGroup *group = new QParallelAnimationGroup();
	QSequentialAnimationGroup *group = new QSequentialAnimationGroup();

	if (pb)
	{
		pb->setEnabled(false);
		connect(group, SIGNAL(finished()), this, SLOT(animationFinished()));
		connect(this, SIGNAL(animationEnded(bool)), pb, SLOT(setEnabled(bool)));
	}
	QList<QocAbstractChartItem *> items = m_chart->items(QocAbstractChart::ChartLayer);
	foreach(QocAbstractChartItem *item, items)
	{
		QocAbstractValueItem *i = qobject_cast<QocAbstractValueItem *>(item);
		if ( i )
		{
			QPropertyAnimation *anim = new QPropertyAnimation(i, "value", group);
			anim->setStartValue(0);
			anim->setEndValue(i->value());
			anim->setDuration(2000/items.size());
			group->addAnimation(anim);

//			i->blockSignals(true);
			i->setValue(0);
//			i->blockSignals(false);
		}
	}
void RocketStorageAuthDialog::Show()
{
    if (isVisible())
        return;
        
    show();
    setFocus(Qt::ActiveWindowFocusReason);
    activateWindow();
    
    setWindowOpacity(0.0);

    QPropertyAnimation *showAnim = new QPropertyAnimation(this, "windowOpacity", this);
    showAnim->setStartValue(0.0);
    showAnim->setEndValue(1.0);
    showAnim->setDuration(300);
    showAnim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad)); 
    showAnim->start();

    plugin_->Notifications()->CenterToMainWindow(this);
    if (!plugin_->Notifications()->IsForegroundDimmed())
    {
        plugin_->Notifications()->DimForeground();
        restoreForeground_ = true;
    }
}
Exemplo n.º 16
0
void View::articleClicked() {
    Button *btn = dynamic_cast<Button*>(sender());
    if (!btn)
        return;

    QPropertyAnimation *animation = new QPropertyAnimation(btn, "geometry");
    animation->setDuration(750);
    animation->setEasingCurve(QEasingCurve::OutExpo);
    if (btn->isFront()) {
        btn->setZValue(1);
        animation->setStartValue(btn->geometry());
        animation->setEndValue(btn->gridGeometry());
        connect(animation, SIGNAL(finished()), btn, SLOT(setBack()));
        animation->start();
		//_actButton = NULL;
    } else {
        if (_actButton != NULL && _actButton != btn) {
            delete animation;
            return;
        }
        btn->setFront();
        btn->setGridGeometry(btn->geometry());
        animation->setStartValue(btn->geometry());
        unsigned int w = size().width() / 17;
        unsigned int h = (size().height() - _topBar->size().height()) / 15;
        animation->setEndValue(QRectF(w, h + _topBar->size().height(), 15 * w, 13 * h));
        animation->start();
        _actButton = btn;
    }
	btn->setEnabled(false);
    connect(animation, SIGNAL(finished()), animation, SLOT(deleteLater()));
	connect(animation, SIGNAL(finished()), this, SLOT(animationFinished()));
}
Exemplo n.º 17
0
void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate)
{
    QRect r = widget->geometry();
    if (r.right() < 0 || r.bottom() < 0)
        r = QRect();

    animate = animate && !r.isNull() && !_final_geometry.isNull();

    // might make the wigdet go away by sending it to negative space
    const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry :
        QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size());

#ifndef QT_NO_ANIMATION
    AnimationMap::const_iterator it = m_animation_map.constFind(widget);
    if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry)
        return;

    QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry", widget);
    anim->setDuration(animate ? 200 : 0);
    anim->setEasingCurve(QEasingCurve::InOutQuad);
    anim->setEndValue(final_geometry);
    m_animation_map[widget] = anim;
    connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
    anim->start(QPropertyAnimation::DeleteWhenStopped);
#else
    //we do it in one shot
    widget->setGeometry(final_geometry);
#ifndef QT_NO_MAINWINDOW
    m_mainWindowLayout->animationFinished(widget);
#endif //QT_NO_MAINWINDOW
#endif //QT_NO_ANIMATION
}
Exemplo n.º 18
0
void FadingWidget::fadeTo(qreal value)
{
    QPropertyAnimation *animation = new QPropertyAnimation(m_opacityEffect, "opacity");
    animation->setDuration(200);
    animation->setEndValue(value);
    animation->start(QAbstractAnimation::DeleteWhenStopped);
}
Exemplo n.º 19
0
void DiscountPage::setupItemAnimations()
{
    QState *smallState = new QState();
    QState *bigState = new QState();

    for (int i = 0; i < this->m_itemList.size(); i++) {
        smallState->assignProperty(this->m_itemList[i],"scale", 0);
        bigState->assignProperty(this->m_itemList[i],"scale",1);
    }

    QSequentialAnimationGroup *showItemGroup = new QSequentialAnimationGroup(this);
    for (int i = 0; i < this->m_itemList.size(); i++) {
        QPropertyAnimation *anim = new QPropertyAnimation(this->m_itemList[i], "scale", this);
        anim->setDuration(300);
        anim->setEasingCurve(QEasingCurve::OutBack);
        showItemGroup->addAnimation(anim);
    }

    QSignalTransition *trans = smallState->addTransition(this, SIGNAL(start()), bigState);
    trans->addAnimation(showItemGroup);
    connect(showItemGroup,SIGNAL(finished()),this,SLOT(startSelect()));

    trans = bigState->addTransition(this,SIGNAL(quitPage()),smallState);
    connect(smallState,SIGNAL(entered()),this,SLOT(closeSelect()));

    QStateMachine *states = new QStateMachine(this);
    states->addState(smallState);
    states->addState(bigState);
    states->setInitialState(smallState);

    states->start();
}
Exemplo n.º 20
0
QGraphicsItem *CarouselGraphicsWidget::addItem(QGraphicsWidget *p)
{
	scene()->addItem(p);
	icons.append(p);

	// Set the speed of the animation (it has to be set on the objects in the scene)
	QPropertyAnimation *anim = new QPropertyAnimation(p, "geometry");
	anim->setDuration(500);
	animationGroup->addAnimation(anim);

	QState *newState = new QState(machine);
	QState *lastState = states.at(states.size()-1);

	if (states.size() == 0) {
		machine->setInitialState(newState);
	} else {
		// Link this new state to the next state
		QSignalTransition *transition;
		transition = lastState->addTransition(this, SIGNAL(m_next()), newState);
		transition->addAnimation(animationGroup);

		// Link the next state to this new state
		transition = newState->addTransition(this, SIGNAL(m_back()), lastState);
		transition->addAnimation(animationGroup);
	}
	states.append(newState);

	// NB: Don't update the scene yet. See resizeEvent comment

	return p;
}
void RocketStorageInfoDialog::Open()
{
    if (isVisible())
        return;
        
    show();
    setFocus(Qt::ActiveWindowFocusReason);
    activateWindow();

    setWindowOpacity(0.0);

    QPropertyAnimation *showAnim = new QPropertyAnimation(this, "windowOpacity", this);
    showAnim->setStartValue(0.0);
    showAnim->setEndValue(1.0);
    showAnim->setDuration(300);
    showAnim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad)); 
    showAnim->start();
    
    plugin_->Notifications()->CenterToMainWindow(this);
    plugin_->Notifications()->DimForeground();
    
    // If input mode is enabled, focus the input field and 
    // select the text so user can start writing.
    if (ui.lineEditInput->isVisible())
    {
        ui.lineEditInput->setFocus(Qt::MouseFocusReason);
        ui.lineEditInput->selectAll();
    }
}
Exemplo n.º 22
0
void DeckHandler::adjustDrawSize()
{
    if(drawAnimating)
    {
        QTimer::singleShot(ANIMATION_TIME+50, this, SLOT(adjustDrawSize()));
        return;
    }

    int rowHeight = ui->drawListWidget->sizeHintForRow(0);
    int rows = drawCardList.count();
    int height = rows*rowHeight + 2*ui->drawListWidget->frameWidth();
    int maxHeight = (ui->drawListWidget->height()+ui->enemyHandListWidget->height())*4/5;
    if(height>maxHeight)    height = maxHeight;

    QPropertyAnimation *animation = new QPropertyAnimation(ui->drawListWidget, "minimumHeight");
    animation->setDuration(ANIMATION_TIME);
    animation->setStartValue(ui->drawListWidget->minimumHeight());
    animation->setEndValue(height);
    animation->setEasingCurve(QEasingCurve::OutBounce);
    animation->start();

    QPropertyAnimation *animation2 = new QPropertyAnimation(ui->drawListWidget, "maximumHeight");
    animation2->setDuration(ANIMATION_TIME);
    animation2->setStartValue(ui->drawListWidget->maximumHeight());
    animation2->setEndValue(height);
    animation2->setEasingCurve(QEasingCurve::OutBounce);
    animation2->start();

    this->drawAnimating = true;
    connect(animation, SIGNAL(finished()),
            this, SLOT(clearDrawAnimating()));
}
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);

	QGraphicsScene scene;
	QGraphicsView view(&scene);
    view.setMinimumHeight(150);

    QGraphicsPixmapItem *item = new QGraphicsPixmapItem(QPixmap(":/img/qt-logo.jpg"));
    scene.addItem(item);

    QGraphicsRotation *rotation = new QGraphicsRotation();
    rotation->setAxis(Qt::ZAxis);
    rotation->setOrigin(QVector3D(QPoint(item->boundingRect().width() / 2.0, item->boundingRect().height() / 2.0)));
    item->setTransformations(QList<QGraphicsTransform *>() << rotation);

    QPropertyAnimation *anim = new QPropertyAnimation(rotation, "angle");
    anim->setDuration(5000);
    anim->setStartValue(0);
    anim->setEndValue(360);
    anim->start(QAbstractAnimation::DeleteWhenStopped);

	view.show();

	return a.exec();
}
Exemplo n.º 24
0
void AbstractClipItem::closeAnimation()
{
#if QT_VERSION >= 0x040600
    if (!isEnabled()) return;
    setEnabled(false);
    setFlag(QGraphicsItem::ItemIsSelectable, false);
    if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) {
        // animation disabled
        deleteLater();
        return;
    }
    QPropertyAnimation *closeAnimation = new QPropertyAnimation(this, "rect");
    QPropertyAnimation *closeAnimation2 = new QPropertyAnimation(this, "opacity");
    closeAnimation->setDuration(200);
    closeAnimation2->setDuration(200);
    QRectF r = rect();
    QRectF r2 = r;
    r2.setLeft(r.left() + r.width() / 2);
    r2.setTop(r.top() + r.height() / 2);
    r2.setWidth(1);
    r2.setHeight(1);
    closeAnimation->setStartValue(r);
    closeAnimation->setEndValue(r2);
    closeAnimation->setEasingCurve(QEasingCurve::InQuad);
    closeAnimation2->setStartValue(1.0);
    closeAnimation2->setEndValue(0.0);
    QParallelAnimationGroup *group = new QParallelAnimationGroup;
    connect(group, SIGNAL(finished()), this, SLOT(deleteLater()));
    group->addAnimation(closeAnimation);
    group->addAnimation(closeAnimation2);
    group->start(QAbstractAnimation::DeleteWhenStopped);
#endif
}
Exemplo n.º 25
0
void QLineEditIconButton::startOpacityAnimation(qreal endValue)
{
    QPropertyAnimation *animation = new QPropertyAnimation(this, QByteArrayLiteral("opacity"));
    animation->setDuration(160);
    animation->setEndValue(endValue);
    animation->start(QAbstractAnimation::DeleteWhenStopped);
}
Exemplo n.º 26
0
Arquivo: MPF.cpp Projeto: aaly/MPF
int MPF::showHelp()
{
    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);

    helpTextEdit->setGraphicsEffect(opacityEffect);
    //helpTextEdit->setText("");
    QPropertyAnimation* anim = new QPropertyAnimation(this);

    if(helpTextEdit->isHidden())
    {
        opacityEffect->setOpacity(1);
        anim->setEndValue(0);
        helpPushButton->setText(trUtf8("&Hide Help"));
        helpTextEdit->show();
        fullHelpPushButton->show();
    }
    else
    {
        opacityEffect->setOpacity(0);
        anim->setEndValue(1);
        helpPushButton->setText(trUtf8("&Show Help"));
        helpTextEdit->hide();
        fullHelpPushButton->hide();
    }

    anim->setTargetObject(opacityEffect);
    anim->setPropertyName("opacity");
    anim->setDuration(3000);
    anim->setStartValue(opacityEffect->opacity());
    anim->setEasingCurve(QEasingCurve::InBounce);
    anim->start(QAbstractAnimation::DeleteWhenStopped);

    return 0;
}
Exemplo n.º 27
0
void DialogController::closeDialog()
{
    QWidget *dialog = m_dialog;
    m_dialog = nullptr;
    m_widget = nullptr;

    if(!dialog)
        return;

    QRect geom = dialog->geometry();
    int w = geom.width() + m_dialogOffsetLeft;
    QPropertyAnimation *animation  = new QPropertyAnimation(dialog, "geometry");
    animation->setStartValue(visibleGeometry(dialog));
    animation->setEndValue(hiddenGeometry(dialog));
    animation->setDuration(300);
    animation->setEasingCurve(QEasingCurve::OutExpo);
    animation->start();

    connect(animation, &QPropertyAnimation::finished, [=]{
        animation->deleteLater();
        dialog->close();
        dialog->deleteLater();
    });

    emit dialogClosed();
}
Exemplo n.º 28
0
Arquivo: MPF.cpp Projeto: aaly/MPF
int MPF::animateWidget(QWidget* widget, bool hide, int effect)
{
    if(!widget)
    {
        return 1;
    }

    if(effect == FADING)
    {
        QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);
        opacityEffect->setOpacity(0);
        widget->setGraphicsEffect(opacityEffect);
        QPropertyAnimation* anim = new QPropertyAnimation(this);
        anim->setTargetObject(opacityEffect);
        anim->setPropertyName("opacity");
        anim->setDuration(3000);
        anim->setStartValue(opacityEffect->opacity());
        anim->setEndValue(1);
        anim->setEasingCurve(QEasingCurve::OutQuad);
        anim->start(QAbstractAnimation::DeleteWhenStopped);
    }


    return 0;
}
Exemplo n.º 29
0
void Photo::hideEmotion() {
    QPropertyAnimation *disappear = new QPropertyAnimation(emotion_item, "opacity");
    disappear->setStartValue(1.0);
    disappear->setEndValue(0.0);
    disappear->setDuration(500);
    disappear->start(QAbstractAnimation::DeleteWhenStopped);
}
Exemplo n.º 30
0
/**
 * @brief Shows or hides the right menu with an animation
 * according to the value of \ref _rightMenuHidden attribute.
 */
void MainWindow::on_showHidePushButton_clicked()
{
    QPropertyAnimation * animation = new QPropertyAnimation(ui->rightMenuWidget, "maximumWidth");

    animation->setDuration(1000);
    animation->setStartValue(ui->rightMenuWidget->maximumWidth());

    if(!_rightMenuHidden) {
        ui->showHidePushButton->setIcon(QIcon(":/icons/2left"));
        animation->setEndValue(0);
        animation->setEasingCurve(QEasingCurve::InBack);

        _rightMenuHidden = true;
    }
    else {
        animation->setEndValue(314);
        animation->setEasingCurve(QEasingCurve::OutBack);

        ui->showHidePushButton->setIcon(QIcon(":/icons/2right"));

        _rightMenuHidden = false;
    }

    animation->start(QPropertyAnimation::DeleteWhenStopped);
}