本文整理汇总了C++中QPropertyAnimation::stop方法的典型用法代码示例。如果您正苦于以下问题:C++ QPropertyAnimation::stop方法的具体用法?C++ QPropertyAnimation::stop怎么用?C++ QPropertyAnimation::stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation::stop方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScaleObjectBasedOnPriority
void EtherMenu::ScaleObjectBasedOnPriority(int index, int priority)
{
qreal scalevalue;
InfoCard* obj = objects_.at(index);
if(priority==0 && card_max_size_.height() > boundaries_.height())
{
scalevalue = current_card_max_size_.height() / (card_max_size_.height());
//A hacky adjust so that bottom of the bottom card doesn't go below the scene border
//scalevalue *= 0.95;
}
else
{
qreal scalemultiplier = (priority+1)/2;
scalevalue = pow(current_scale_factor_, scalemultiplier);
//scalevalue *= 0.9;
}
QPropertyAnimation* anim = dynamic_cast<QPropertyAnimation*>(dynamic_cast<QParallelAnimationGroup*>(animations_->animationAt(index))->animationAt(1));
if (anim)
{
anim->stop();
anim->setStartValue(obj->scale());
anim->setEndValue(scalevalue);
anim->start();
}
}
示例2: setScrollOffset
void KItemListViewAnimation::setScrollOffset(qreal offset)
{
const qreal diff = m_scrollOffset - offset;
m_scrollOffset = offset;
// The change of the offset requires that the position of all
// animated QGraphicsWidgets get adjusted. An exception is made
// for the delete animation that should just fade away on the
// existing position.
for (int type = 0; type < AnimationTypeCount; ++type) {
if (type == DeleteAnimation) {
continue;
}
QHashIterator<QGraphicsWidget*, QPropertyAnimation*> it(m_animation[type]);
while (it.hasNext()) {
it.next();
QGraphicsWidget* widget = it.key();
QPropertyAnimation* propertyAnim = it.value();
QPointF currentPos = widget->pos();
if (m_scrollOrientation == Qt::Vertical) {
currentPos.ry() += diff;
} else {
currentPos.rx() += diff;
}
if (type == MovingAnimation) {
// Stop the animation, calculate the moved start- and end-value
// and restart the animation for the remaining duration.
const int remainingDuration = propertyAnim->duration()
- propertyAnim->currentTime();
const bool block = propertyAnim->signalsBlocked();
propertyAnim->blockSignals(true);
propertyAnim->stop();
QPointF endPos = propertyAnim->endValue().toPointF();
if (m_scrollOrientation == Qt::Vertical) {
endPos.ry() += diff;
} else {
endPos.rx() += diff;
}
propertyAnim->setDuration(remainingDuration);
propertyAnim->setStartValue(currentPos);
propertyAnim->setEndValue(endPos);
propertyAnim->start();
propertyAnim->blockSignals(block);
} else {
widget->setPos(currentPos);
}
}
}
}
示例3: MoveObjectToPosition
void EtherMenu::MoveObjectToPosition(int index,const QPointF& point)
{
InfoCard* obj = objects_.at(index);
QPropertyAnimation* anim = dynamic_cast<QPropertyAnimation*>(dynamic_cast<QParallelAnimationGroup*>(animations_->animationAt(index))->animationAt(0));
if(anim)
{
anim->stop();
anim->setStartValue(obj->pos());
anim->setEndValue(point);
anim->start();
}
}
示例4: ShowCardAtIndex
void EtherMenu::ShowCardAtIndex(int index)
{
InfoCard* obj = objects_.at(index);
QPropertyAnimation* animopa = dynamic_cast<QPropertyAnimation*>(dynamic_cast<QParallelAnimationGroup*>(animations_->animationAt(index))->animationAt(2));
if(animopa)
{
animopa->stop();
animopa->setStartValue(obj->opacity());
animopa->setEndValue(visible_);
animopa->start();
}
}
示例5: HideCardAtIndex
void EtherMenu::HideCardAtIndex(int index)
{
InfoCard* obj = objects_.at(index);
//all visible objects have higher Z order
ZOrderObjectBasedOnPriority(index, max_visible_objects_ + 1, true);
QPropertyAnimation* animpos = dynamic_cast<QPropertyAnimation*>(dynamic_cast<QParallelAnimationGroup*>(animations_->animationAt(index))->animationAt(0));
if(animpos)
{
animpos->stop();
animpos->setStartValue(obj->pos());
animpos->setEndValue(hide_point_);
animpos->start();
}
QPropertyAnimation* animopa = dynamic_cast<QPropertyAnimation*>(dynamic_cast<QParallelAnimationGroup*>(animations_->animationAt(index))->animationAt(2));
if(animopa)
{
animopa->stop();
animopa->setStartValue(obj->opacity());
animopa->setEndValue(invisible_);
animopa->start();
}
}
示例6: abort
void QWidgetAnimator::abort(QWidget *w)
{
#ifndef QT_NO_ANIMATION
AnimationMap::iterator it = m_animation_map.find(w);
if (it == m_animation_map.end())
return;
QPropertyAnimation *anim = *it;
m_animation_map.erase(it);
anim->stop();
#ifndef QT_NO_MAINWINDOW
m_mainWindowLayout->animationFinished(w);
#endif
#else
Q_UNUSED(w); //there is no animation to abort
#endif //QT_NO_ANIMATION
}
示例7: ChangeObjectOpacityBasedOnPriority
void EtherMenu::ChangeObjectOpacityBasedOnPriority(int index,int priority)
{
if(opacity_factor_>0)
{
InfoCard* obj = objects_.at(index);
int opacity_level = (priority+1)/2;
QPropertyAnimation* anim = dynamic_cast<QPropertyAnimation*>(dynamic_cast<QParallelAnimationGroup*>(animations_->animationAt(index))->animationAt(2));
if (anim)
{
anim->stop();
anim->setStartValue(obj->opacity());
anim->setEndValue(1- opacity_level*opacity_factor_);
anim->start();
}
}
}
示例8: ZOrderObjectBasedOnPriority
void EtherMenu::ZOrderObjectBasedOnPriority(int index, int priority, bool animated)
{
InfoCard* obj = objects_.at(index);
if (animated)
{
QPropertyAnimation* anim = dynamic_cast<QPropertyAnimation*>(dynamic_cast<QParallelAnimationGroup*>(animations_->animationAt(index))->animationAt(3));
if (anim)
{
anim->stop();
anim->setStartValue(obj->scale());
anim->setEndValue(max_visible_objects_- priority);
anim->start();
}
}
else
{
obj->setZValue(max_visible_objects_- priority);
}
}
示例9: sizeHintChanged
void
Context::Applet::collapse( bool on )
{
qreal finalHeight = ( on ) ? m_heightCollapseOn : m_heightCollapseOff;
const qreal maxHeight = containment()->size().height();
if( (finalHeight > maxHeight) || (finalHeight < 0) )
finalHeight = maxHeight;
prepareGeometryChange();
// warning: view() currently can return pointer to ToolbarView, not the ContextView
ContextView *v = ContextView::self(); // may return null
// Plasma::Applet::view() might return 0, if the widget is not yet constructed, etc.
// \sa https://bugs.kde.org/show_bug.cgi?id=258741. If view is not available
// yet, regardless of the animation setting the preferred size is set
// straight away.
if( !v || !AmarokConfig::animateAppletCollapse() )
{
setPreferredHeight( finalHeight );
emit sizeHintChanged( Qt::PreferredSize );
updateGeometry();
return;
}
if( finalHeight == size().height() )
return;
// debug() << pluginName() << (on ? "collapsing to" : "uncollapsing to") << finalHeight;
QPropertyAnimation *pan = m_animation.data();
if( !pan )
pan = new QPropertyAnimation( this, "preferredSize" );
if( pan->state() == QAbstractAnimation::Running )
pan->stop();
pan->setDuration( 600 );
pan->setEasingCurve( QEasingCurve::InQuad );
pan->setStartValue( size() );
pan->setEndValue( QSizeF(size().width(), finalHeight) );
connect( pan, SIGNAL(finished()), SLOT(collapseAnimationFinished()) );
m_animation = pan;
pan->setDirection( QAbstractAnimation::Forward );
v->addCollapseAnimation( pan );
}
示例10: stop
void KItemListViewAnimation::stop(QGraphicsWidget* widget, AnimationType type)
{
QPropertyAnimation* propertyAnim = m_animation[type].value(widget);
if (propertyAnim) {
propertyAnim->stop();
switch (type) {
case MovingAnimation: break;
case CreateAnimation: widget->setOpacity(1.0); break;
case DeleteAnimation: widget->setOpacity(0.0); break;
case ResizeAnimation: break;
default: break;
}
m_animation[type].remove(widget);
delete propertyAnim;
emit finished(widget, type);
}
}
示例11: drawControl
void FancyTabProxyStyle::drawControl(
ControlElement element, const QStyleOption* option,
QPainter* p, const QWidget* widget) const
{
const QStyleOptionTab* v_opt = qstyleoption_cast<const QStyleOptionTab*>(option);
if (element != CE_TabBarTab || !v_opt) {
QProxyStyle::drawControl(element, option, p, widget);
return;
}
const QRect rect = v_opt->rect;
const bool selected = v_opt->state & State_Selected;
const bool vertical_tabs = v_opt->shape == QTabBar::RoundedWest;
const QString text = v_opt->text;
if (selected) {
//background
p->save();
QLinearGradient grad(rect.topLeft(), rect.topRight());
grad.setColorAt(0, QColor(255, 255, 255, 140));
grad.setColorAt(1, QColor(255, 255, 255, 210));
p->fillRect(rect.adjusted(0, 0, 0, -1), grad);
p->restore();
//shadows
p->setPen(QColor(0, 0, 0, 110));
p->drawLine(rect.topLeft() + QPoint(1, -1), rect.topRight() - QPoint(0, 1));
p->drawLine(rect.bottomLeft(), rect.bottomRight());
p->setPen(QColor(0, 0, 0, 40));
p->drawLine(rect.topLeft(), rect.bottomLeft());
//highlights
p->setPen(QColor(255, 255, 255, 50));
p->drawLine(rect.topLeft() + QPoint(0, -2), rect.topRight() - QPoint(0, 2));
p->drawLine(rect.bottomLeft() + QPoint(0, 1), rect.bottomRight() + QPoint(0, 1));
p->setPen(QColor(255, 255, 255, 40));
p->drawLine(rect.topLeft() + QPoint(0, 0), rect.topRight());
p->drawLine(rect.topRight() + QPoint(0, 1), rect.bottomRight() - QPoint(0, 1));
p->drawLine(rect.bottomLeft() + QPoint(0, -1), rect.bottomRight() - QPoint(0, 1));
}
QTransform m;
if (vertical_tabs) {
m = QTransform::fromTranslate(rect.left(), rect.bottom());
m.rotate(-90);
}
else {
m = QTransform::fromTranslate(rect.left(), rect.top());
}
const QRect draw_rect(QPoint(0, 0), m.mapRect(rect).size());
p->save();
p->setTransform(m);
QRect icon_rect(QPoint(8, 0), v_opt->iconSize);
QRect text_rect(icon_rect.topRight() + QPoint(4, 0), draw_rect.size());
text_rect.setRight(draw_rect.width());
icon_rect.translate(0, (draw_rect.height() - icon_rect.height()) / 2);
QFont boldFont(p->font());
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
boldFont.setBold(true);
p->setFont(boldFont);
p->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110));
int textFlags = Qt::AlignHCenter | Qt::AlignVCenter;
p->drawText(text_rect, textFlags, text);
p->setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor());
if (widget) {
const QString fader_key = "tab_" + text + "_fader";
const QString animation_key = "tab_" + text + "_animation";
const QString tab_hover = widget->property("tab_hover").toString();
int fader = widget->property(fader_key.toUtf8().constData()).toInt();
QPropertyAnimation* animation = widget->property(animation_key.toUtf8().constData()).value<QPropertyAnimation*>();
if (!animation) {
QWidget* mut_widget = const_cast<QWidget*>(widget);
fader = 0;
mut_widget->setProperty(fader_key.toUtf8().constData(), fader);
animation = new QPropertyAnimation(mut_widget, fader_key.toUtf8(), mut_widget);
connect(animation, SIGNAL(valueChanged(QVariant)), mut_widget, SLOT(update()));
mut_widget->setProperty(animation_key.toUtf8().constData(), QVariant::fromValue(animation));
}
if (text == tab_hover) {
if (animation->state() != QAbstractAnimation::Running && fader != 40) {
animation->stop();
animation->setDuration(80);
animation->setEndValue(40);
animation->start();
}
}
else {
if (animation->state() != QAbstractAnimation::Running && fader != 0) {
animation->stop();
animation->setDuration(160);
animation->setEndValue(0);
//.........这里部分代码省略.........