Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 859041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:37:27+00:00 2026-05-15T08:37:27+00:00

I subclassed QGraphicsItem and reimplemented paint. In paint I wrote something like this for

  • 0

I subclassed QGraphicsItem and reimplemented paint.
In paint I wrote something like this for labeling the item:

 painter->drawText("Test",10,40);

After some time I think It may be useful to handle labeling with seperate item. So I wrote something like this.

QGraphicsTextItem *label = new QGraphicsTextItem("TEST",this);
setPos(10,40);

But two “TEST” drawing do not appear in the same place on screen. I guess difference may be related with item coordinates – scene coordinates. I tried all mapFrom… and mapTo… combinations inside QGraphicsItem interface but no progress. I want to drawings to appear in the same place on screen.
What I miss?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:37:27+00:00Added an answer on May 15, 2026 at 8:37 am

    I assume that you are using the same font size and type in both cases. If the difference in position is very small the reason can be the QGraphicTextItem is using some padding for the text it contains. I would try to use QGraphicsSimpleTextItem that is not going to add fancy stuff internally and see if you still have the same problem. The coordinates system is the same one if you use painter or setPost so that is not the problem. If this doesn’t help I will suggest to specify the same rect for both to avoid Qt adding it owns separation spaces.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I subclassed QGraphicsItem twice: RingCollection is a kind of container item that should be
I have subclassed a UIImageView, and have implemented touchesBegan/Moved/Finished like this: - (void)touchesBegan:(NSSet *)touches
i animate (move) a subclassed UIImageView like this: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration: 1];
We have subclassed the Silverlight Application class to add some additional functionality and then
I have subclassed a UITableViewCell and within this class I want to get it's
I've subclassed QGraphicsItem into my own custom class, Hexagon. When I try to use
I have a subclassed JPanel that acts as a view for some information. When
I have subclassed Dialog in order to display a popup. This dialog contains a
I have a subclassed UITableViewController that performs some animations when editing mode is entered,
I am trying to implement a context menu in my QGraphicsItem subclass like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.