summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/itemviews/qcolumnview.cpp12
-rw-r--r--src/gui/itemviews/qcolumnview_p.h2
-rw-r--r--src/gui/widgets/qwidgetanimator.cpp22
-rw-r--r--src/gui/widgets/qwidgetanimator_p.h3
4 files changed, 37 insertions, 2 deletions
diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp
index fc89967..c544394 100644
--- a/src/gui/itemviews/qcolumnview.cpp
+++ b/src/gui/itemviews/qcolumnview.cpp
@@ -107,10 +107,13 @@ void QColumnViewPrivate::initialize()
{
Q_Q(QColumnView);
q->setTextElideMode(Qt::ElideMiddle);
+#ifndef QT_NO_ANIMATION
QObject::connect(&currentAnimation, SIGNAL(finished()), q, SLOT(_q_changeCurrentColumn()));
currentAnimation.setDuration(ANIMATION_DURATION_MSEC);
currentAnimation.setTargetObject(hbar);
+ currentAnimation.setPropertyName("value");
currentAnimation.setEasingCurve(QEasingCurve::InOutQuad);
+#endif //QT_NO_ANIMATION
delete itemDelegate;
q->setItemDelegate(new QColumnViewDelegate(q));
}
@@ -260,10 +263,12 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
if (!index.isValid() || d->columns.isEmpty())
return;
+#ifndef QT_NO_ANIMATION
if (d->currentAnimation.state() == QPropertyAnimation::Running)
return;
d->currentAnimation.stop();
+#endif //QT_NO_ANIMATION
// Fill up what is needed to get to index
d->closeColumns(index, true);
@@ -326,8 +331,12 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
}
}
+#ifndef QT_NO_ANIMATION
d->currentAnimation.setEndValue(newScrollbarValue);
d->currentAnimation.start();
+#else
+ horizontalScrollBar()->setValue(newScrollbarValue);
+#endif //QT_NO_ANIMATION
}
/*!
@@ -396,8 +405,10 @@ void QColumnView::resizeEvent(QResizeEvent *event)
void QColumnViewPrivate::updateScrollbars()
{
Q_Q(QColumnView);
+#ifndef QT_NO_ANIMATION
if (currentAnimation.state() == QPropertyAnimation::Running)
return;
+#endif //QT_NO_ANIMATION
// find the total horizontal length of the laid out columns
int horizontalLength = 0;
@@ -1031,7 +1042,6 @@ QColumnViewPrivate::QColumnViewPrivate()
: QAbstractItemViewPrivate()
,showResizeGrips(true)
,offset(0)
-,currentAnimation(0, "value") // will set the target later
,previewWidget(0)
,previewColumn(0)
{
diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h
index 1a8be70..3f99220 100644
--- a/src/gui/itemviews/qcolumnview_p.h
+++ b/src/gui/itemviews/qcolumnview_p.h
@@ -160,7 +160,9 @@ public:
QVector<int> columnSizes; // used during init and corner moving
bool showResizeGrips;
int offset;
+#ifndef QT_NO_ANIMATION
QPropertyAnimation currentAnimation;
+#endif
QWidget *previewWidget;
QAbstractItemView *previewColumn;
};
diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp
index d820b59..7a3a464 100644
--- a/src/gui/widgets/qwidgetanimator.cpp
+++ b/src/gui/widgets/qwidgetanimator.cpp
@@ -53,6 +53,7 @@ QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout
void QWidgetAnimator::abort(QWidget *w)
{
+#ifndef QT_NO_ANIMATION
AnimationMap::iterator it = m_animation_map.find(w);
if (it == m_animation_map.end())
return;
@@ -60,13 +61,18 @@ void QWidgetAnimator::abort(QWidget *w)
m_animation_map.erase(it);
anim->stop();
m_mainWindowLayout->animationFinished(w);
+#else
+ Q_UNUSED(w); //there is no animation to abort
+#endif //QT_NO_ANIMATION
}
+#ifndef QT_NO_ANIMATION
void QWidgetAnimator::animationFinished()
{
QPropertyAnimation *anim = qobject_cast<QPropertyAnimation*>(sender());
abort(static_cast<QWidget*>(anim->targetObject()));
}
+#endif //QT_NO_ANIMATION
void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate)
{
@@ -76,6 +82,9 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo
if (r.right() < 0 || r.bottom() < 0)
r = QRect();
+#ifdef QT_NO_ANIMATION
+ Q_UNUSED(animate);
+#else
if (r.isNull() || final_geometry.isNull() || r == final_geometry)
animate = false;
@@ -91,7 +100,9 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo
m_animation_map[widget] = anim;
connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
anim->start(QPropertyAnimation::DeleteWhenStopped);
- } else {
+ } else
+#endif //QT_NO_ANIMATION
+ {
if (!final_geometry.isValid() && !widget->isWindow()) {
// Make the wigdet go away by sending it to negative space
QSize s = widget->size();
@@ -103,12 +114,21 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo
bool QWidgetAnimator::animating() const
{
+#ifdef QT_NO_ANIMATION
+ return false;
+#else
return !m_animation_map.isEmpty();
+#endif //QT_NO_ANIMATION
}
bool QWidgetAnimator::animating(QWidget *widget) const
{
+#ifdef QT_NO_ANIMATION
+ Q_UNUSED(widget);
+ return false;
+#else
return m_animation_map.contains(widget);
+#endif //QT_NO_ANIMATION
}
QT_END_NAMESPACE
diff --git a/src/gui/widgets/qwidgetanimator_p.h b/src/gui/widgets/qwidgetanimator_p.h
index edd8e7c..4047395 100644
--- a/src/gui/widgets/qwidgetanimator_p.h
+++ b/src/gui/widgets/qwidgetanimator_p.h
@@ -74,12 +74,15 @@ public:
void abort(QWidget *widget);
+#ifndef QT_NO_ANIMATION
private Q_SLOTS:
void animationFinished();
private:
typedef QMap<QWidget*, QPropertyAnimation*> AnimationMap;
AnimationMap m_animation_map;
+#endif
+private:
QMainWindowLayout *m_mainWindowLayout;
};