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

  • Home
  • SEARCH
  • 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 1058969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:06:08+00:00 2026-05-16T18:06:08+00:00

I have a QGraphicsScene that has graphics as well as text drawn on it.

  • 0

I have a QGraphicsScene that has graphics as well as text drawn on it. When I try to print, the graphics are fine, but the text is using a font size defined in points, so scene->render() when I pass it a QPainter initialized with a QPrinter, has VERY large text.

How am I supposed to print a QGraphicsScene that has text on it?

edit:

Here is my current printing code, where scene_ is my custom subclass of QGraphicsScene:

  QPrinter printer(QPrinter::HighResolution);
  QPrintDialog dialog(&printer, this);
  dialog.exec();
  std::cout << printer.resolution() << std::endl;
  QPainter painter(&printer);
  scene_->render(&painter);

The std:cout line doesn’t appear to make any difference. The printer still thinks the text is huge, so for each text item only a tiny part of the first letter is printed.

  • 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-16T18:06:09+00:00Added an answer on May 16, 2026 at 6:06 pm

    From the QPrinter docs it sounds like you have to specify font sizes in pixels to get text and graphics to match up. Note that QFont has a setPixelSize method.

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

Sidebar

Related Questions

I need to view QGraphicsScene in 2 QGraphicsViews with condition that they have different
I have found this: Getting the size of a QGraphicsView But I can't figure
I can add a QPixMapImage to a QGraphicsScene, but then I have two issues.
I have a QGraphicsRectItem item in a QGraphicsScene. The item is movable and has
I have a program that draws the contents of a QGraphicsScene to a PNG
I have a UI and a QGraphicsScene subclass GraphicsScene that implements mousePressEvent(), however mouse
I have a few QGraphicsScene subclasses CustomScene all deriving from a common interface that
I have a QGraphicsScene that I want to copy and append to the start
I have added a QSpinBox to a QGraphicsScene using a QGraphicsProxyWidget. Each time I
In my application I have QGraphicsScene with pixmap added and all is viewed in

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.