Northern
Northern

Reputation: 2538

How to change cursor shape of QPlainTextEdit (Pyqt, PySide)

I have a simple Qt widget contains of a QPlainTextEdit. I only want to display text so I disabled text interaction. Now I want to change the cursor shape to the normal Qt.ArrowCursor. I tried:

self.disp = QPlainTextEdit()
self.disp.setTextInteractionFlags(Qt.NoTextInteraction)
self.disp.setCursor(Qt.ArrowCursor)

but it doesn't work.

PS: I don't want to use:

QApplication.setOverrideCursor(QCursor(Qt.ArrowCursor))

as I actually have other widgets in the application and I don't want to affect them.

Upvotes: 2

Views: 1714

Answers (1)

Jablonski
Jablonski

Reputation: 18504

Try set cursor to viewport() of QPlainTextEdit.

viewport().setCursor();

Upvotes: 3

Related Questions