diff options
| author | Mitch Curtis <mitch.curtis@qt.io> | 2022-11-18 15:15:16 +0800 |
|---|---|---|
| committer | Mitch Curtis <mitch.curtis@qt.io> | 2022-12-01 10:26:20 +0800 |
| commit | 4bd87b903b355b53e3105ba1ae7c154c4e55cdaf (patch) | |
| tree | cc2edb597f0d5871302eb86e9dda78217384a5aa /src/quickcontrols2impl/qquickanimatednode.cpp | |
| parent | 786e1748d4469c135a922a221024f3f9c421c0de (diff) | |
Remove "2" from Qt Quick Controls directories
Qt Quick Controls 2 was named that way because it was a follow-up to
Qt Quick Controls 1.x. Now that Qt Quick Controls 1 is no longer
supported, we don't need to have "2" in the name. Work on this was
already started for the documentation in
1abdfe5d5a052f2298b7bf657513dfa7e0c66a56.
By doing this renaming a few weeks before feature freeze, it won't
affect the release but still results in as little time possible spent
manually fixing conflicts in cherry-picks from non-LTS releases as a
result of the renaming.
This patch does the following:
- Renames directories.
- Adapts CMakeLists.txt and other files to account for the new paths.
A follow-up patch will handle documentation.
It does not touch library names or other user-facing stuff, as that
will have to be done in Qt 7.
Task-number: QTBUG-95413
Change-Id: I170d8db19033ee71e495ff0c5c1a517a41ed7634
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quickcontrols2impl/qquickanimatednode.cpp')
| -rw-r--r-- | src/quickcontrols2impl/qquickanimatednode.cpp | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/src/quickcontrols2impl/qquickanimatednode.cpp b/src/quickcontrols2impl/qquickanimatednode.cpp deleted file mode 100644 index 542955235b..0000000000 --- a/src/quickcontrols2impl/qquickanimatednode.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (C) 2017 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#include "qquickanimatednode_p.h" - -#include <QtQuick/qquickitem.h> -#include <QtQuick/qquickwindow.h> - -// based on qtdeclarative/examples/quick/scenegraph/threadedanimation - -QT_BEGIN_NAMESPACE - -QQuickAnimatedNode::QQuickAnimatedNode(QQuickItem *target) - : m_window(target->window()) -{ -} - -bool QQuickAnimatedNode::isRunning() const -{ - return m_running; -} - -int QQuickAnimatedNode::currentTime() const -{ - int time = m_currentTime; - if (m_running) - time += m_timer.elapsed(); - return time; -} - -void QQuickAnimatedNode::setCurrentTime(int time) -{ - m_currentTime = time; - m_timer.restart(); -} - -int QQuickAnimatedNode::duration() const -{ - return m_duration; -} - -void QQuickAnimatedNode::setDuration(int duration) -{ - m_duration = duration; -} - -int QQuickAnimatedNode::loopCount() const -{ - return m_loopCount; -} - -void QQuickAnimatedNode::setLoopCount(int count) -{ - m_loopCount = count; -} - -void QQuickAnimatedNode::sync(QQuickItem *target) -{ - Q_UNUSED(target); -} - -QQuickWindow *QQuickAnimatedNode::window() const -{ - return m_window; -} - -void QQuickAnimatedNode::start(int duration) -{ - if (m_running) - return; - - m_running = true; - m_currentLoop = 0; - m_timer.restart(); - if (duration > 0) - m_duration = duration; - - connect(m_window, &QQuickWindow::beforeRendering, this, &QQuickAnimatedNode::advance, Qt::DirectConnection); - connect(m_window, &QQuickWindow::frameSwapped, this, &QQuickAnimatedNode::update, Qt::DirectConnection); - - // If we're inside a QQuickWidget, this call is necessary to ensure the widget - // gets updated for the first time. - m_window->update(); - - emit started(); -} - -void QQuickAnimatedNode::restart() -{ - stop(); - start(); -} - -void QQuickAnimatedNode::stop() -{ - if (!m_running) - return; - - m_running = false; - disconnect(m_window, &QQuickWindow::beforeRendering, this, &QQuickAnimatedNode::advance); - disconnect(m_window, &QQuickWindow::frameSwapped, this, &QQuickAnimatedNode::update); - emit stopped(); -} - -void QQuickAnimatedNode::updateCurrentTime(int time) -{ - Q_UNUSED(time); -} - -void QQuickAnimatedNode::advance() -{ - int time = currentTime(); - if (time > m_duration) { - time = 0; - setCurrentTime(0); - - if (m_loopCount > 0 && ++m_currentLoop >= m_loopCount) { - time = m_duration; // complete - stop(); - } - } - updateCurrentTime(time); - - // If we're inside a QQuickWidget, this call is necessary to ensure the widget gets updated. - m_window->update(); -} - -void QQuickAnimatedNode::update() -{ - if (m_running) - m_window->update(); -} - -QT_END_NAMESPACE - -#include "moc_qquickanimatednode_p.cpp" |
