Add right click menu to clear I/O points when they exist in timelineheader

This commit is contained in:
alcomposer
2018-12-19 18:18:56 +10:30
parent 26c3534048
commit 27c4520e58
3 changed files with 19 additions and 2 deletions
+1 -2
View File
@@ -31,6 +31,7 @@ public slots:
void new_project();
void autorecover_interval();
void on_actionNest_triggered();
void on_actionClear_In_Out_triggered();
protected:
void closeEvent(QCloseEvent *);
@@ -157,8 +158,6 @@ private slots:
void on_actionSet_Out_Point_triggered();
void on_actionClear_In_Out_triggered();
void on_actionDelete_In_Out_triggered();
void on_actionRipple_Delete_In_Out_triggered();
+17
View File
@@ -1,5 +1,6 @@
#include "timelineheader.h"
#include "mainwindow.h"
#include "panels/panels.h"
#include "panels/timeline.h"
#include "project/sequence.h"
@@ -12,6 +13,8 @@
#include <QMouseEvent>
#include <QScrollBar>
#include <QtMath>
#include <QMenu>
#include <QAction>
#define CLICK_RANGE 5
#define PLAYHEAD_SIZE 6
@@ -45,6 +48,9 @@ TimelineHeader::TimelineHeader(QWidget *parent) :
setMouseTracking(true);
setFocusPolicy(Qt::ClickFocus);
show_text(true);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(show_context_menu(const QPoint &)));
}
void TimelineHeader::set_scroll(int s) {
@@ -394,3 +400,14 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
p.fillPath(path, Qt::red);
}
}
void TimelineHeader::show_context_menu(const QPoint &pos)
{
QMenu contextMenu(tr("Context menu"), this);
QAction clear_in_out("Clear In/Out Points", this);
if (!viewer->seq->using_workarea) clear_in_out.setVisible(false);
connect(&clear_in_out, SIGNAL(triggered()), mainWindow, SLOT(on_actionClear_In_Out_triggered()));
contextMenu.addAction(&clear_in_out);
contextMenu.exec(mapToGlobal(pos));
}
+1
View File
@@ -29,6 +29,7 @@ public:
public slots:
void set_scroll(int);
void set_visible_in(long i);
void show_context_menu(const QPoint &pos);
protected:
void paintEvent(QPaintEvent*);