[vlmc-devel] commit: EffectsListView: Open a EffectWidget on double clicking on an effect. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Tue Aug 31 00:12:17 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Aug 31 00:11:28 2010 +0200| [e11f8d61b418495ae811cd8a2ae68ff2cdb6f7b2] | committer: Hugo Beauzée-Luyssen
EffectsListView: Open a EffectWidget on double clicking on an effect.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=e11f8d61b418495ae811cd8a2ae68ff2cdb6f7b2
---
src/Gui/effectsengine/EffectsListView.cpp | 24 ++++++++++++++++++++++--
src/Gui/effectsengine/EffectsListView.h | 2 ++
src/Gui/effectsengine/ui/EffectsList.ui | 8 +++++++-
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/src/Gui/effectsengine/EffectsListView.cpp b/src/Gui/effectsengine/EffectsListView.cpp
index 1b3ec51..083ef94 100644
--- a/src/Gui/effectsengine/EffectsListView.cpp
+++ b/src/Gui/effectsengine/EffectsListView.cpp
@@ -1,9 +1,12 @@
#include "EffectsListView.h"
-#include "EffectsEngine/EffectsEngine.h"
+#include "EffectsEngine.h"
+#include "EffectWidget.h"
#include <QApplication>
+#include <QDialog>
#include <QMouseEvent>
#include <QStandardItem>
+#include <QVBoxLayout>
#include <QtDebug>
@@ -16,7 +19,8 @@ EffectsListView::EffectsListView(QWidget *parent) :
this,
SLOT( effectAdded(Effect*, const QString&, Effect::Type) ) );
setModel( m_model );
- setEditTriggers( QListView::NoEditTriggers );
+ connect( this, SIGNAL( activated( QModelIndex ) ),
+ this, SLOT( effectActivated( QModelIndex ) ) );
}
void
@@ -57,3 +61,19 @@ EffectsListView::mouseMoveEvent( QMouseEvent *event )
drag->setMimeData( mimeData );
drag->exec( Qt::CopyAction | Qt::MoveAction, Qt::CopyAction );
}
+
+void
+EffectsListView::effectActivated( const QModelIndex &index ) const
+{
+ if ( index.isValid() == false )
+ return ;
+ Effect *effect = EffectsEngine::getInstance()->effect( m_model->data( index, Qt::DisplayRole ).toString() );
+ QDialog *dialog = new QDialog();
+ QVBoxLayout *layout = new QVBoxLayout( dialog );
+ EffectWidget *wid = new EffectWidget( dialog );
+ layout->addWidget( wid );
+ wid->setEffect( effect );
+ dialog->setWindowTitle( tr( "%1 informations" ).arg( effect->name() ) );
+ dialog->exec();
+ delete dialog;
+}
diff --git a/src/Gui/effectsengine/EffectsListView.h b/src/Gui/effectsengine/EffectsListView.h
index 3c22109..86b90aa 100644
--- a/src/Gui/effectsengine/EffectsListView.h
+++ b/src/Gui/effectsengine/EffectsListView.h
@@ -26,6 +26,8 @@ class EffectsListView : public QListView
public slots:
void effectAdded( Effect *effect, const QString& name,
Effect::Type type );
+ private slots:
+ void effectActivated( const QModelIndex& index ) const;
};
#endif // EFFECTLISTVIEW_H
diff --git a/src/Gui/effectsengine/ui/EffectsList.ui b/src/Gui/effectsengine/ui/EffectsList.ui
index dfd58b6..7694b3f 100644
--- a/src/Gui/effectsengine/ui/EffectsList.ui
+++ b/src/Gui/effectsengine/ui/EffectsList.ui
@@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="filterTab">
<attribute name="title">
@@ -26,6 +26,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="EffectsListView" name="filterList">
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
<property name="dragEnabled">
<bool>true</bool>
</property>
@@ -40,6 +43,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="EffectsListView" name="effectsList">
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
<property name="dragEnabled">
<bool>true</bool>
</property>
More information about the Vlmc-devel
mailing list