summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2018-06-06 13:17:52 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2018-06-06 10:30:20 +0000
commit319481d3bb532e65f76b00e77510c458b029516f (patch)
tree7d2740e1209583e10332e094808191ae22c6cabd
parentdfa966e0d32041b1df0acd6db7733d22614b38b0 (diff)
Allow drag-select keyframes from an object row
Currently only possible to drag-select keyframes from property rows Task-number: QT3DS-1886 Change-Id: I6673e5ec52a73d48f0c9cd98abc7a53a63915ee0 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp7
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp15
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h2
3 files changed, 6 insertions, 18 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
index e234e99e..570c3981 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
@@ -173,11 +173,10 @@ void KeyframeManager::selectKeyframesInRect(const QRectF &rect)
m_scene->rowManager()->clampIndex(idx1);
m_scene->rowManager()->clampIndex(idx2);
- RowTimeline *rowTimeline;
for (int i = idx1; i <= idx2; ++i) {
- rowTimeline = m_scene->rowManager()->rowTimelineAt(i);
+ RowTimeline *rowTimeline = m_scene->rowManager()->rowTimelineAt(i);
- if (rowTimeline != nullptr) {
+ if (rowTimeline) {
const auto keyframes = rowTimeline->getKeyframesInRange(rect.left(), rect.right());
for (auto keyframe : keyframes) {
if (!m_selectedKeyframes.contains(keyframe)) {
@@ -402,7 +401,7 @@ bool KeyframeManager::hasSelectedKeyframes() const
bool KeyframeManager::hasCopiedKeyframes() const
{
- return m_pasteKeyframeCommandHelper != nullptr &&
+ return m_pasteKeyframeCommandHelper &&
m_pasteKeyframeCommandHelper->HasCopiedKeyframes();
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
index 0c58f7dd..e768283d 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
@@ -285,26 +285,15 @@ Keyframe *RowTimeline::getClickedKeyframe(const QPointF &scenePos)
return nullptr;
}
-QList<Keyframe *> RowTimeline::getKeyframesInRange(const double left, const double right)
+QList<Keyframe *> RowTimeline::getKeyframesInRange(double left, double right)
{
double x;
double x1 = mapFromScene(left, 0).x();
double x2 = mapFromScene(right, 0).x();
QList<Keyframe *> result;
- QList<Keyframe *> keyframes;
- if (m_rowTree->hasPropertyChildren()) {
- const auto childRows = m_rowTree->childRows();
- for (auto child : childRows) {
- if (child->isProperty())
- keyframes.append(child->rowTimeline()->m_keyframes);
- }
- } else {
- keyframes = m_keyframes;
- }
-
- for (auto keyframe : qAsConst(keyframes)) {
+ for (auto keyframe : qAsConst(m_keyframes)) {
x = timeToX(keyframe->time);
if (x1 < x && x2 > x)
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h
index 3c12a26a..831c02e0 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h
@@ -76,7 +76,7 @@ public:
RowTimeline *parentRow() const;
RowTree *rowTree() const;
Keyframe *getClickedKeyframe(const QPointF &scenePos);
- QList<Keyframe *> getKeyframesInRange(const double left, const double right);
+ QList<Keyframe *> getKeyframesInRange(double left, double right);
QList<Keyframe *> keyframes() const;
void showToolTip(const QPointF &pos);