[Qt-interest] Can QTextEdit scale in the way what QGraphicsView does?

cheng long kevinclcn at gmail.com
Thu May 20 09:47:06 CEST 2010


QGraphicsView scales its content by adjusting its transform matrix,
very excellent!

Is there any way to add this functionality to QTextEdit? How?

I tried to modify Qt's code (Qt 4.6.2) as follows:
1. Add xScale and yScale in class QTextEditPrivate;
2. Add scale(qreal x, qreal y) in class QTextEdit to set xScale and yScale;
3. Add codes below in QTextEdit::paintEvent(QPaintEvent *e)
   p.scale(d->xScale, d->yScale);

To scale, I call QTextEdit::scale(). But that doesn't work. It has 3 issues:
1. Don't repaint after scale() is called, even if after I called
QTextEdit::repaint().
2. A new line created by Enter key will cover all lines above.
3. Characters keep blinking when inputting new characters in the same line.

Where am I wrong? Thanks!

Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100520/63998243/attachment.html 


More information about the Qt-interest-old mailing list