[vlmc-devel] commit: timeline: do not re-center the viewport vertically when the cursor move. ( Ludovic Fauvet )
git at videolan.org
git at videolan.org
Tue Mar 23 01:37:51 CET 2010
vlmc | branch: master | Ludovic Fauvet <etix at l0cal.com> | Tue Mar 23 01:36:58 2010 +0100| [a4653c7ecaa919931f94d03a6ea6d4c18614ceaf] | committer: Ludovic Fauvet
timeline: do not re-center the viewport vertically when the cursor move.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=a4653c7ecaa919931f94d03a6ea6d4c18614ceaf
---
src/Gui/timeline/TracksView.cpp | 17 +++++++++++++----
src/Gui/timeline/TracksView.h | 5 +++++
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 3453356..9b68fe5 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -1061,13 +1061,22 @@ TracksView::ensureCursorVisible()
{
if ( horizontalScrollBar()->isVisible() )
{
- QRectF r( m_cursorLine->boundingRect().width() / 2,
- m_cursorLine->boundingRect().height() / 2,
- 1, 1 );
- m_cursorLine->ensureVisible( r, 150, 50 );
+ QRectF visibleArea = visibleRect();
+ ensureVisible( cursorPos(),
+ visibleArea.y() + ( visibleArea.height() / 2 ),
+ 1, 1, 150, 0 );
}
}
+QRectF
+TracksView::visibleRect()
+{
+ QPointF topLeft( horizontalScrollBar()->value(), verticalScrollBar()->value() );
+ QPointF bottomRight( topLeft + viewport()->rect().bottomRight() );
+ QMatrix reverted = matrix().inverted();
+ return reverted.mapRect( QRectF( topLeft, bottomRight ) );
+}
+
void
TracksView::updateDuration()
{
diff --git a/src/Gui/timeline/TracksView.h b/src/Gui/timeline/TracksView.h
index 12fdda6..34e5864 100644
--- a/src/Gui/timeline/TracksView.h
+++ b/src/Gui/timeline/TracksView.h
@@ -232,6 +232,11 @@ private slots:
* \brief Ensure that the cursor is visible.
*/
void ensureCursorVisible();
+
+ /**
+ * \brief Return the visible area of the viewport.
+ */
+ QRectF visibleRect();
/**
* \brief Update the global duration of the project.
* This method should be called when an item is inserted, moved or removed to ensure
More information about the Vlmc-devel
mailing list