Fix guide context menu not showing

disable paste action if there is no paste data
parent d3140368
......@@ -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) {
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment