There is a chance the following works.
if(event->buttons().test(Qt::MidButton)) {
return;
}
if(event->buttons().test(Qt::MidButton)) {
return;
}
To copy to clipboard, switch view to plain text mode
Otherwise you can reimplement QTextEdit::insertFromMimeData like this
{
public:
//the following effectively disables paste (as well as drop)
void insertFromMimeData
(const QMimeData *src
) {} };
class Edit : public QTextEdit
{
public:
//the following effectively disables paste (as well as drop)
void insertFromMimeData(const QMimeData *src) {}
};
To copy to clipboard, switch view to plain text mode
Edit:
However note that the above will also disable text drop. You can tackle that by setting a flag in dragEnterEvent and checking the same in the reimplemented insertFromMimeData method.
Do read the docs for clear picture.
Bookmarks