summaryrefslogtreecommitdiffstats
path: root/opensuse/core/qt3/0055-qtextedit_zoom.patch
blob: 38cdaa8a770f97331e95e0dfd8760df419f1338d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
qt-bugs@ issue : 
bugs.kde.org number :
applied: yes
author: Waldo Bastian <[email protected]>

QTextEdit::zoomIn /QTextEdit::zoomOut does not work if the original
font had its size specified in pixels instead of points.
pointSize() returns 0 in such case.

Index: widgets/qtextedit.cpp
================================================================================
--- src/widgets/qtextedit.cpp
+++ src/widgets/qtextedit.cpp
@@ -5774,7 +5774,11 @@
 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 +5793,11 @@
 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 );
 }