aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2016-07-25 08:34:27 +0200
committerJean-Baptiste Mardelle <[email protected]>2016-07-25 08:34:27 +0200
commite3f2662b27aa6d3bc20df7121bd106694e612722 (patch)
tree857478029eac73c603b447105d4f7a3ccfb4953b
parentd3140368912fadfd585330d6356677bae9660bf0 (diff)
Fix guide context menu not showing
disable paste action if there is no paste data
-rw-r--r--src/timeline/customruler.cpp5
-rw-r--r--src/timeline/customtrackview.cpp10
2 files changed, 13 insertions, 2 deletions
diff --git a/src/timeline/customruler.cpp b/src/timeline/customruler.cpp
index edc4b64..b07c41a 100644
--- a/src/timeline/customruler.cpp
+++ b/src/timeline/customruler.cpp
@@ -146,8 +146,9 @@ void CustomRuler::setZone(const QPoint &p)
update();
}
-void CustomRuler::mouseReleaseEvent(QMouseEvent * /*event*/)
+void CustomRuler::mouseReleaseEvent(QMouseEvent *event)
{
+ event->setAccepted(true);
if (m_moveCursor == RULER_START || m_moveCursor == RULER_END || m_moveCursor == RULER_MIDDLE) {
emit zoneMoved(m_zoneStart, m_zoneEnd);
m_view->setDocumentModified();
@@ -159,6 +160,7 @@ void CustomRuler::mouseReleaseEvent(QMouseEvent * /*event*/)
// virtual
void CustomRuler::mousePressEvent(QMouseEvent * event)
{
+ event->setAccepted(true);
int pos = (int)((event->x() + offset()));
if (event->button() == Qt::RightButton) {
m_clickedGuide = m_view->hasGuide((int)(pos / m_factor), (int)(5 / m_factor + 1));
@@ -187,6 +189,7 @@ void CustomRuler::mousePressEvent(QMouseEvent * event)
// virtual
void CustomRuler::mouseMoveEvent(QMouseEvent * event)
{
+ event->setAccepted(true);
int mappedXPos = (int)((event->x() + offset()) / m_factor);
emit mousePosition(mappedXPos);
if (event->buttons() == Qt::LeftButton) {
diff --git a/src/timeline/customtrackview.cpp b/src/timeline/customtrackview.cpp
index 710e71a..06e7384 100644
--- a/src/timeline/customtrackview.cpp
+++ b/src/timeline/customtrackview.cpp
@@ -183,6 +183,9 @@ CustomTrackView::CustomTrackView(KdenliveDoc *doc, Timeline *timeline, CustomTra
connect(m_disableClipAction, &QAction::triggered, this, &CustomTrackView::disableClip);
m_disableClipAction->setCheckable(true);
m_document->doAddAction(QStringLiteral("clip_disabled"), m_disableClipAction, QKeySequence());
+ QAction *pasteAction = m_document->getAction(KStandardAction::name(KStandardAction::Paste));
+ if (pasteAction)
+ pasteAction->setEnabled(false);
}
CustomTrackView::~CustomTrackView()
@@ -855,7 +858,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
return;
}
- if (m_toolManagers.value(GuideType)->mousePress(ItemInfo(), event->modifiers(), collisionList)) {
+ if (event->button() == Qt::LeftButton && m_toolManagers.value(GuideType)->mousePress(ItemInfo(), event->modifiers(), collisionList)) {
QGraphicsView::mousePressEvent(event);
return;
}
@@ -6225,9 +6228,12 @@ void CustomTrackView::copyClip()
{
qDeleteAll(m_copiedItems);
m_copiedItems.clear();
+ QAction *pasteAction = m_document->getAction(KStandardAction::name(KStandardAction::Paste));
QList<QGraphicsItem *> itemList = scene()->selectedItems();
if (itemList.count() == 0) {
emit displayMessage(i18n("Select a clip before copying"), ErrorMessage);
+ if (pasteAction)
+ pasteAction->setEnabled(false);
return;
}
for (int i = 0; i < itemList.count(); ++i) {
@@ -6240,6 +6246,8 @@ void CustomTrackView::copyClip()
m_copiedItems.append(dup->clone());
}
}
+ if (pasteAction)
+ pasteAction->setEnabled(!m_copiedItems.isEmpty());
}
bool CustomTrackView::canBePastedTo(ItemInfo info, int type) const