Exemple #1
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);
}
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);
		}
	}
Exemple #3
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
}
Exemple #4
0
Fichier : MPF.cpp Projet : 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;
}
	void hide(QObject *obj)
	{
		QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
		animation->setStartValue(1);
		animation->setEndValue(0);
		animation->start(QAbstractAnimation::DeleteWhenStopped);
	}
Exemple #6
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);
    }
}
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();
    }
}
Exemple #8
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);
}
void AbstractClipItem::closeAnimation()
{
    if (!isEnabled()) return;
    setEnabled(false);
    setFlag(QGraphicsItem::ItemIsSelectable, false);
    if (QApplication::style()->styleHint(QStyle::SH_Widget_Animate, 0, QApplication::activeWindow())) {
        // 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);
}
void PaintedWidget::animation2()
{
    car->setPixmap(carimg);
    car->show();
    QPropertyAnimation *anim = new QPropertyAnimation(car,"pos");


    anim->setDuration(durationValue);

    if(!uniform){  //非匀速
        if(animationPos <= spline.dividCount/2){
            durationValue -= 30;
            if (durationValue<30)
                durationValue = 30;
        }
        else
            durationValue += 30;
        timer->start(durationValue);
    }

    QPoint temp1 = spline.dividPoint[animationPos];
    QPoint temp2 = spline.dividPoint[animationPos+1];
    anim->setStartValue(temp1);
    anim->setEndValue(temp2);


    qDebug()<<"start from:"<<temp1<<"to"<<temp2;

    anim->start();
}
Exemple #11
0
void TopMenuBar::slotMouseTracker()
{
    QPoint cursorPos = QCursor::pos();

    // reset timer
    if (cursorPos != m_prevCursorPos && m_hideGlowTimer->isActive()) {
        m_hideGlowTimer->stop();
        m_hideGlowTimer->start(10000);
    }

    if (cursorInMenuBar()) { // show menubar
        m_mouseTracker->stop();
        hideGlowBar();
        show();
    } else if(cursorPos != m_prevCursorPos) { // change glowbar opacity
        qreal opacity = glowBarOpacity();
        QPropertyAnimation *anim = new QPropertyAnimation(m_glowBar, "windowOpacity");
        anim->setStartValue(m_glowBar->windowOpacity());
        anim->setEndValue(opacity);
        anim->setDuration(200);
        anim->start(QAbstractAnimation::DeleteWhenStopped);
        // Show menubar if auto hidden
        if (!m_glowBar->isVisible()) {
            m_glowBar->show();
        }
    }
    m_prevCursorPos = cursorPos;
}
void frmMain::InitStyle()
{
    QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity");
    animation->setDuration(1000);
    animation->setStartValue(0);
    animation->setEndValue(1);
    animation->start();

    this->max = false;
    this->location = this->geometry();
    this->setProperty("Form", true);
    this->setProperty("CanMove", true);
    this->setWindowTitle(ui->lab_Title->text());
    this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint
                         | Qt::WindowMinimizeButtonHint);

    IconHelper::Instance()->SetIcoMain(ui->lab_Ico, 40);
    IconHelper::Instance()->SetIcoMin(ui->btnMenu_Min);
    IconHelper::Instance()->SetIcoNormal(ui->btnMenu_Max);
    IconHelper::Instance()->SetIcoClose(ui->btnMenu_Close);

    connect(ui->btnMenu_Min, SIGNAL(clicked()), this, SLOT(showMinimized()));
    connect(ui->btnMenu_Close, SIGNAL(clicked()), this, SLOT(closeWidget()));
    connect(ui->btnExit, SIGNAL(clicked()),this, SLOT(closeWidget()));

    ui->widget_title->installEventFilter(this);
    ui->btnMenu_Max->click();
}
Exemple #13
0
void TabBar::setTabHighlighted(int index)
{
    const QByteArray propertyName = highlightPropertyName(index);
    const QColor highlightColor = KColorScheme(QPalette::Active, KColorScheme::Window).foreground(KColorScheme::PositiveText).color();

    if (tabTextColor(index) != highlightColor)
    {
        if (ReKonfig::animatedTabHighlighting())
        {
            m_tabHighlightEffect->setEnabled(true);
            m_tabHighlightEffect->setProperty(propertyName, qreal(0.9));
            QPropertyAnimation *anim = new QPropertyAnimation(m_tabHighlightEffect, propertyName);
            m_highlightAnimation.insert(propertyName, anim);

            //setup the animation
            anim->setStartValue(0.9);
            anim->setEndValue(0.0);
            anim->setDuration(500);
            anim->setLoopCount(2);
            anim->start(QAbstractAnimation::DeleteWhenStopped);

            m_animationMapper->setMapping(anim, index);
            connect(anim, SIGNAL(finished()), m_animationMapper, SLOT(map()));
        }

        setTabTextColor(index, highlightColor);
    }
}
Exemple #14
0
void Notify::showGriant()
{
    this->show();

    titleLabel->setText(title);
    QPixmap tempPix = QPixmap(this->icon);
    tempPix = tempPix.scaled(QSize(30, 30), Qt::KeepAspectRatio);
    iconLabel->setPixmap(tempPix);

    backgroundLabel->setFixedSize(this->size());
    closeBtn->move(backgroundLabel->width() - closeBtn->width(), 0);

    // 超过长度省略号
    QFontMetrics elidfont(bodyLabel->font());
    QString text = elidfont.elidedText(this->body, Qt::ElideRight,
                                       bodyLabel->width() - 5);
    bodyLabel->setText(text);

    QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity", this);
    animation->setStartValue(0);
    animation->setEndValue(1);
    animation->setDuration(200);
    animation->start();

    connect(animation, &QPropertyAnimation::finished, this, [animation, this](){
        animation->deleteLater();
        QTimer::singleShot(displayTime, this, [this](){
            this->hideGriant();
        });
    });
}
Exemple #15
0
void ContextMenu::show() {

    if(!isHidden()) {
        hide();
        return;
    }
	//qDebug() << "[debug] parent: " << parentWidget()->size();
	//qDebug() << "[debug] pos: " << pos();

	//resize(QSize(parentWidget()->size().width(), 32));
	//move(0, parentWidget()->size().height()-32);

	QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry");
	animation->setDuration(170);
	animation->setStartValue(QRect(0, parentWidget()->size().height(), parentWidget()->size().width(), 0));
	animation->setEndValue(QRect(0, parentWidget()->size().height()-42, parentWidget()->size().width(), 42));

	animation->start();

	QDialog::show();

	calendar->setFocus();
	calendar->setDefault(true);

}
Exemple #16
0
void ToolButton::toolTriggered() {
  QPropertyAnimation *a = new QPropertyAnimation(this, "flashBackground");
  a->setDuration(300);
  a->setStartValue(QColor(Qt::white));
  a->setEndValue(QColor(Qt::lightGray));
  a->start(QAbstractAnimation::DeleteWhenStopped);
}
Exemple #17
0
void Widget::startBounce()
{
    if (!m_settings.get("gui/bounce").toBool()) {
        return;
    }

    doneBounce();

    QPropertyAnimation* anim = new QPropertyAnimation(this);
    anim->setTargetObject(this);
    m_animation.addAnimation(anim);

    anim->setEasingCurve(QEasingCurve::OutQuad);
    anim->setDuration(m_settings.get("gui/bounce_duration").toInt() * 0.25f);
    anim->setStartValue(0);

    QString position = m_messageQueue.front().data["pos"]->toString();
    if (position == "top_center" || position == "tc" ||
        position == "bottom_center" || position == "bc" ||
        position == "center" || position == "c")
        anim->setEndValue(height());
    else
        anim->setEndValue(40);

    tmpBouncePos = pos();

    anim->start();

    connect(anim, SIGNAL(valueChanged(QVariant)), this, SLOT(updateBounceAnimation(QVariant)));
    connect(anim, SIGNAL(finished()), this, SLOT(unbounce()));
}
Exemple #18
0
void MayaModule::_showBarraBusqueda(BarraBusqueda *b)
{
    if(!_b_reducida)
        return;
    b->setGeometry(0,40,0,this->height()-60);
    b->show();
    QPropertyAnimation* animation0 = new QPropertyAnimation(b, "size",this);
    connect(animation0,SIGNAL(finished()),animation0,SLOT(deleteLater()));
    animation0->setDuration(1000);
    animation0->setEasingCurve(QEasingCurve::OutElastic);

    animation0->setStartValue(QSize(0,b->height()));
    animation0->setEndValue(QSize(250,b->height()));

    QPropertyAnimation* animation = new QPropertyAnimation(b, "pos",this);
    animation->setDuration(1000);
    animation->setEasingCurve(QEasingCurve::OutElastic);
    animation->setStartValue(QPoint(this->width(),b->pos().y()));
    animation->setEndValue(QPoint(this->width()-250,b->pos().y()));

    QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
    group->addAnimation(animation);
    group->addAnimation(animation0);

    connect(group,SIGNAL(finished()),group,SLOT(deleteLater()));
    group->start();
     _b_reducida = false;
     b->setShow(true);

}
Exemple #19
0
void LogoScene::setupLogo()
{
    Qneed* background = new Qneed(this, get_window());
    background->loadImage(":images/logo/logo_background.png");
    set_background(background);

    logo = new Qneed(this, get_window());
    logo->loadImage(":images/logo/logo.png");
    logo->setPos(307, 240);

    OnemoreButton* one = new OnemoreButton(this,get_window());
    one->setPos(400, 553);
    one->hide();

    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect();
    opacityEffect->setOpacity(0.0);

    logo->setGraphicsEffect(opacityEffect);

    QPropertyAnimation * animation = new QPropertyAnimation();
    animation->setTargetObject(opacityEffect);
    animation->setPropertyName("opacity");
    animation->setDuration(2000);
    animation->setStartValue(0.0);
    animation->setEndValue(1.0);
    animation->setEasingCurve(QEasingCurve::OutQuad);

    connect(animation, SIGNAL(finished()), this, SLOT(goinit()));
    animation->start();
}
Exemple #20
0
void MayaModule::_hideBarraBusqueda(BarraBusqueda *b)
{
    if(_b_reducida)
        return;
    QPropertyAnimation* animation0 = new QPropertyAnimation(b, "size",this);
    connect(animation0,SIGNAL(finished()),animation0,SLOT(deleteLater()));
    animation0->setDuration(300);
    animation0->setEasingCurve(QEasingCurve::Linear);

    animation0->setStartValue(QSize(250,b->height()));
    animation0->setEndValue(QSize(20,b->height()));

    QPropertyAnimation* animation = new QPropertyAnimation(b, "pos",this);
    animation->setDuration(200);
    animation->setEasingCurve(QEasingCurve::Linear);
    animation->setStartValue(QPoint(this->width()-250,b->pos().y()));
    animation->setEndValue(QPoint(this->width()-20,b->pos().y()));

    QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
    group->addAnimation(animation);
    group->addAnimation(animation0);

    connect(group,SIGNAL(finished()),group,SLOT(deleteLater()));
    group->start();
    _b_reducida = true;
    b->setShow(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;
    }
}
void settingwindow::init()
{
	ui.downBtn->setEnabled(false);
	ui.sendBtn1->setEnabled(false);
	ui.sendBtn2->setEnabled(false);
	ui.textBrowser_send1->setEnabled(false);
	ui.textBrowser_send2->setEnabled(false);
	ui.textBrowser_receive->setEnabled(false);

	setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);//无边框
	setMouseTracking(true);
	int width = this->width();
	QPixmap minPix = style()->standardPixmap(QStyle::SP_TitleBarMinButton);
	QPixmap closePix = style()->standardPixmap(QStyle::SP_TitleBarCloseButton);
	ui.minButton->setIcon(minPix);
	ui.closeButton->setIcon(closePix);
	ui.minButton->setGeometry(width - 46, 5, 20, 10);
	ui.closeButton->setGeometry(width - 25, 5, 20, 10);
	ui.minButton->setStyleSheet("background-color:transparent;");
	ui.closeButton->setStyleSheet("background-color:transparent;");

	QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity");//窗口淡出
	animation->setDuration(2500);
	animation->setStartValue(0);
	animation->setEndValue(1);
	animation->start();


}
Exemple #23
0
Fichier : MPF.cpp Projet : 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;
}
Exemple #24
0
void Viewport::setYOffset(float yOffset)
{
    yOffset = qBound<float>(0.0f, yOffset, m_maxYOffset);

    if (m_yOffset != yOffset) {
        m_yOffset = yOffset;

        if (m_scene) {
            m_yGroupAnimation->clear();

            QPropertyAnimation *yAnim = new QPropertyAnimation(m_scene, "y");
            yAnim->setDuration(m_animationDuration); // TODO set duration according the offset value
            yAnim->setEasingCurve(m_animationEasingCurve);
            yAnim->setStartValue(m_scene->y());
            yAnim->setEndValue(-m_yOffset);
            m_yGroupAnimation->addAnimation(yAnim);

            /* TODO: Fix this according to current layer scheme
            QPropertyAnimation *yLayerAnimation = new QPropertyAnimation(m_scene->gameLayers(), "yOffset"); // TODO
            yLayerAnimation->setDuration(m_animationDuration); // TODO
            yLayerAnimation->setEasingCurve(m_animationEasingCurve);
            yLayerAnimation->setStartValue(m_scene->gameLayers()->yOffset());
            yLayerAnimation->setEndValue(m_yOffset);
            m_yGroupAnimation->addAnimation(yLayerAnimation);
            */

            m_yGroupAnimation->start();
        }

        emit yOffsetChanged();
    }
}
Exemple #25
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);
}
void moveTo(QObject* obj, qreal x, qreal y)
{
	QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos");
	animation->setStartValue(obj->property("pos").toPointF());
	animation->setEndValue(QPointF(x, y));
	animation->start(QAbstractAnimation::DeleteWhenStopped);
}
Exemple #27
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()));
}
Exemple #28
0
SelectContacts::SelectContacts(QWidget *parent, QListWidget *list) :
  QFrame(parent),
  ui(new Ui::SelectContacts)
{
  ui->setupUi(this);

  //To hide the edges of the form and standard buttons.
  this->setWindowFlags(Qt::Popup | Qt::Window);
  setWindowOpacity(0);
  show();

  // Setting animation when opening window
  QPropertyAnimation* animation = new QPropertyAnimation(this, "windowOpacity");
  animation->setDuration(500);
  animation->setStartValue(0);
  animation->setEndValue(1);
  animation->start();

  ui->userList->setItemDelegate(new UserListDelegate(ui->userList));

  for (int i = 0; i < list->count(); i++)
    {
      QListWidgetItem *item = new QListWidgetItem();
      item->setData(Qt::DisplayRole, list->item(i)->data(Qt::DisplayRole).toString());
      item->setData(Qt::ToolTipRole, list->item(i)->data(Qt::ToolTipRole).toString());
      item->setData(Qt::UserRole + 1, list->item(i)->data(Qt::UserRole + 1).toString());
      item->setData(Qt::DecorationRole, list->item(i)->data(Qt::DecorationRole));
      ui->userList->addItem(item);
    }
}
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();
}
Exemple #30
0
void MWindow::transferCards(CardPile &to, NodeT<CardLabel*>* first, bool showPrevious)
{
    if(first != 0){
        QPoint newCoords = to.getCorner();
        NodeT<CardLabel*>* ls = to.last();
        if(ls != 0 && showPrevious)
            newCoords = ls->value->pos() + QPoint(0, 28);
        if( to.getPileID() != 13){
            QPropertyAnimation *animation = new QPropertyAnimation(first->value, "pos");
             animation->setDuration(300);
             animation->setStartValue(first->value->pos());
             animation->setEndValue(newCoords);

             animation->start();
        }
        if(to.getPileID() != 13 && first->value->getOldOwnerID() != 0)
            first->value->move(newCoords);

        to.append(first);

        CardPile::updateOwner(first, to.getPileID());
        //first->value->setOwnerID(to.getPileID());

        to.makeLastOnTop();
        to.fixIndexes();
    }
}