c++ - Coordinate confusion -


I subclassed QGraphicsItem and rearranged paint. In the paint I wrote some label like this:

  painter-> Draw text ("Test", 10,40);  

After some time I think it can be useful to handle labeling with different items. That's why I wrote something like that.

  QGraphicsTextItem * label = new QGraphicsTextItem ("test", this); SetPos (10,40);  

But two "Tests" do not appear in the same place on the drawing screen. I think the difference can be related to the item coordinates - the visual coordinates I tried all the maps ... and the map ... the combination inside the QGraphics itam interface but there is no progress. I want a picture to come to the same place on the screen.
What do I miss?

I think you are using the same font size and type in both cases. If the difference in position is very small, then the reason may be that QGraphicTextItem is using some padding for the text in it. I try to use QGraphicsSimpleTextItem which is not going to internally add fancy stuff and if you still have the same problem, the coordinate system is the same if you use a painter or setpost, this is not a problem is. If this does not help, I would recommend specifying the same reset to both QT, in which this separation is empty.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -