MCPcopy Create free account
hub / github.com/pyqtgraph/pyqtgraph / updateCodeViewTabWidth

Method updateCodeViewTabWidth

pyqtgraph/examples/ExampleApp.py:378–385  ·  view source on GitHub ↗

Change the codeView tabStopDistance to 4 spaces based on the size of the current font

(self,font)

Source from the content-addressed store, hash-verified

376 return super().event(event)
377
378 def updateCodeViewTabWidth(self,font):
379 """
380 Change the codeView tabStopDistance to 4 spaces based on the size of the current font
381 """
382 fm = QtGui.QFontMetrics(font)
383 tabWidth = fm.horizontalAdvance(' ' * 4)
384 # the default value is 80 pixels! that's more than 2x what we want.
385 self.ui.codeView.setTabStopDistance(tabWidth)
386
387 def showEvent(self, event) -> None:
388 super(ExampleLoader, self).showEvent(event)

Callers 2

__init__Method · 0.95
keyPressEventMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected