Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] How to remove Gray color background on selected text in QGraphicsTextItem after deselection.



  • Whenever we select some part of text in QGraphcisTextItem programs create default blue color background over that text and if we deselect QGraphcisTextItem , then program leaves gray color background with white color text.

    can anybody suggest how to remove this gray color background ?????



  • I am not entirely sure based on your description, but I suspect that the text stays selected while the GraphicsItem loses focus.

    Try reimplementing focusOut of the QGraphicsTextItem, and remove the text selection manually.



  • @Asperamancacabq

    thanx for suggesting a way ..
    i did a bit different

    i overrode itemchange() and in that checked section of ItemSelectedChange
    if selection false then call clearselection() from QTextCursor object.


Log in to reply