如何将光标形状设置为'>'在 QTextEdit 中?
我正在尝试模仿命令行客户端。我希望将光标形状设置为“>”,以向用户显示消息。我在 QCursor 提供的选项中没有看到该形状。有没有办法为小部件光标设置自定义形状?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要设置 QTextEdit 视口的光标: http://doc.qt.nokia.com/稳定/qtextedit.html
例如要完全隐藏光标:
You need to set the QTextEdit's viewport's cursor: http://doc.qt.nokia.com/stable/qtextedit.html
e.g. To hide the cursor completely:
您是在谈论鼠标的形状
还是在谈论文本插入符
检查 QTextLayout::drawCursor
are you talking about mouse's shape
or about the text caret
Check QTextLayout::drawCursor
您可能认为您想这样做,但实际上不想这样做。将鼠标光标更改为“>”会给您带来什么好处?这肯定会让用户感到困惑。
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.