@@ -3952,10 +3952,6 @@ void PageTextEdit::setHorizontalScroll(int _value)
39523952
39533953ContextMenu* PageTextEdit::createContextMenu (const QPoint& _position, QWidget* _parent)
39543954{
3955- if (isReadOnly ()) {
3956- return nullptr ;
3957- }
3958-
39593955 Q_D (PageTextEdit);
39603956 auto cursor = cursorForPosition (d->correctMousePosition (_position));
39613957 const int startPosition = std::min (textCursor ().selectionStart (), textCursor ().selectionEnd ());
@@ -3969,7 +3965,7 @@ ContextMenu* PageTextEdit::createContextMenu(const QPoint& _position, QWidget* _
39693965 }
39703966
39713967 auto cutAction = new QAction;
3972- cutAction->setEnabled (textCursor ().hasSelection ());
3968+ cutAction->setEnabled (textCursor ().hasSelection () && ! isReadOnly () );
39733969 cutAction->setText (tr (" Cut" ));
39743970 cutAction->setIconText (u8" \U000F0190 " );
39753971 cutAction->setWhatsThis (QKeySequence (QKeySequence::Cut).toString (QKeySequence::NativeText));
@@ -3983,13 +3979,14 @@ ContextMenu* PageTextEdit::createContextMenu(const QPoint& _position, QWidget* _
39833979 connect (copyAction, &QAction::triggered, this , &PageTextEdit::copy);
39843980
39853981 auto pasteAction = new QAction;
3982+ pasteAction->setEnabled (!isReadOnly ());
39863983 pasteAction->setText (tr (" Paste" ));
39873984 pasteAction->setIconText (u8" \U000F0192 " );
39883985 pasteAction->setWhatsThis (QKeySequence (QKeySequence::Paste).toString (QKeySequence::NativeText));
39893986 connect (pasteAction, &QAction::triggered, this , &PageTextEdit::paste);
39903987
39913988 auto deleteAction = new QAction;
3992- deleteAction->setEnabled (textCursor ().hasSelection ());
3989+ deleteAction->setEnabled (textCursor ().hasSelection () && ! isReadOnly () );
39933990 deleteAction->setText (tr (" Delete" ));
39943991 deleteAction->setIconText (u8" \U000F01B4 " );
39953992 connect (deleteAction, &QAction::triggered, this , [this ] { textCursor ().removeSelectedText (); });
0 commit comments