Hi there,

I have a QGraphicsScene with an embedded QTextEdit widget. How do I have to configure the scene so that the text gets the expected size when being printed on paper?

As far as I can see the TextEdit widget takes a point size for the font, but the actually printed size of this text depends on the scene size. The smaller I set the scene size, the larger the text will be printed.

I know that one point corresponds to 1/72 inch. But I have no idea how the point corresponds to the geometry of the text widget (and thus to the scene coordinate system).

Here is how I currently setup the scene:

Qt Code:
  1. // Create scene (ratio of DIN A4)
  2. scene = new QGraphicsScene();
  3. scene->setSceneRect(0, 0, 210, 297);
  4.  
  5. // Set scene in view
  6. ui->graphicsView->setScene(scene);
  7. ui->graphicsView->setSceneRect(0, 0, 210, 297);
  8.  
  9. // Populate scene
  10. QTextEdit *pTextEdit = new QTextEdit(tr("Hallo <b>Fett</b>"));
  11. pTextEdit->setFontPointSize(10);
  12. pTextEdit->setFontFamily("Arial");
  13. pTextEdit->setGeometry(QRect(20, 20, 80, 20));
  14. QGraphicsProxyWidget *pProxy = scene->addWidget(pTextEdit);
To copy to clipboard, switch view to plain text mode 

Thanks for any help!

bye,
Fabian