diff options
author | Waldo Bastian <bastian@kde.org> | 2014-09-16 03:22:04 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2014-09-16 03:41:24 +0200 |
commit | 14f96e80a52af97f643a1be57fa2c428ef8153c5 (patch) | |
tree | 4bae26c8a29571a0bf280050f7eb9ae26527b955 | |
parent | 36ee984c64818f3b8180567d527f7d320606cfb1 (diff) | |
download | qt3-14f96e80a52af97f643a1be57fa2c428ef8153c5.tar.gz qt3-14f96e80a52af97f643a1be57fa2c428ef8153c5.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.
-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 2171e75..f2a4a91 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 ); } |