Commit 2cf2dadf authored by hjk's avatar hjk
Browse files

TextEditor: Remove some needless indirection in BaseTextEditor



Change-Id: Ibb446fce6365a0c52ad74d366f24a202ea9cc33f
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 3ac0668d
...@@ -170,12 +170,10 @@ public: ...@@ -170,12 +170,10 @@ public:
signals: signals:
void updateRequest(int position, QPointF lastPos, QRectF rect); void updateRequest(int position, QPointF lastPos, QRectF rect);
private:
private slots:
void step(qreal v); void step(qreal v);
private: QTimeLine m_timeline;
QTimeLine *m_timeline;
qreal m_value; qreal m_value;
int m_position; int m_position;
QPointF m_lastDrawPos; QPointF m_lastDrawPos;
...@@ -5447,17 +5445,15 @@ void BaseTextEditorWidgetPrivate::_q_animateUpdate(int position, QPointF lastPos ...@@ -5447,17 +5445,15 @@ void BaseTextEditorWidgetPrivate::_q_animateUpdate(int position, QPointF lastPos
BaseTextEditorAnimator::BaseTextEditorAnimator(QObject *parent) BaseTextEditorAnimator::BaseTextEditorAnimator(QObject *parent)
:QObject(parent) : QObject(parent), m_timeline(256)
{ {
m_value = 0; m_value = 0;
m_timeline = new QTimeLine(256, this); m_timeline.setCurveShape(QTimeLine::SineCurve);
m_timeline->setCurveShape(QTimeLine::SineCurve); connect(&m_timeline, &QTimeLine::valueChanged, this, &BaseTextEditorAnimator::step);
connect(m_timeline, SIGNAL(valueChanged(qreal)), this, SLOT(step(qreal))); connect(&m_timeline, &QTimeLine::finished, this, &QObject::deleteLater);
connect(m_timeline, SIGNAL(finished()), this, SLOT(deleteLater())); m_timeline.start();
m_timeline->start();
} }
void BaseTextEditorAnimator::setData(const QFont &f, const QPalette &pal, const QString &text) void BaseTextEditorAnimator::setData(const QFont &f, const QPalette &pal, const QString &text)
{ {
m_font = f; m_font = f;
...@@ -5484,7 +5480,7 @@ void BaseTextEditorAnimator::draw(QPainter *p, const QPointF &pos) ...@@ -5484,7 +5480,7 @@ void BaseTextEditorAnimator::draw(QPainter *p, const QPointF &pos)
bool BaseTextEditorAnimator::isRunning() const bool BaseTextEditorAnimator::isRunning() const
{ {
return m_timeline->state() == QTimeLine::Running; return m_timeline.state() == QTimeLine::Running;
} }
QRectF BaseTextEditorAnimator::rect() const QRectF BaseTextEditorAnimator::rect() const
...@@ -5506,7 +5502,7 @@ void BaseTextEditorAnimator::step(qreal v) ...@@ -5506,7 +5502,7 @@ void BaseTextEditorAnimator::step(qreal v)
void BaseTextEditorAnimator::finish() void BaseTextEditorAnimator::finish()
{ {
m_timeline->stop(); m_timeline.stop();
step(0); step(0);
deleteLater(); deleteLater();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment