[SOLVED] how to position Text in a QGraphicsScene
-
the method
addText(const QString & text, const QFont & font = QFont())
of theQGraphicsScene
does not offer a way to position the insertedtext
,how can i insert a text in a desired position ?
-
Hi,
you can use the
setPos()
function.QGraphicsTextItem *text = scene->addText("Hello World"); text->setPos(100, 200);
-
okkk !!
that's what m searching for ^^
thank you , !! -
@youzking said:
thank you , !!
You're welcome.
When the problem is solved, you should do:
- Mark the post as SOLVED (helps when someone is looking for a solution for a problem)
- Vote the best answers you received (optional but helps to find which answers really contributed to the solution)
-
yes i know and i wanted to do so ,
but i can't find how to do it (or it is not clear), so i thought that the forum does not offer this option !! -
aah , i have just to rename the thread title ,, ok
-
Can you show me how to use this in Pyqt5 please?
-
@bjakubb
text = self.scene.addText('Hello world')
text.setPos(150, 200)