[vlmc-devel] AbstractGraphicsItem: Add lengthChanged signal, and adjust effects' length if needed

Yikai Lu git at videolan.org
Tue Jun 28 10:39:48 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue Jun 28 16:53:07 2016 +0900| [05ad66773f3dc8a020c50b16978e4f8f7584c228] | committer: Yikai Lu

AbstractGraphicsItem: Add lengthChanged signal, and adjust effects' length if needed

> https://code.videolan.org/videolan/vlmc/commit/05ad66773f3dc8a020c50b16978e4f8f7584c228
---

 src/Gui/timeline/AbstractGraphicsItem.h        | 1 +
 src/Gui/timeline/AbstractGraphicsMediaItem.cpp | 1 +
 src/Gui/timeline/GraphicsEffectItem.cpp        | 1 +
 src/Gui/timeline/TracksView.cpp                | 1 -
 4 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Gui/timeline/AbstractGraphicsItem.h b/src/Gui/timeline/AbstractGraphicsItem.h
index 6e152db..e820431 100644
--- a/src/Gui/timeline/AbstractGraphicsItem.h
+++ b/src/Gui/timeline/AbstractGraphicsItem.h
@@ -194,6 +194,7 @@ class AbstractGraphicsItem : public QObject, public QGraphicsItem
     signals:
         void                moved( qint64 pos );
         void                trackChanged( GraphicsTrack *tracks );
+        void                lengthChanged( qint64 length );
 
         friend class        TracksView;
 
diff --git a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
index 5b13a15..ae8fa54 100644
--- a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
+++ b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
@@ -267,6 +267,7 @@ AbstractGraphicsMediaItem::triggerResize( TrackWorkflow* target,
         return ;
     Commands::trigger( new Commands::Clip::Resize( target, m_clip.get(), newBegin,
                                                                newEnd, pos ) );
+    emit lengthChanged( newEnd - newBegin + 1 );
 }
 
 qint64
diff --git a/src/Gui/timeline/GraphicsEffectItem.cpp b/src/Gui/timeline/GraphicsEffectItem.cpp
index bd47b03..d1276a1 100644
--- a/src/Gui/timeline/GraphicsEffectItem.cpp
+++ b/src/Gui/timeline/GraphicsEffectItem.cpp
@@ -304,6 +304,7 @@ GraphicsEffectItem::setContainer( AbstractGraphicsMediaItem *item )
         connect( item, SIGNAL( trackChanged( GraphicsTrack* ) ),
                  this, SLOT( setTrack( GraphicsTrack* ) ) );
         connect( item, SIGNAL( destroyed() ), this, SLOT( deleteLater() ) );
+        connect( item, &AbstractGraphicsMediaItem::lengthChanged, this, &GraphicsEffectItem::adjustLength );
         if ( m_effectHelper->length() > item->helper()->length() )
             m_effectHelper->setBoundaries( 0, item->helper()->length() );
         if ( startPos() < item->pos().x() )
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index ca877bd..96fdb67 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -1050,7 +1050,6 @@ TracksView::mouseMoveEvent( QMouseEvent *event )
             }
         }
     }
-
     QGraphicsView::mouseMoveEvent( event );
 }
 



More information about the Vlmc-devel mailing list