Cut and paste in QPlainTextEdit

  • I have set the font of a QPlainTextEdit to Courier New:

    @ QFont font = QFont("Courier New");
    charFormat = new QTextCharFormat();

    When I cut and paste part of a text this is going fine.
    However, when I select all, cut and paste the font is not Courier New anymore.

    What is the problem and how can this be solved?
    [edit: Code highlighting / Vass]

  • You should call setFont(font) on the QPlainTextEdit.

    Could you please wrap your code in two @-Tags, this makes it more readable.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.