diff options
author | Waldo Bastian <bastian@kde.org> | 2014-09-16 03:22:04 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2015-12-15 19:54:01 +0100 |
commit | 664cc9b90c414cc209f255e62096d3fd9bdd797a (patch) | |
tree | 4e0b2212b69b901c941276236272429f513cea24 | |
parent | 15508fac70f1df7dd04a5d9b0f2dee1194b67001 (diff) | |
download | qt3-664cc9b90c414cc209f255e62096d3fd9bdd797a.tar.gz qt3-664cc9b90c414cc209f255e62096d3fd9bdd797a.zip |
Fix zoom in TQTextEdit
TQTextEdit::zoomIn / TQTextEdit::zoomOut does not work if the original
font had its size specified in pixels instead of points.
pointSize() returns 0 in such case.
(cherry picked from commit 14f96e80a52af97f643a1be57fa2c428ef8153c5)
-rw-r--r-- | src/widgets/qtextedit.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/widgets/qtextedit.cpp b/src/widgets/qtextedit.cpp index e45e42d..1bcf5c6 100644 --- a/src/widgets/qtextedit.cpp +++ b/src/widgets/qtextedit.cpp @@ -5774,7 +5774,12 @@ void QTextEdit::setFont( const QFont &f ) void QTextEdit::zoomIn( int range ) { QFont f( QScrollView::font() ); - f.setPointSize( QFontInfo(f).pointSize() + range ); + QFontInfo fi(f); + if (fi.pointSize() <= 0) { + f.setPixelSize( fi.pixelSize() + range ); + } else { + f.setPointSize( fi.pointSize() + range ); + } setFont( f ); } @@ -5789,7 +5794,12 @@ void QTextEdit::zoomIn( int range ) void QTextEdit::zoomOut( int range ) { QFont f( QScrollView::font() ); - f.setPointSize( QMAX( 1, QFontInfo(f).pointSize() - range ) ); + QFontInfo fi(f); + if (fi.pointSize() <= 0) { + f.setPixelSize( QMAX( 1, fi.pixelSize() - range ) ); + } else { + f.setPointSize( QMAX( 1, fi.pointSize() - range ) ); + } setFont( f ); } |