Skip to content

Commit 469c985

Browse files
checks if pasting is valid before adding paste action
1 parent a8423c1 commit 469c985

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/gui/clips/ClipView.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,10 +1098,16 @@ void ClipView::contextMenuEvent( QContextMenuEvent * cme )
10981098
: tr("Copy selection"),
10991099
[this](){ contextMenuAction( ContextMenuAction::Copy ); } );
11001100

1101-
contextMenu.addAction(
1101+
using namespace Clipboard;
1102+
TimePos clipPos{m_clip->startPosition()};
1103+
TrackContentWidget *tcw = getTrackView()->getTrackContentWidget();
1104+
bool canPaste = tcw->canPasteSelection( clipPos, getMimeData() );
1105+
1106+
auto pasteAction = contextMenu.addAction(
11021107
embed::getIconPixmap( "edit_paste" ),
11031108
tr( "Paste" ),
11041109
[this](){ contextMenuAction( ContextMenuAction::Paste ); } );
1110+
pasteAction->setEnabled( canPaste );
11051111

11061112
contextMenu.addSeparator();
11071113

0 commit comments

Comments
 (0)