本文整理汇总了C++中QPropertyAnimation::setStartValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QPropertyAnimation::setStartValue方法的具体用法?C++ QPropertyAnimation::setStartValue怎么用?C++ QPropertyAnimation::setStartValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation::setStartValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hideEmotion
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);
}
示例2: rebuildChart
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);
}
}
示例3: closeAnimation
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
}
示例4: showHelp
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;
}
示例5: hide
void hide(QObject *obj)
{
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
animation->setStartValue(1);
animation->setEndValue(0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
示例6: setEmotion
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);
}
}
示例7: Open
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();
}
}
示例8: goBack
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);
}
示例9: closeAnimation
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);
}
示例10: QPropertyAnimation
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();
}
示例11: slotMouseTracker
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;
}
示例12: InitStyle
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();
}
示例13: setTabHighlighted
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);
}
}
示例14: showGriant
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();
});
});
}
示例15: show
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);
}