Sulla
Sulla

Reputation: 8019

How to set cursor shape to '>' in a QTextEdit?

I am trying to mimic a command-line client. I wish to set the cursor shape to '>', to show messages to user. I don't see that shape in the options provided by QCursor. Is there a way to set custom shapes to widget cursors?

Upvotes: 2

Views: 3700

Answers (3)

Benny G
Benny G

Reputation: 371

You need to set the QTextEdit's viewport's cursor: http://doc.qt.nokia.com/stable/qtextedit.html

"The shape of the mouse cursor on a QTextEdit is Qt::IBeamCursor by default. It can be changed through the viewport()'s cursor property."

e.g. To hide the cursor completely:

ui.textEdit->viewport()->setCursor(Qt::BlankCursor);

Upvotes: 5

TonyK
TonyK

Reputation: 17114

You may think you want to do this, but you really don't. What will it gain you to change the mouse cursor to '>'? It will certainly confuse the user.

Upvotes: 1

yolo
yolo

Reputation: 2795

are you talking about mouse's shape enter image description here

or about the text caret enter image description here

Check QTextLayout::drawCursor

Upvotes: 2

Related Questions