src/eric7/EricWidgets/EricAutoResizeTextBrowser.py

branch
eric7
changeset 11210
dd70d72aac30
parent 11090
f5f5f5803935
child 11214
8cb6b7651074
diff -r 244898adcf72 -r dd70d72aac30 src/eric7/EricWidgets/EricAutoResizeTextBrowser.py
--- a/src/eric7/EricWidgets/EricAutoResizeTextBrowser.py	Sun Apr 06 17:40:58 2025 +0200
+++ b/src/eric7/EricWidgets/EricAutoResizeTextBrowser.py	Mon Apr 07 18:36:12 2025 +0200
@@ -27,7 +27,7 @@
         super().__init__(parent=parent)
 
         self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
-        self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
+        self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded)
         self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
         self.setFrameShape(QFrame.Shape.NoFrame)
 
@@ -54,7 +54,11 @@
 
         # Get the document height and set it as the fixed height of the text browser.
         docHeight = self.document().size().height()
-        self.setFixedHeight(int(docHeight))
+        self.setFixedHeight(int(docHeight) + (
+            self.horizontalScrollBar().height()
+            if self.horizontalScrollBar().isVisible()
+            else 0
+        ))
 
         # Call the base class updateGeometry() method.
         super().updateGeometry()

eric ide

mercurial