我正在尝试模仿命令行客户端。我希望将光标形状设置为“>”,以向用户显示消息。我在 QCursor 提供的选项中看不到那个形状。有没有办法为小部件光标设置自定义形状?
最佳答案
您需要设置 QTextEdit 视口(viewport)的光标: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."
例如完全隐藏光标:
ui.textEdit->viewport()->setCursor(Qt::BlankCursor);
关于qt - 如何在 QTextEdit 中将光标形状设置为 '>'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5269606/