Trying
QFont currentFont
= textArea
->font
();
currentFont.setStretch(125)
QFont currentFont = textArea->font();
currentFont.setStretch(125)
To copy to clipboard, switch view to plain text mode
doesn't have any effect.
I tried this:
qreal currentFontPointSize = textArea->font().pointSize();
qreal newFontPointSize = currentFontPointSize * 0.8;
qreal fontPointSizeChange = currentFontPointSize - newFontPointSize;
textArea->zoomOut(fontPointSizeChange);
qreal currentFontPointSize = textArea->font().pointSize();
qreal newFontPointSize = currentFontPointSize * 0.8;
qreal fontPointSizeChange = currentFontPointSize - newFontPointSize;
textArea->zoomOut(fontPointSizeChange);
To copy to clipboard, switch view to plain text mode
for zooming out and
qreal currentFontPointSize = textArea->font().pointSize();
qreal newFontPointSize = currentFontPointSize * 1.25;
qreal fontPointSizeChange = newFontPointSize - currentFontPointSize;
textArea->zoomIn(fontPointSizeChange);
qreal currentFontPointSize = textArea->font().pointSize();
qreal newFontPointSize = currentFontPointSize * 1.25;
qreal fontPointSizeChange = newFontPointSize - currentFontPointSize;
textArea->zoomIn(fontPointSizeChange);
To copy to clipboard, switch view to plain text mode
for zooming in and that works!
Only problem I now have is that the fonts of the QtextDocument are also changing and I want to keep that the same, because I'm making a pdf of the QTextDocument.
When I zoomOut the QTextEdit I get very small fonts in the pdf and I want to keep the same proportions. That's why I thought of changing the size of the QTextDocument as well.
I tried:
QSizeF currentDocumentSize
= textArea
->document
()->size
();
textArea->document()->setPageSize(0.8 * currentDocumentSize);
QSizeF currentDocumentSize = textArea->document()->size();
textArea->document()->setPageSize(0.8 * currentDocumentSize);
To copy to clipboard, switch view to plain text mode
and
textArea->document()->setPageSize(textArea->size());
textArea->document()->setPageSize(textArea->size());
To copy to clipboard, switch view to plain text mode
both don't give the good size, they make the QTextEdit a tiny bit to large.
Do you have any idea how I can resize the QTextEdit while keeping the QTextDocument the same size for pdf and printing?
Or am I trying to do things with a QTextWidget that are not possible and should I use an own Widget?
Bookmarks