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

QGraphicsTextItem doesn't have methods: setDefaultTextColor and setPos



  • Hello guys!
    I am writing first time using Qt, trying to modify Clementine music player and add some useful feature. I almost completed what I wanted to do. But now I need just add text to the window which is QGraphicsScene, so I am trying to add text using method: addText("text")

    It works, but then I need to change color and position of the text in this view. But Kdevelop doesn't recognize that this QGraphicsTextItem (returned by method addText) has methods: setDefaultTextColor and setPos.

    According to documentation it should have.

    Qt: 5-15.



  • Solution was easy. I had to add

    #include <QGraphicsTextItem>
    

    and it just works.


Log in to reply