summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-08 15:12:08 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-08 15:12:08 +0200
commit19a824cfe36458732f12e6374848df37cd92eed8 (patch)
tree78f4bd9aa3327e655ea09a9da906e03e146d1f22 /src
parent12dc33d0e7191dbabb03db989b0f56372de731e3 (diff)
Animations: fix compilation with QT_NO_ANIMATION
Diffstat (limited to 'src')
-rw-r--r--src/corelib/animation/qabstractanimation_p.h7
-rw-r--r--src/corelib/animation/qanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qpropertyanimation_p.h6
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h3
-rw-r--r--src/corelib/animation/qvariantanimation_p.h4
-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
10 files changed, 63 insertions, 4 deletions
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index 00def552d5..0d8402e90c 100644
--- a/src/corelib/animation/qabstractanimation_p.h
+++ b/src/corelib/animation/qabstractanimation_p.h
@@ -58,6 +58,8 @@
#include <QtCore/qtimer.h>
#include <private/qobject_p.h>
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QAnimationGroup;
@@ -147,4 +149,7 @@ private:
};
QT_END_NAMESPACE
-#endif
+
+#endif //QT_NO_ANIMATION
+
+#endif //QABSTRACTANIMATION_P_H
diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h
index 8e668f0114..01252c56a9 100644
--- a/src/corelib/animation/qanimationgroup_p.h
+++ b/src/corelib/animation/qanimationgroup_p.h
@@ -59,6 +59,8 @@
#include "private/qabstractanimation_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QAnimationGroupPrivate : public QAbstractAnimationPrivate
@@ -76,4 +78,6 @@ public:
QT_END_NAMESPACE
+#endif //QT_NO_ANIMATION
+
#endif //QANIMATIONGROUP_P_H
diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h
index 201eb1627a..949a9b2e38 100644
--- a/src/corelib/animation/qparallelanimationgroup_p.h
+++ b/src/corelib/animation/qparallelanimationgroup_p.h
@@ -57,6 +57,8 @@
#include "private/qanimationgroup_p.h"
#include <QtCore/QHash>
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QParallelAnimationGroupPrivate : public QAnimationGroupPrivate
@@ -82,4 +84,6 @@ public:
QT_END_NAMESPACE
+#endif //QT_NO_ANIMATION
+
#endif //QPARALLELANIMATIONGROUP_P_H
diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h
index 68b25193bf..a2ae5ec563 100644
--- a/src/corelib/animation/qpropertyanimation_p.h
+++ b/src/corelib/animation/qpropertyanimation_p.h
@@ -58,6 +58,8 @@
#include "private/qvariantanimation_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QPropertyAnimationPrivate : public QVariantAnimationPrivate
@@ -86,4 +88,6 @@ public:
QT_END_NAMESPACE
-#endif
+#endif //QT_NO_ANIMATION
+
+#endif //QPROPERTYANIMATION_P_H
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index 555b69655a..8db79a0147 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -56,6 +56,7 @@
#include "qsequentialanimationgroup.h"
#include "private/qanimationgroup_p.h"
+#ifndef QT_NO_ANIMATION
QT_BEGIN_NAMESPACE
@@ -108,4 +109,6 @@ public:
QT_END_NAMESPACE
+#endif //QT_NO_ANIMATION
+
#endif //QSEQUENTIALANIMATIONGROUP_P_H
diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h
index b848e12e88..69e23dc472 100644
--- a/src/corelib/animation/qvariantanimation_p.h
+++ b/src/corelib/animation/qvariantanimation_p.h
@@ -60,6 +60,8 @@
#include "private/qabstractanimation_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QVariantAnimationPrivate : public QAbstractAnimationPrivate
@@ -120,4 +122,6 @@ template<typename T > inline QVariant _q_interpolateVariant(const T &from, const
QT_END_NAMESPACE
+#endif //QT_NO_ANIMATION
+
#endif //QANIMATION_P_H
diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp
index fc899674ac..c544394133 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 1a8be70af3..3f99220dcd 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 d820b59516..7a3a464e96 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 edd8e7c6a5..4047395168 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;
};