How can I hide the caret when not in edit mode?
问题 I have a TextItem inheriting QGraphicsTextItem . I made it so that on double-click I can edit the text, and when clicking out, the text is no longer editable. void TextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event) { setTextInteractionFlags(Qt::TextEditorInteraction); setFocus(); int p = document()->documentLayout()->hitTest(event->pos(), Qt::FuzzyHit); QTextCursor _cursor = textCursor(); _cursor.setPosition(p); setTextCursor(_cursor); } void TextItem::focusOutEvent(QFocusEvent