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:
// Create scene (ratio of DIN A4)
scene->setSceneRect(0, 0, 210, 297);
// Set scene in view
ui->graphicsView->setScene(scene);
ui->graphicsView->setSceneRect(0, 0, 210, 297);
// Populate scene
pTextEdit->setFontPointSize(10);
pTextEdit->setFontFamily("Arial");
pTextEdit
->setGeometry
(QRect(20,
20,
80,
20));
QGraphicsProxyWidget *pProxy = scene->addWidget(pTextEdit);
// Create scene (ratio of DIN A4)
scene = new QGraphicsScene();
scene->setSceneRect(0, 0, 210, 297);
// Set scene in view
ui->graphicsView->setScene(scene);
ui->graphicsView->setSceneRect(0, 0, 210, 297);
// Populate scene
QTextEdit *pTextEdit = new QTextEdit(tr("Hallo <b>Fett</b>"));
pTextEdit->setFontPointSize(10);
pTextEdit->setFontFamily("Arial");
pTextEdit->setGeometry(QRect(20, 20, 80, 20));
QGraphicsProxyWidget *pProxy = scene->addWidget(pTextEdit);
To copy to clipboard, switch view to plain text mode
Thanks for any help!
bye,
Fabian
Bookmarks